Merge pull request #255 from GaloisInc/dgb_1695768249-0 #248
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |