Skip to content

ci: add a GitLab CI for the offline checks and the Android testers - #37

Merged
pierridotite merged 4 commits into
pierridotite:mainfrom
WTFitsmemyself:agent/mobile-agent-testers/gitlab-ci
Nov 28, 2026
Merged

pierridotite merged 4 commits into
pierridotite:mainfrom
WTFitsmemyself:agent/mobile-agent-testers/gitlab-ci

Conversation

@WTFitsmemyself

Copy link
Copy Markdown
Contributor

Overview

This adds a GitLab CI (.gitlab-ci.yml) so the project can run on GitLab as well as GitHub Actions, reusing the scripts that already exist instead of rewriting the workflow.

It ports the half that is portable without a phone or a macOS runner:

  • the offline checks of .github/workflows/tests.yml (unit tests, compileall, shellcheck) on both Python versions CI uses — no phone, no model, no secret, so any runner runs them;
  • the Android testers of .github/workflows/agent-testers.yml as a manual job on a runner tagged kvm, reusing scripts/build/android.sh and scripts/android/run_agent.sh unchanged.

Closes #17 (partially — see "What is not covered").

Motivation

The project ships only GitHub Actions. Its build scripts, persona tools and encryption are explicitly portable (CONTRIBUTING.md → "Other CI"), and issue #17 asks for a GitLab CI "that reuses them (Android first, on Linux runners with KVM)". This delivers that without touching any existing script or workflow.

Changes, commit by commit

Commit Title Files What and why
a40cd9d ci: add a GitLab CI for the offline checks and the Android testers .gitlab-ci.yml stages: [test, testers]. unit-tests-3.9 / unit-tests-3.13 extend a .unit-tests template that runs python3 -m unittest discover -s tests -q and python3 -m compileall -q scripts tests — the exact commands of tests.yml. shell-scripts mirrors the bash -n + shellcheck -S warning pass. android-testers is when: manual, tags: [kvm], builds with scripts/build/android.sh, runs scripts/android/run_agent.sh, then git checkout -- scripts results_public.pem and scripts/encrypt_results.sh before the encrypted results.enc/ artifact.
00fca5d test: keep the GitLab CI in step with the GitHub workflow tests/test_gitlab_ci.py Stdlib-only guard, in the spirit of test_matrix.py (reads the workflow) and test_i18n_links.py (checks referenced paths): every path the file names exists, the offline checks match tests.yml, and the Android job still reuses the repository scripts.
56d65e0 docs: point the Other CI section at the GitLab CI CONTRIBUTING.md Issue #17 sends readers to "Other CI"; name the file there, and state what the port covers and that Bitrise/Codemagic are still open.

Technical implementation

  • Emulator lifecycle stays with the runner. scripts/android/run_agent.sh's own header says it "runs inside android-emulator-runner once the emulator is up". On GitLab that "once the emulator is up" is the kvm-tagged runner's job, exactly as it is the GitHub action's job on GitHub. So no emulator-bootstrap code is added that could rot; the script's existing contract is respected.
  • Secrets and privacy are unchanged. The Android job needs the same project variables the GitHub job needs (LLM_API_KEY/CLAUDE_CODE_OAUTH_TOKEN, ARTIFACT_PASSPHRASE) and a committed results_public.pem; it fails closed when that key is missing, and encrypts before the artifact, because the logs of a public repo are public.
  • Script tampering is handled the GitLab way. after_script restores scripts/ and the public key before running encrypt_results.sh, the same ordering the GitHub job uses with git checkout -- scripts results_public.pem.
  • No new dependency and no change to existing behavior. The file is additive; the extended tests are stdlib unittest, and nothing in the existing workflow, scripts or tests changes.

Testing

Run offline, no phone and no model:

python3 -m unittest discover -s tests -q      # Ran 280 tests ... OK (skipped=3)   (277 before + 3 new)
python3 -m unittest tests.test_gitlab_ci -v   # 3 passed
python3 -m compileall -q scripts tests        # OK
for f in $(git ls-files '*.sh'); do bash -n "$f"; done   # OK (mirrors the shellcheck job's parse pass)
python3 -c "import yaml,sys; yaml.safe_load(open('.gitlab-ci.yml'))"   # parses; 2 stages, 4 jobs + 1 template

The test jobs are verified locally with the same commands they run. The android-testers job needs a GitLab runner with KVM and a booted emulator, which this environment does not have, so it is provided as a faithful port of the GitHub job and not executed here — call that out in review if you want the emulator bootstrap in the file instead of on the runner.

Compatibility

  • Python 3.9 and 3.13, the two versions .github/workflows/tests.yml uses.
  • No effect on the GitHub workflow; the two CI files can coexist and both reuse the same scripts.
  • tests/test_gitlab_ci.py runs anywhere the rest of the suite does.

What is not covered

  • iOS builds and testers need a macOS runner; gitlab.com's shared runners are Linux only. A self-hosted macOS runner reusing scripts/build/ios.sh and scripts/ios/run_agent.sh would port them the same way (noted in the file header).
  • The web personas and the plan/matrix job of the GitHub workflow are not ported; the Android job takes one PERSONA variable, set when you run the pipeline.

References

GitHub Actions is the only CI the project ships, so a GitLab user cannot run the
suite or the testers without rewriting the workflow. The build scripts, the
persona tools and the encryption are already portable, so this adds the GitLab
side that reuses them.

- test: the same offline checks as .github/workflows/tests.yml (unit tests,
  compileall, shellcheck) on the two Python versions CI uses, with no phone and
  no secret, so any runner can run them.
- testers: the Android testers, manual, on a runner tagged `kvm` that provides a
  booted emulator (scripts/android/run_agent.sh assumes one is up, exactly as it
  does under the GitHub action). It reuses scripts/build/android.sh and
  scripts/android/run_agent.sh unchanged and encrypts the results first.

iOS still needs a macOS runner, which gitlab.com's shared runners are not, so it
is left to a self-hosted macOS runner.

Refs pierridotite#17
The GitLab file points at the repository's own scripts, so a moved or renamed
script would break it silently. tests/test_matrix.py already reads the GitHub
workflow and test_i18n_links.py checks that referenced paths exist; this follows
the same idea for .gitlab-ci.yml: every referenced path exists, the offline
checks match tests.yml, and the Android job reuses the repository scripts.
Issue pierridotite#17 sends readers of the "Other CI" section to this file; name it there so
a contributor adding Bitrise or Codemagic sees what the GitLab port covers and
what is still open.

Copy link
Copy Markdown
Owner

Thanks, the offline part is good and the test is a nice guard. Three things before I merge:

  1. debian:stable-slim has no git, so git ls-files fails in the shell-scripts job. Install git there, or use an image that has it.
  2. run_agent.sh runs with set -u and reads LOCALE, DEVICE and GEO (on GitHub they come from the persona matrix). The job sets none of them, so it stops at line 15. Could the job read them for $PERSONA from personas.json, the way the plan job does?
  3. Please keep the template key check from the GitHub workflow (Check setup step) instead of only test -s.

If the Android job can't be tried on a KVM runner, I'm also fine with a PR that only has the offline checks, and the Android job in a second one.


Generated by Claude Code

Three fixes from review:
- shell-scripts ran on debian:stable-slim, which has no git, so
  `git ls-files` failed; install git with shellcheck.
- run_agent.sh runs under set -u and reads LOCALE, DEVICE and GEO, which
  the job never set; read them from personas.json for $PERSONA via
  scripts/matrix.py, the same way the GitHub plan job does.
- keep the template-key fail-closed check from the GitHub "Check setup"
  step instead of only test -s, so a fork that did not run ./setup.sh
  cannot encrypt its results to a key it does not hold the private half of.
@pierridotite
pierridotite merged commit bf20b5e into pierridotite:main Nov 28, 2026
2 checks passed

Copy link
Copy Markdown
Owner

Thanks, all three are fixed. Merged. I added a small follow-up (76c6283) so the job also passes the persona's font scale, theme, contrast, color filter and network, like the GitHub matrix does.


Generated by Claude Code

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.

GitLab CI version of the workflow

2 participants