Skip to content

[refactor] Common-up in checkBody (#57) #139

[refactor] Common-up in checkBody (#57)

[refactor] Common-up in checkBody (#57) #139

Workflow file for this run

name: Brat CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
GHC_VERSION: 9.6.4
CABAL_VERSION: 3.4
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: brat/
steps:
- uses: actions/checkout@v4
# From: https://raehik.github.io/2021/03/01/caching-stack-and-cabal-haskell-builds-on-github-actions.html
- name: cache
uses: actions/cache@v4
with:
path: |
~/.stack
.stack-work
*/.stack-work
~/.cargo
# From: https://github.com/commercialhaskell/stack/issues/5754#issuecomment-1696156869
~/.ghcup/bin/*
~/.ghcup/cache/*
~/.ghcup/config.yaml
~/.ghcup/ghc/${{ env.GHC_VERSION }}
# 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'
)}}-GHC-${{ env.GHC_VERSION }}
save-always: true
- uses: haskell-actions/setup@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
ghc-version: ${{ env.GHC_VERSION }}
cabal-version: ${{ env.CABAL_VERSION }}
enable-stack: 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