Skip to content

Add Grisette.Unified #795

Add Grisette.Unified

Add Grisette.Unified #795

Workflow file for this run

# 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: "",
ismain: true,
experimental: false,
ghc: "965",
cachekey: "stack-96",
}
- {
build: stack,
arg: "--stack-yaml stack-nightly.yaml",
ismain: false,
experimental: false,
ghc: "982",
cachekey: "stack-98",
}
- {
build: cabal,
arg: "",
ismain: false,
experimental: false,
ghc: "9101",
cachekey: "cabal-910",
}
include:
- os: macOS-latest
plan:
{
build: stack,
arg: "",
ismain: true,
experimental: false,
ghc: "965",
cachekey: "stack-96",
}
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: Use minimal flake
run: |
cp .github/workflows/flake-ci.nix flake.nix
case ${{ matrix.os }} in
macOS-latest)
sed -i '' "s/pkgs.haskell.packages.\"xxx\"/pkgs.haskell.packages.\"ghc${{ matrix.plan.ghc }}\"/" flake.nix
case ${{ matrix.plan.build }} in
stack)
sed -i '' "s/stableHPkgs.cabal-install//" flake.nix
;;
esac
;;
ubuntu-latest)
sed -i "s/pkgs.haskell.packages.\"xxx\"/pkgs.haskell.packages.\"ghc${{ matrix.plan.ghc }}\"/" flake.nix
case ${{ matrix.plan.build }} in
stack)
sed -i "s/stableHPkgs.cabal-install//" flake.nix
;;
esac
;;
esac
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: |
~/.stack
~/.cabal
dist-newstyle
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
case "$BUILD" in
stack)
nix develop --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 --allow-dirty --no-warn-dirty -c cabal update
nix develop --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