Add derivation for cereal and binary #1179
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
# Based on https://gist.github.com/mstksg/11f753d891cee5980326a8ea8c865233 | |
name: Haskell Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- "releases/*" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
plan: | |
- { | |
build: stack, | |
arg: "--stack-yaml stack-lts-18.28.yaml", | |
ismain: false, | |
experimental: false, | |
ghc: "8107", | |
cachekey: "stack-810", | |
} | |
- { | |
build: stack, | |
arg: "--stack-yaml stack-lts-18.28-lowerbound.yaml", | |
ismain: false, | |
experimental: false, | |
ghc: "8107", | |
cachekey: "stack-810-l", | |
} | |
- { | |
build: stack, | |
arg: "--stack-yaml stack-lts-19.33.yaml", | |
ismain: false, | |
experimental: false, | |
ghc: "902", | |
cachekey: "stack-90", | |
} | |
- { | |
build: stack, | |
arg: "--stack-yaml stack-lts-20.26.yaml", | |
ismain: false, | |
experimental: false, | |
ghc: "928", | |
cachekey: "stack-92", | |
} | |
- { | |
build: stack, | |
arg: "--stack-yaml stack-lts-21.25.yaml", | |
ismain: false, | |
experimental: false, | |
ghc: "948", | |
cachekey: "stack-94", | |
} | |
- { | |
build: stack, | |
arg: "--stack-yaml stack-lts-22.43.yaml", | |
ismain: false, | |
experimental: false, | |
ghc: "966", | |
cachekey: "stack-96", | |
} | |
- { | |
build: stack, | |
arg: "--stack-yaml stack-lts-23.2.yaml", | |
ismain: false, | |
experimental: false, | |
ghc: "984", | |
cachekey: "stack-98", | |
} | |
- { | |
build: stack, | |
arg: "", | |
ismain: true, | |
experimental: false, | |
ghc: "9101", | |
cachekey: "stack-910", | |
} | |
- { | |
build: cabal, | |
arg: "", | |
ismain: false, | |
experimental: false, | |
ghc: "9121", | |
cachekey: "stack-912", | |
} | |
include: | |
- os: macOS-latest | |
plan: | |
{ | |
build: stack, | |
arg: "", | |
ismain: true, | |
experimental: false, | |
ghc: "9101-macOS", | |
cachekey: "stack-910-macOS", | |
} | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.plan.experimental }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v22 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: grisette-linux | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
- name: Cache key | |
id: cache_key | |
run: | | |
echo "stack=$(shasum stack.yaml | awk '{print $1}')" >> $GITHUB_OUTPUT | |
echo "package=$(shasum package.yaml | awk '{print $1}')" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.stack | |
~/.cabal | |
key: stack-${{ matrix.os }}-${{ matrix.plan.cachekey }}-${{ steps.cache_key.outputs.package }} | |
restore-keys: | | |
stack-${{ matrix.os }}-${{ matrix.plan.cachekey }} | |
stack-${{ matrix.os }} | |
- name: Build & Test | |
id: test | |
run: | | |
set -ex | |
export LC_ALL=en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
case "$BUILD" in | |
stack) | |
nix develop .#${{ matrix.plan.ghc }}-ci --allow-dirty --no-warn-dirty -c stack --no-terminal $ARGS test --fast --flag grisette:-optimize --bench --no-run-benchmarks --coverage --haddock --no-haddock-deps --test-arguments "--jxml=test-report.xml" | |
;; | |
cabal) | |
nix develop .#${{ matrix.plan.ghc }}-ci --allow-dirty --no-warn-dirty -c cabal update | |
nix develop .#${{ matrix.plan.ghc }}-ci --allow-dirty --no-warn-dirty -c cabal run --enable-tests --minimize-conflict-set --disable-optimization --flags=-optimize spec $ARGS -- --jxml=test-report.xml | |
;; | |
esac | |
set +ex | |
env: | |
ARGS: ${{ matrix.plan.arg }} | |
BUILD: ${{ matrix.plan.build }} | |
- uses: phoenix-actions/test-reporting@v8 | |
with: | |
name: Tests-${{ matrix.os }}-${{ matrix.plan.build }}-${{ matrix.plan.ghc }} | |
path: "**/test-report.xml" | |
reporter: java-junit | |
if: matrix.os == 'ubuntu-latest' && (success() || failure ()) | |
- name: Generate coverage report | |
uses: 8c6794b6/hpc-codecov-action@v2 | |
with: | |
target: stack:all | |
if: matrix.os == 'ubuntu-latest' && matrix.plan.ismain | |
- name: Send coverage report | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
if: matrix.os == 'ubuntu-latest' && matrix.plan.ismain |