Skip to content

[chore] Use hugr_validator from the cache in CI (#421) #7

[chore] Use hugr_validator from the cache in CI (#421)

[chore] Use hugr_validator from the cache in CI (#421) #7

Workflow file for this run

name: Brat CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: brat/
steps:
- uses: actions/checkout@v4
- uses: haskell/actions/setup@v1
with:
ghc-version: '9.6.4'
cabal-version: '3.4'
enable-stack: true
# from: https://raehik.github.io/2021/03/01/caching-stack-and-cabal-haskell-builds-on-github-actions.html
- uses: actions/cache@v4
with:
path: |
~/.stack
.stack-work
~/.cargo
# best effort for cache: tie it to Stack resolver and package config
key: ${{ runner.os }}-stack-${{ hashFiles('brat/stack.yaml',
'hugr_validator/Cargo.toml',
'hugr_extension/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-stack
save-always: true
- name: Install dependencies
run: stack build --only-dependencies
- name: Build
run: stack build --ghc-options "-O0"
- name: Build stack tests
run: stack test --no-run-tests --no-run-benchmarks --ghc-options "-O0"
- name: Run stack tests
run: stack test --ta --hide-successes
# Validate the hugr outputs
- name: Check for hugr_validator
id: cached_validator
run: |
if [ -f ~/.cargo/bin/hugr_validator ]; then
echo "out=true" >> $GITHUB_OUTPUT
else
echo "We need to build hugr_validator"
echo "out=false" >> $GITHUB_OUTPUT
fi
- name: Install rust
if: ${{ steps.cached_validator.outputs.out != 'true' }}
uses: dtolnay/rust-toolchain@stable
- name: Install hugr_validator
if: ${{ steps.cached_validator.outputs.out != 'true' }}
run: cargo install --path ../hugr_validator
- name: Validate compilation output
run: tools/validate.sh