Skip to content

Commit

Permalink
➖ Migrate to test-framework
Browse files Browse the repository at this point in the history
  • Loading branch information
lsrcz committed Sep 28, 2023
1 parent 40e9032 commit 4a36ab9
Show file tree
Hide file tree
Showing 28 changed files with 316 additions and 306 deletions.
242 changes: 159 additions & 83 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,105 +7,181 @@ on:
push:
branches:
- main
- 'releases/*'
- "releases/*"

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
plan:
- { build: stack, arg: "--stack-yaml stack-lts-18.28.yaml", ismain: false, experimental: false, ghc: "8107", cachekey: "stack-18.28" }
- { build: stack, arg: "--stack-yaml stack-lts-18.28-lowerbound.yaml", ismain: false, experimental: false, ghc: "8107", cachekey: "stack-18.28-l" }
- { build: stack, arg: "--stack-yaml stack-lts-19.33.yaml", ismain: false, experimental: false, ghc: "902", cachekey: "stack-19.33" }
- { build: stack, arg: "--stack-yaml stack-lts-20.26.yaml", ismain: false, experimental: false, ghc: "928", cachekey: "stack-20.26" }
- { build: stack, arg: "", ismain: true, experimental: false, ghc: "946", cachekey: "stack-21.11" }
- { build: stack, arg: "--stack-yaml stack-nightly.yaml --resolver nightly", ismain: false, experimental: false, ghc: "962", cachekey: "stack-nightly" }
- { build: cabal, arg: "--constraint=sbv<10", ismain: false, experimental: false, ghc: "8107", cachekey: "cabal-8107" }
- { build: cabal, arg: "--constraint=sbv<10", ismain: false, experimental: false, ghc: "902", cachekey: "cabal-902" }
- { build: cabal, arg: "", ismain: false, experimental: false, ghc: "928", cachekey: "cabal-928" }
- { build: cabal, arg: "--allow-newer=text", ismain: false, experimental: false, ghc: "946", cachekey: "cabal-946" }
- { build: cabal, arg: "--allow-newer=text,mtl", ismain: false, experimental: false, ghc: "962", cachekey: "cabal-962" }

- {
build: stack,
arg: "--stack-yaml stack-lts-18.28.yaml",
ismain: false,
experimental: false,
ghc: "8107",
cachekey: "stack-18.28",
}
- {
build: stack,
arg: "--stack-yaml stack-lts-18.28-lowerbound.yaml",
ismain: false,
experimental: false,
ghc: "8107",
cachekey: "stack-18.28-l",
}
- {
build: stack,
arg: "--stack-yaml stack-lts-19.33.yaml",
ismain: false,
experimental: false,
ghc: "902",
cachekey: "stack-19.33",
}
- {
build: stack,
arg: "--stack-yaml stack-lts-20.26.yaml",
ismain: false,
experimental: false,
ghc: "928",
cachekey: "stack-20.26",
}
- {
build: stack,
arg: "",
ismain: true,
experimental: false,
ghc: "946",
cachekey: "stack-21.11",
}
- {
build: stack,
arg: "--stack-yaml stack-nightly.yaml --resolver nightly",
ismain: false,
experimental: false,
ghc: "962",
cachekey: "stack-nightly",
}
- {
build: cabal,
arg: "--constraint=sbv<10",
ismain: false,
experimental: false,
ghc: "8107",
cachekey: "cabal-8107",
}
- {
build: cabal,
arg: "--constraint=sbv<10",
ismain: false,
experimental: false,
ghc: "902",
cachekey: "cabal-902",
}
- {
build: cabal,
arg: "",
ismain: false,
experimental: false,
ghc: "928",
cachekey: "cabal-928",
}
- {
build: cabal,
arg: "--allow-newer=text",
ismain: false,
experimental: false,
ghc: "946",
cachekey: "cabal-946",
}
- {
build: cabal,
arg: "--allow-newer=text,mtl",
ismain: false,
experimental: false,
ghc: "962",
cachekey: "cabal-962",
}

runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.plan.experimental }}
steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v3

- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- 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 }}'
- 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 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.\"ghc902\"/pkgs.haskell.packages.\"ghc${{ matrix.plan.ghc }}\"/" flake.nix
;;
ubuntu-latest)
sed -i "s/pkgs.haskell.packages.\"ghc902\"/pkgs.haskell.packages.\"ghc${{ matrix.plan.ghc }}\"/" flake.nix
;;
esac
- 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.\"ghc902\"/pkgs.haskell.packages.\"ghc${{ matrix.plan.ghc }}\"/" flake.nix
;;
ubuntu-latest)
sed -i "s/pkgs.haskell.packages.\"ghc902\"/pkgs.haskell.packages.\"ghc${{ matrix.plan.ghc }}\"/" flake.nix
;;
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: 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 --bench --no-run-benchmarks --coverage --haddock --no-haddock-deps --test-arguments "--xml=test-report.xml"
;;
cabal)
nix develop --allow-dirty --no-warn-dirty -c cabal update
nix develop --allow-dirty --no-warn-dirty -c cabal run spec $ARGS -- --xml=test-report.xml
;;
esac
set +ex
env:
ARGS: ${{ matrix.plan.arg }}
BUILD: ${{ matrix.plan.build }}
- 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 --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 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 ())
- 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: 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
- name: Send coverage report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: matrix.os == 'ubuntu-latest' && matrix.plan.ismain
10 changes: 5 additions & 5 deletions grisette.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ test-suite spec
test
ghc-options: -Wextra -Werror -Wcompat -Widentities -Wincomplete-record-updates -Wmissing-export-lists -Wmissing-home-modules -Wmissing-import-lists -Wpartial-fields -Wunused-type-patterns
build-depends:
QuickCheck >=2.13.2 && <2.15
HUnit ==1.6.*
, QuickCheck >=2.13.2 && <2.15
, array >=0.5.4 && <0.6
, base >=4.14 && <5
, bytestring >=0.10.12 && <0.12
Expand All @@ -230,11 +231,10 @@ test-suite spec
, parallel >=3.2.2.0 && <3.3
, prettyprinter >=1.5.0 && <1.8
, sbv >=8.11 && <10.3
, tasty >=1.1.0.3 && <1.5
, tasty-hunit ==0.10.*
, tasty-quickcheck >=0.10.1 && <0.11
, tasty-test-reporter >=0.1.1.2 && <0.2
, template-haskell >=2.16 && <2.21
, test-framework >=0.8.2 && <0.9
, test-framework-hunit >=0.3.0.2 && <0.4
, test-framework-quickcheck2 >=0.3.0.5 && <0.4
, text >=1.2.4.1 && <2.1
, th-compat >=0.1.2 && <0.2
, transformers >=0.5.6 && <0.7
Expand Down
8 changes: 4 additions & 4 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ tests:
source-dirs: test
dependencies:
- grisette
- tasty >= 1.1.0.3 && < 1.5
- tasty-hunit >= 0.10 && < 0.11
- tasty-test-reporter >= 0.1.1.2 && < 0.2
- tasty-quickcheck >= 0.10.1 && < 0.11
- test-framework >= 0.8.2 && < 0.9
- test-framework-hunit >= 0.3.0.2 && < 0.4
- test-framework-quickcheck2 >= 0.3.0.5 && < 0.4
- HUnit >= 1.6 && < 1.7
doctest:
main: Main.hs
source-dirs: doctest
Expand Down
11 changes: 5 additions & 6 deletions stack-lts-18.28-lowerbound.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resolver:
# - auto-update
# - wai
packages:
- .
- .

# Dependency packages to be pulled from upstream that are not in the resolver.
# These entries can reference officially published versions as well as
Expand Down Expand Up @@ -61,16 +61,15 @@ extra-deps:
- splitmix-0.0.5
- vector-0.12.1.2
- sbv-8.11
- tasty-quickcheck-0.10.1
- tasty-hunit-0.10
- tasty-1.1.0.3
- tasty-test-reporter-0.1.1.2
- doctest-0.18.2
- call-stack-0.1.0
- parallel-3.2.2.0
- text-1.2.4.1
- prettyprinter-1.5.0

- test-framework-0.8.2.0
- test-framework-hunit-0.3.0.2
- test-framework-quickcheck2-0.3.0.5
- HUnit-1.6.0.0
# Override default flag values for local packages and extra-deps
# flags: {}

Expand Down
Loading

0 comments on commit 4a36ab9

Please sign in to comment.