Files
2026-03-15 13:54:18 +01:00

83 lines
2.7 KiB
YAML

name: CI
on:
push:
branches: ["main"]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
phase8_target: linux-x64
- os: macos-14
phase8_target: darwin-arm64
- os: windows-latest
phase8_target: windows
runs-on: ${{ matrix.os }}
env:
USE_BAZEL_VERSION: 9.0.1
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.18.0
with:
bazelisk-cache: true
repository-cache: true
external-cache: true
disk-cache: ci-${{ matrix.phase8_target }}
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Install Nix
if: runner.os != 'Windows'
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: Restore and save Nix store cache
if: runner.os != 'Windows'
uses: nix-community/cache-nix-action@v7
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
- name: Install flake dependencies
if: runner.os != 'Windows'
run: nix develop --accept-flake-config -c true
- name: Set up Python
if: runner.os == 'Windows'
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Provide python3 shim
if: runner.os == 'Windows'
shell: bash
run: |
mkdir -p "$RUNNER_TEMP/bin"
cat >"$RUNNER_TEMP/bin/python3" <<'EOF'
#!/usr/bin/env bash
exec python "$@"
EOF
chmod +x "$RUNNER_TEMP/bin/python3"
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: Run tests (${{ matrix.phase8_target }})
if: runner.os != 'Windows'
shell: bash
run: |
echo "Phase 8 target: ${{ matrix.phase8_target }}"
mapfile -t targets < <(./tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}")
nix develop --accept-flake-config -c bazel test --test_output=errors "${targets[@]}"
- name: Run tests (${{ matrix.phase8_target }})
if: runner.os == 'Windows'
shell: bash
run: |
echo "Phase 8 target: ${{ matrix.phase8_target }}"
mapfile -t targets < <(./tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}")
bazel test --test_output=errors "${targets[@]}"