WFL tests #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: WFL tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: wfl-tests-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| wfl-tests: | |
| name: WFL nightly (Blacksmith) | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 30 | |
| env: | |
| WFL_IMAGE: bsbyrdwfl/wfl:nightly | |
| TEST_CONTAINER: scriptorium-tests-${{ github.run_id }}-${{ github.run_attempt }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| submodules: recursive | |
| - name: Pull latest WFL nightly and record runtime | |
| id: runtime | |
| shell: bash | |
| run: | | |
| docker pull "$WFL_IMAGE" | |
| image="$(docker image inspect --format '{{index .RepoDigests 0}}' "$WFL_IMAGE")" | |
| echo "image=$image" >> "$GITHUB_OUTPUT" | |
| version="$(docker run --rm --network none "$image" --version)" | |
| runtime_revision="$(docker image inspect --format '{{index .Config.Labels "org.opencontainers.image.revision"}}' "$image")" | |
| [[ "$runtime_revision" =~ ^[a-f0-9]{40}$ ]] || { echo 'Official image is missing its WFL source revision'; exit 1; } | |
| { | |
| echo '### WFL nightly test environment' | |
| echo | |
| echo "- Image: $image" | |
| echo "- Runtime: $version" | |
| echo "- WFL revision: $runtime_revision" | |
| echo "- Scriptorium: $(git rev-parse HEAD)" | |
| echo "- Scribe: $(git -C lib/scribe rev-parse HEAD)" | |
| echo '- Runner: blacksmith-2vcpu-ubuntu-2404 (Linux x64)' | |
| echo '- Command: wfl --execution-timeout 1200 scripts/run_tests.wfl' | |
| echo '- Coverage: application, ORM/migrations/recovery, HTTP integration, tooling, examples, pinned Scribe' | |
| } | tee -a "$GITHUB_STEP_SUMMARY" | |
| - name: Run the complete WFL suite | |
| shell: bash | |
| env: | |
| RESOLVED_IMAGE: ${{ steps.runtime.outputs.image }} | |
| run: | | |
| # The published image is a minimal runtime with a WFL entrypoint. | |
| # Python is only the implementation of the repository hygiene checker. | |
| # Every scenario, fixture, assertion and test driver is WFL. A writable | |
| # disposable copy keeps synthetic databases/Git indexes off the checkout. | |
| docker run --rm --init --name "$TEST_CONTAINER" \ | |
| --user 0:0 --entrypoint /bin/sh \ | |
| --mount "type=bind,source=$GITHUB_WORKSPACE,target=/source,readonly" \ | |
| --workdir /work "$RESOLVED_IMAGE" -ec ' | |
| apt-get update | |
| apt-get install --yes --no-install-recommends python3 python-is-python3 git | |
| cp -a /source/. /work/ | |
| python3 --version | |
| wfl --version | |
| wfl --execution-timeout 1200 scripts/run_tests.wfl | |
| ' | |
| - name: Clean up test container | |
| if: always() | |
| shell: bash | |
| run: | | |
| # Killing a Docker client on cancellation may leave its container up. | |
| if docker container inspect "$TEST_CONTAINER" >/dev/null 2>&1; then | |
| docker container rm --force "$TEST_CONTAINER" | |
| fi |