-
Notifications
You must be signed in to change notification settings - Fork 7
85 lines (74 loc) · 2.97 KB
/
build.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
81
82
83
84
85
name: build
on:
workflow_dispatch:
push:
branches: [master, "release-**"]
pull_request:
env:
# The CACHE_VERSION can be updated to force the use of a new cache if
# the current cache contents become corrupted/invalid. This can
# sometimes happen when (for example) the OS version is changed but
# older .so files are cached, which can have various effects
# (e.g. cabal complains it can't find a valid version of the "happy"
# tool).
CACHE_VERSION: 1
LLVM_VERSION: 12
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04]
# See doc/developing.md
ghc: ["9.2.8", "9.4.5", "9.6.2"]
name: build - ${{ matrix.ghc }} - ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install LLVM (for running tests)
run: |
sudo apt-get -y install llvm-${{ env.LLVM_VERSION }} clang-${{ env.LLVM_VERSION }}
# Inspired by https://gist.github.com/junkdog/70231d6953592cd6f27def59fe19e50d
sudo update-alternatives \
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${{ env.LLVM_VERSION }} 100 \
--slave /usr/bin/llvm-as llvm-as /usr/bin/llvm-as-${{ env.LLVM_VERSION }} \
--slave /usr/bin/llvm-dis llvm-dis /usr/bin/llvm-dis-${{ env.LLVM_VERSION }} \
--slave /usr/bin/llvm-link llvm-link /usr/bin/llvm-link-${{ env.LLVM_VERSION }}
# Also run --set, just in case
sudo update-alternatives --set llvm-config /usr/bin/llvm-config-${{ env.LLVM_VERSION }}
# List the installed version as a sanity check
update-alternatives --list llvm-config
- uses: haskell/actions/setup@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
- uses: actions/cache/restore@v3
name: Restore cabal store cache
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.sha }}
restore-keys: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-
- name: Configure
run: cabal configure --enable-tests -j2 -ffuzz -fregressions
- name: Build
run: cabal build --enable-tests
- name: Test
run: |
cabal run unit-test
cabal run disasm-test -- --with-clang /usr/bin/clang-${{ env.LLVM_VERSION }}
- name: Cabal file check
run: cabal check
- name: Haddock
run: cabal haddock
- uses: actions/cache/save@v3
name: Save cabal store cache
if: always()
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.sha }}