♻️ Export code related to SomeTerm #1240
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: nix, | |
arg: "", | |
ismain: false, | |
experimental: false, | |
ghc: "8107", | |
cachekey: "nix-8107", | |
} | |
- { | |
build: stack, | |
arg: "--stack-yaml stack-lts-18.28-lowerbound.yaml", | |
ismain: false, | |
experimental: false, | |
ghc: "8107", | |
cachekey: "stack-8107-lowerbound", | |
} | |
- { | |
build: nix, | |
arg: "", | |
ismain: false, | |
experimental: false, | |
ghc: "902", | |
cachekey: "nix-902", | |
} | |
- { | |
build: nix, | |
arg: "", | |
ismain: false, | |
experimental: false, | |
ghc: "928", | |
cachekey: "nix-928", | |
} | |
- { | |
build: nix, | |
arg: "", | |
ismain: false, | |
experimental: false, | |
ghc: "948", | |
cachekey: "nix-948", | |
} | |
- { | |
build: nix, | |
arg: "", | |
ismain: false, | |
experimental: false, | |
ghc: "966", | |
cachekey: "nix-966", | |
} | |
- { | |
build: nix, | |
arg: "", | |
ismain: false, | |
experimental: false, | |
ghc: "984", | |
cachekey: "nix-984", | |
} | |
- { | |
build: nix, | |
arg: "", | |
ismain: true, | |
experimental: false, | |
ghc: "9101", | |
cachekey: "nix-9101", | |
} | |
- { | |
build: cabal, | |
arg: "", | |
ismain: false, | |
experimental: false, | |
ghc: "9121", | |
cachekey: "cabal-9121", | |
} | |
include: | |
- os: macOS-latest | |
plan: | |
{ | |
build: nix, | |
arg: "", | |
ismain: true, | |
experimental: false, | |
ghc: "9101", | |
cachekey: "nix-9101", | |
} | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.plan.experimental }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v30 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v15 | |
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@v4 | |
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 }} --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" | |
;; | |
nix) | |
NIX_DEBUG=7 nix build --show-trace -L .#grisette.${{ matrix.plan.ghc }}-ci | |
;; | |
cabal) | |
nix develop .#${{ matrix.plan.ghc }} --allow-dirty --no-warn-dirty -c cabal update | |
nix develop .#${{ matrix.plan.ghc }} --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@v15 | |
with: | |
name: Tests-${{ matrix.os }}-${{ matrix.plan.build }}-${{ matrix.plan.ghc }} | |
path: "**/test-report.xml" | |
reporter: java-junit | |
list-tests: 'failed' | |
if: matrix.os == 'ubuntu-latest' && (success() || failure ()) | |
- name: Info for coverage | |
id: coverage_info | |
run: | | |
echo "tix=$(find result/tix -name '*.tix')" >> $GITHUB_OUTPUT | |
ln -s result/dist dist | |
if: matrix.os == 'ubuntu-latest' && matrix.plan.ismain | |
- name: Generate coverage report | |
uses: 8c6794b6/hpc-codecov-action@v4 | |
with: | |
target: ${{ steps.coverage_info.outputs.tix }} | |
mix: result/mix | |
if: matrix.os == 'ubuntu-latest' && matrix.plan.ismain | |
- name: Send coverage report | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
if: matrix.os == 'ubuntu-latest' && matrix.plan.ismain | |
- name: Deploy haddock | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./result/haddock/html/grisette | |
if: matrix.os == 'ubuntu-latest' && matrix.plan.ismain && github.ref == 'refs/heads/main' |