Developers
OCPP tests in GitHub Actions and GitLab CI
On every pull request, TimeTick runs your test on a simulator connected to your CSMS on staging. If the test fails, so does the job.
Before you start
Section titled “Before you start”- Create a simulator for your staging CSMS and run a test on it in the portal until it passes.
- Save an API key as the secret
TIMETICK_API_TOKEN. - Note three numbers from the address bar in the portal:
| Id | Address |
|---|---|
| Project | app.timetick.io/projects/<project id> |
| Test | .../tests/<test id> |
| Simulator | .../simulators/<simulator id> |
GitHub Actions
Section titled “GitHub Actions”Save this as .github/workflows/timetick.yml and put in your ids:
name: TimeTick OCPP tests
on: pull_request: workflow_dispatch:
concurrency: group: timetick
jobs: ocpp-tests: runs-on: ubuntu-latest steps: - name: Run the TimeTick test uses: TimeTickIO/timetick-ci@v1 with: api-key: ${{ secrets.TIMETICK_API_TOKEN }} project-id: "123" test-id: "456" simulators: "789"To test a branch, deploy it to staging before this step. The job page shows a table with the results.
GitLab CI
Section titled “GitLab CI”Save the key as a masked variable named TIMETICK_API_TOKEN, then add:
stages: - test
include: - component: gitlab.com/TimeTickIO/timetick-ci/run-test@1.0.0 inputs: version: "1.0.0" project-id: "123" test-id: "456" simulators: "789"Results appear in the Tests tab of the merge request.
Other CI
Section titled “Other CI”You need Node.js 20:
wget -qO timetick.js https://gitlab.com/TimeTickIO/timetick-ci/-/raw/1.0.0/dist/index.js
INPUT_PROJECT_ID=123 INPUT_TEST_ID=456 INPUT_SIMULATORS=789 node timetick.jsIt exits with 0 when the test passes.
A simulator runs one test at a time, so give each pipeline its own. All options are in the timetick-ci repository.