Skip to content

Merge pull request #1266 from GaloisInc/T1024-crucible-syntax-exotic-… #835

Merge pull request #1266 from GaloisInc/T1024-crucible-syntax-exotic-…

Merge pull request #1266 from GaloisInc/T1024-crucible-syntax-exotic-… #835

name: crucible-go builds
on:
push:
branches: [master, "release-**"]
pull_request:
workflow_dispatch:
# 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).
#
# This also periodically happens on MacOS builds due to a tar bug
# (symptom: "No suitable image found ... unknown file type, first
# eight bytes: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00")
env:
CACHE_VERSION: 1
jobs:
build:
runs-on: ${{ matrix.os }}
env:
CI_TEST_LEVEL: "1"
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
cabal: ["3.10.3.0"]
ghc: ["9.4.8", "9.6.5", "9.8.2"]
include:
- os: macos-14
cabal: 3.10.3.0
ghc: 9.8.2
- os: windows-2019
cabal: 3.10.3.0
ghc: 9.8.2
name: crucible-go - GHC v${{ matrix.ghc }} - ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Post-GHC installation fixups on Windows
shell: bash
if: runner.os == 'Windows'
run: |
# A workaround for https://github.com/Mistuke/CabalChoco/issues/5
cabal user-config update -a "extra-include-dirs: \"\""
cabal user-config update -a "extra-lib-dirs: \"\""
- name: Install Nix
if: runner.os == 'Linux'
uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:21.11
install_url: https://releases.nixos.org/nix/nix-2.10.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache/restore@v4
name: Restore cabal store cache
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-${{ github.sha }}
restore-keys: |
${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-
- shell: bash
run: .github/ci.sh install_system_deps
env:
SOLVER_PKG_VERSION: "snapshot-20240212"
BUILD_TARGET_OS: ${{ matrix.os }}
BUILD_TARGET_ARCH: ${{ runner.arch }}
- name: Setup Environment Vars
if: runner.os == 'Linux'
run: |
GHC=haskell.compiler.ghc$(echo ${{ matrix.ghc }} | sed -e s,\\.,,g)
case ${{ matrix.ghc }} in
9.4.8) GHC_NIXPKGS=github:nixos/nixpkgs/nixos-24.05 ;;
9.6.5) GHC_NIXPKGS=github:nixos/nixpkgs/nixos-24.05 ;;
9.8.2) GHC_NIXPKGS=github:nixos/nixpkgs/nixos-24.05 ;;
*) GHC_NIXPKGS=github:nixos/nixpkgs/21.11 ;;
esac
echo NS="nix shell ${GHC_NIXPKGS}#cabal-install ${GHC_NIXPKGS}#${GHC} nixpkgs#gmp nixpkgs#zlib nixpkgs#zlib.dev" >> $GITHUB_ENV
- name: Package's Cabal/GHC compatibility
shell: bash
if: runner.os == 'Linux'
# Using setup will use the cabal library installed with GHC
# instead of the cabal library of the Cabal-install tool to
# verify the cabal file is compatible with the associated
# GHC cabal library version. Cannot run configure or build,
# because dependencies aren't present, but a clean is
# sufficient to cause parsing/validation of the cabal file.
run: |
defsetup() { echo import Distribution.Simple; echo main = defaultMain; }
setup_src() { if [ ! -f Setup.hs ] ; then defsetup > DefSetup.hs; fi; ls *Setup.hs; }
setup_bin() { echo setup.${{ matrix.ghc }}; }
with_ghc() { $NS -c ${@}; }
(cd crucible-go; with_ghc ghc -o $(setup_bin) $(setup_src) && ./$(setup_bin) clean)
- name: Configure
shell: bash
run: .github/ci.sh configure crux-go
- name: Generate source distribution
shell: bash
run: cabal sdist crucible-go
- name: Build
shell: bash
run: .github/ci.sh build exe:crux-go
- name: Haddock
shell: bash
run: cabal v2-haddock crucible-go
- uses: actions/cache/save@v4
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 }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-${{ github.sha }}