Skip to content

ci: refactor test setup#8

Merged
reubenmiller merged 2 commits into
mainfrom
ci/refactor-test-setup
Jun 22, 2026
Merged

ci: refactor test setup#8
reubenmiller merged 2 commits into
mainfrom
ci/refactor-test-setup

Conversation

@reubenmiller

Copy link
Copy Markdown
Collaborator

Refactor the CI and system tests to the modern thin-edge.io community pattern (mirrors thin-edge/tedge-apk-plugin#5).

What changed

  • Per-test device setup — instead of one long-lived suite device, each test creates and destroys a fresh device via DeviceLibrary.Setup (Test Setup/Test Teardown). The device is registered through the Cumulocity CA (Bulk Register Device With Cumulocity CA + tedge cert download c8y) and cleaned up afterwards with Delete Managed Object And Device User — no more manual cleanup of devices/certs/users.
  • Fork-PR safety via /test — the legacy pull_request_target + manual GitHub Environment approval is gone. In-repo (maintainer) PRs run automatically on pull_request; fork PRs (no secret access) run only when a maintainer comments /test, dispatched via peter-evans/slash-command-dispatch (test-slash-command.yamlrepository_dispatch).
  • Workflow shape — single test job split into buildtest (matrix) → tests-pass. The package is built once and uploaded as the dist-packages artifact; the test job downloads it and runs the matrix. Results are posted back to the PR.
  • Matrix-ready Dockerfiletest-images/<IMAGE>/Dockerfile is replaced by a single parametrized images/Dockerfile (ARG TEST_IMAGE), built via a minimal docker-compose.yaml. The matrix currently runs the systemd demo image (debian-12); add more entries to cover more images.
  • Housekeeping.python-version moved to tests/.python-version; obsolete IMAGE/build-test just targets removed; action versions pinned to current majors; robotframework-c8y0.51.1 and robotframework-devicelibrary1.26.1 (needed for the CA flow and per-test Setup).

⚠️ Required before merge

  • COMMUNITY_ACTIONS_PAT secret — a repo-scoped PAT must be stored as the COMMUNITY_ACTIONS_PAT secret. The default GITHUB_TOKEN cannot create repository_dispatch events, so the /test slash command will not work without it.
  • Branch protection — update the required status check to Tests Pass (the matrix job names change, but this gate job name is stable).

Notes

  • Service logs are collected from the systemd journal (journalctl), matching the demo image's init system.
  • actionlint is clean (the pre-existing release.yaml shellcheck note is unrelated). Robot --dryrun passes, confirming all keywords resolve against the bumped libraries.

🤖 Generated with Claude Code

reubenmiller and others added 2 commits June 22, 2026 17:04
Replace the pull_request_target + manual GitHub Environment approval flow
with a build -> test (matrix) -> tests-pass structure:

- In-repo (maintainer) PRs run automatically on pull_request.
- Fork PRs lack secret access and are triggered by a maintainer commenting
  /test, dispatched via peter-evans/slash-command-dispatch
  (test-slash-command.yaml -> repository_dispatch).
- Split build (package once, upload dist artifact) from a matrix test job so
  multiple base images can be tested; results are posted back to the PR.
- Add a stable "Tests Pass" gate job for branch protection.
- Move .python-version into tests/ and pin actions to current majors.

Requires a repo-scoped PAT stored as the COMMUNITY_ACTIONS_PAT secret.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the single suite-level device with a fresh device created and
destroyed per test:

- Setup Device / Teardown Device create the container via docker-compose,
  register it through the Cumulocity CA, and clean up the managed object and
  device user afterwards (no more manual cleanup).
- Parametrize images/Dockerfile with ARG TEST_IMAGE so the matrix can target
  different base images; build it via docker-compose (replaces the per-image
  test-images/<IMAGE>/Dockerfile and the just build-test target).
- Bump robotframework-c8y and robotframework-devicelibrary to versions that
  support Cumulocity CA registration and per-test Setup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
4 0 0 4 100 2m1.27802s

@reubenmiller reubenmiller merged commit d8dca64 into main Jun 22, 2026
6 of 7 checks passed
@reubenmiller reubenmiller deleted the ci/refactor-test-setup branch June 22, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant