CI on GitHub's runners
Builds
build.yml runs one of two builds:
| Trigger | Build | Jobs |
|---|---|---|
| a push to a draft pull request a manual run (workflow_dispatch) a push to master or stable in a fork |
reduced | build-reduced: 2 entries, ubuntu-24.04 x86-64, GHC 9.6.3, at -O0 (-O2 on pushes), without the standard build |
| a pull request marked ready for review, and later pushes to it a push to master or stable in simplex-chat/simplexmq a push of a v* tag |
full | build: 6 entries (GHC 8.10.7 and 9.6.3, x86-64 and aarch64), at -O0 on pull requests and -O2 on pushes |
Both builds also run maybe-release and resolver (python). Tests run on the x86-64 entries, after xftp-web is built with Node.js 22 (npm install, npm run build) for the XFTP Web Client tests. In both builds, the ubuntu-24.04 x86-64 entry named "PostgreSQL agent store" builds and runs only the tests built with -fclient_postgres -fslow_servers (agent with the PostgreSQL store, and XFTP servers that delay responses for the slow-server test, which the other builds skip), in the build directory dist-client-postgres, in step "Test with PostgreSQL agent store", in parallel with the other entries; its build directory has its own cache key. After the tests, step "Check generated files" fails if a test changed a tracked file: the schema dump and query plan tests overwrite their files, so a stale file fails here even when the test passes on retry. The reduced build restores the -O0 build caches saved by master pushes; the Docker image cache is tagged by ISO week, so the first run of a week rebuilds the image.
Test selection
- Draft pull request: a fenced block with the info string
ci-testsin the description, one hspec match pattern per line. The block is read at each push; an edit applies from the next push. - Manual run: input
tests, one pattern per line. /runs all tests. With no pattern, a reduced build runs no tests. A full build runs all tests and ignores the selection.- Each pattern is passed as
-m <pattern>. With at least one pattern,--fail-on=emptyis added, so a pattern that matches nothing fails the run. - A pattern matches the item path
/group/subgroup/item/as a substring. Group names are thedescribenames in tests/Test.hs.
Example block:
```ci-tests
/Core tests/Encoding tests/
SMP proxy
```
Manual run
curl -fsS -X POST \
-H "Authorization: Bearer $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/<owner>/simplexmq/actions/workflows/build.yml/dispatches \
-d '{"ref": "<branch>", "inputs": {"tests": "/Core tests/Encoding tests/\nSMP proxy"}}'
A manual run starts on a branch; a release is retried by re-running the jobs of its tag push.
Local run
scripts/ci/run-tests.sh runs the selection as in CI: it appends the patterns of TESTS to the test command.
cabal build --enable-tests --ghc-options=-O0 simplexmq-test
TESTS='/Core tests/Encoding tests/' scripts/ci/run-tests.sh "$(cabal list-bin simplexmq-test --ghc-options=-O0)"