-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 2.35 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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