bench(ci): bench PRs targeting feat/perf/fix branches for stacked-PR … #193
Workflow file for this run
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
| # yamllint disable rule:line-length | |
| name: build | |
| # yamllint disable rule:truthy | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - '*.md' | |
| push: | |
| paths-ignore: | |
| - '*.md' | |
| # yamllint enable rule:truthy | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| jobs: | |
| test: | |
| name: Test nim-${{ matrix.nim-version }} / ${{ matrix.runs-on }} | |
| runs-on: ${{ matrix.runs-on }} | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runs-on: ubuntu-latest | |
| nim-version: 'stable' | |
| sanitize-threads: 'yes' | |
| sanitize-address: 'yes' | |
| - runs-on: ubuntu-24.04-arm | |
| nim-version: 'stable' | |
| sanitize-threads: 'yes' | |
| sanitize-address: 'yes' | |
| - runs-on: macos-latest | |
| nim-version: 'stable' | |
| sanitize-threads: 'yes' | |
| sanitize-address: 'yes' | |
| steps: | |
| - name: Restore cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${HOME}/.cache | |
| key: cache-${{ matrix.runs-on }}-${{ matrix.nim-version }} | |
| - name: Checkout project | |
| uses: actions/checkout@v4 | |
| - name: Setup Nim ${{ matrix.nim-version }} | |
| uses: jiro4989/setup-nim-action@v2 | |
| with: | |
| nim-version: ${{ matrix.nim-version }} | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update -q -y | |
| sudo apt-get -qq install -y clang | |
| - name: Clone and install sibling deps (nim-debra, nim-typestates) | |
| # nim.cfg uses --path:"../nim-debra/src" and --path:"../nim-typestates/src" | |
| # for compiler-side resolution. Nimble's dep resolver runs BEFORE | |
| # the compiler though, and `nimble test` will refuse to launch if | |
| # `requires "debra >= 0.3.0"` is unsatisfiable from nimble's | |
| # package store. So fetch the matching branches and `nimble install` | |
| # them locally to satisfy the resolver. Once debra 0.3.0 publishes | |
| # this whole step can go away. | |
| run: | | |
| set -e | |
| cd .. | |
| git clone --depth 1 --branch main https://github.com/elijahr/nim-debra.git | |
| git clone --depth 1 --branch main https://github.com/elijahr/nim-typestates.git | |
| (cd nim-typestates && nimble install -y) | |
| (cd nim-debra && nimble install -y) | |
| - name: Vendor unittest2 (nim.cfg expects deps/unittest2) | |
| # deps/ is gitignored. nim.cfg has --path:"deps/unittest2". | |
| run: git clone --depth 1 https://github.com/status-im/nim-unittest2.git deps/unittest2 | |
| - name: Run tests | |
| run: | | |
| set -o pipefail | |
| export SANITIZE_THREADS=${{ matrix.sanitize-threads }} | |
| export SANITIZE_ADDRESS=${{ matrix.sanitize-address }} | |
| # Workaround for nimble v0.20.x: `nimble <task>` exits 0 even when | |
| # an inner `exec` aborts the script (it logs `Error:` but does not | |
| # propagate the failure). Tee output and grep for nimble's error | |
| # markers to force a non-zero exit. See Item 8 / nimble issue. | |
| nimble_run() { | |
| local logfile | |
| logfile="$(mktemp)" | |
| "$@" 2>&1 | tee "$logfile" | |
| local rc=${PIPESTATUS[0]} | |
| if [[ $rc -ne 0 ]]; then | |
| return $rc | |
| fi | |
| if grep -Eq '^[[:space:]]*Error:' "$logfile"; then | |
| echo "::error::nimble reported an error but exited 0; failing the step." | |
| return 1 | |
| fi | |
| } | |
| # Skip `nimble develop -y` — nim.cfg's --noNimblePath + | |
| # explicit --path: directives mean nimble's package resolver is | |
| # not used. Going through develop would only add a dep-resolution | |
| # round trip that fails until debra 0.3.0 publishes. | |
| echo "::group::Run test suite (includes arc, orc, refc, lock-free enforcement)" | |
| nimble_run nimble test | |
| echo "::endgroup::" | |
| echo "::group::Run examples" | |
| nimble_run nimble examples | |
| echo "::endgroup::" |