|
| 1 | +# SPDX-License-Identifier: MPL-2.0 |
| 2 | +name: "CI / required" |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ci-${{ github.event.pull_request.number || github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + required: |
| 19 | + name: "CI / required" |
| 20 | + runs-on: ubuntu-latest |
| 21 | + timeout-minutes: 20 |
| 22 | + container: |
| 23 | + # Idris 2 0.8.0, pinned by immutable image digest. |
| 24 | + # The digest is the authority; keep the version note in step with it. |
| 25 | + image: ghcr.io/stefan-hoeck/idris2-pack@sha256:de9781906050dc44704ec6de0108c86f899ef17b2642932b79e00245d613b8ad |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 29 | + |
| 30 | + # The pinned idris2-pack image is minimal. Two things are missing: |
| 31 | + # xz — setup-zig's .tar.xz download dies with "tar: xz: Cannot exec" |
| 32 | + # jq — tests/check-examples.sh exits 2 with "jq is required", so the |
| 33 | + # Trope IR conformance test never actually ran in CI |
| 34 | + - name: Install container prerequisites (xz, jq) |
| 35 | + shell: bash |
| 36 | + run: | |
| 37 | + set -euo pipefail |
| 38 | + missing=() |
| 39 | + command -v xz >/dev/null 2>&1 || missing+=(xz-utils) |
| 40 | + command -v jq >/dev/null 2>&1 || missing+=(jq) |
| 41 | + if [ "${#missing[@]}" -gt 0 ]; then |
| 42 | + echo "installing: ${missing[*]}" |
| 43 | + apt-get update -qq |
| 44 | + apt-get install -y -qq --no-install-recommends "${missing[@]}" |
| 45 | + fi |
| 46 | + xz --version | head -1 |
| 47 | + jq --version |
| 48 | +
|
| 49 | + - name: Set up Zig |
| 50 | + uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1 |
| 51 | + with: |
| 52 | + version: 0.15.2 |
| 53 | + |
| 54 | + - name: Typecheck the Idris2 ABI |
| 55 | + shell: bash |
| 56 | + run: | |
| 57 | + set -euo pipefail |
| 58 | + # Print the version before asserting on it: piping straight into |
| 59 | + # `grep -Fx` under `pipefail` made a mismatch fail with no output at |
| 60 | + # all, which is what happened here. The pinned image reports a build |
| 61 | + # suffix, so match on the release rather than the whole string. |
| 62 | + ver="$(idris2 --version)" |
| 63 | + echo "idris2 --version -> ${ver}" |
| 64 | + case "$ver" in |
| 65 | + *"0.8.0"*) ;; |
| 66 | + *) echo "::error::expected Idris 2 0.8.0, got: ${ver}"; exit 1 ;; |
| 67 | + esac |
| 68 | + idris2 --typecheck abi.ipkg |
| 69 | +
|
| 70 | + - name: Compile and test the Zig FFI |
| 71 | + shell: bash |
| 72 | + run: | |
| 73 | + set -euo pipefail |
| 74 | + zver="$(zig version)" |
| 75 | + echo "zig version -> ${zver}" |
| 76 | + test "$zver" = '0.15.2' || { echo "::error::expected Zig 0.15.2, got: ${zver}"; exit 1; } |
| 77 | + zig fmt --check \ |
| 78 | + src/interface/ffi/build.zig \ |
| 79 | + src/interface/ffi/src/main.zig \ |
| 80 | + src/interface/ffi/test/integration_test.zig |
| 81 | + ( |
| 82 | + cd src/interface/ffi |
| 83 | + zig build --summary all |
| 84 | + zig build test --summary all |
| 85 | + ) |
| 86 | +
|
| 87 | + - name: Validate repository contracts |
| 88 | + shell: bash |
| 89 | + run: | |
| 90 | + set -euo pipefail |
| 91 | + find tests scripts -type f -name '*.sh' -print0 \ |
| 92 | + | xargs -0 -r bash -n |
| 93 | + bash tests/check-examples.sh |
| 94 | + bash tests/aspect_tests.sh |
| 95 | + bash scripts/check-root-shape.sh . |
| 96 | + bash tests/workflows/validate_workflows_test.sh |
0 commit comments