Minor test style improvements #391
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
--- | |
name: ci | |
on: # yamllint disable-line rule:truthy rule:comments | |
push: | |
branches: | |
- main | |
- release | |
pull_request: | |
branches: | |
- main | |
- release | |
workflow_dispatch: | |
jobs: | |
cabal: | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc: | |
- vers: "9.6.5" | |
proj-file: "" | |
- vers: "9.8.2" | |
proj-file: "--project-file cabal.ghc982.project" | |
- vers: "9.10.1" | |
proj-file: "" | |
os: | |
- "macos-latest" | |
- "ubuntu-latest" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc.vers }} | |
- name: Configure | |
run: | | |
cabal configure \ | |
${{ matrix.ghc.proj-file }} \ | |
--enable-tests \ | |
--ghc-options -Werror | |
- name: Compile | |
run: cabal build ${{ matrix.ghc.proj-file }} lib:shrun | |
- name: Unit Tests | |
run: | | |
cabal test ${{ matrix.ghc.proj-file }} unit \ | |
--test-options '--hedgehog-tests 100000' | |
- name: Integration Tests | |
run: cabal test ${{ matrix.ghc.proj-file }} integration | |
- name: Functional Tests | |
run: | | |
cabal test ${{ matrix.ghc.proj-file }} functional \ | |
--test-options '--read-strategy all' | |
- name: Benchmarks | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
id: bench | |
# yamllint disable rule:line-length | |
run: | | |
cabal bench ${{ matrix.ghc.proj-file }} --benchmark-options ' | |
+RTS -T -RTS | |
--csv benchmarks/${{ matrix.os }}_${{ matrix.ghc.vers }}_ci.csv | |
--svg benchmarks/${{ matrix.os }}_${{ matrix.ghc.vers }}_ci.svg | |
--baseline benchmarks/baseline_${{ matrix.os }}_${{ matrix.ghc.vers }}_ci.csv | |
--fail-if-slower 50 | |
--fail-if-faster 50' | |
# yamllint enable | |
- uses: actions/upload-artifact@v3 | |
if: ${{ failure() && steps.bench.conclusion == 'failure' }} | |
with: | |
name: build-artifacts | |
path: | | |
benchmarks/${{ matrix.os }}_${{ matrix.ghc.vers }}_ci.csv | |
benchmarks/${{ matrix.os }}_${{ matrix.ghc.vers }}_ci.svg | |
stack: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- os: "macos-latest" | |
flaky: false | |
- os: "ubuntu-latest" | |
flaky: true | |
runs-on: ${{ matrix.platform.os }} | |
# The ubuntu runner has inexplicably started refusing to run on CI... | |
continue-on-error: ${{ matrix.platform.flaky }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: haskell-actions/setup@v2 | |
with: | |
enable-stack: true | |
- name: Compile | |
run: stack build --ghc-options -Werror | |
- name: Test | |
run: stack test --ghc-options -Werror | |
nix: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- "macos-latest" | |
- "ubuntu-latest" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup nix | |
uses: cachix/install-nix-action@v25 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Compile & Test | |
run: nix build -L | |
# Unfortunately, notify-tests does not seem to work for linux on CI. | |
# Leaving it for osx as that provides some value, and at least we can | |
# test linux notifications manually. | |
notify-tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- "macos-latest" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup nix | |
uses: cachix/install-nix-action@v25 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Test | |
run: | | |
nix develop .#notifyTests -L \ | |
-c bash -c '.github/scripts/notify_tests.sh' | |
lint: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup nix | |
uses: cachix/install-nix-action@v25 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Formatting | |
run: | | |
nix run .#format | |
git diff --exit-code --color=always | |
- name: Lint | |
run: | | |
nix run .#lint | |
release_osx: | |
needs: [cabal, stack, nix, notify-tests, lint] | |
if: github.ref == 'refs/heads/release' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- "macos-12" | |
- "macos-13" | |
- "macos-14" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: "9.8.2" | |
cabal-version: "3.12" | |
- name: Install binary | |
run: | | |
.github/scripts/release_osx.sh | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts-${{ matrix.os }} | |
path: bin | |
release_linux_static: | |
needs: [cabal, stack, nix, notify-tests, lint] | |
if: github.ref == 'refs/heads/release' | |
strategy: | |
fail-fast: false | |
matrix: | |
dir: | |
- "alpine_amd64" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker-practice/actions-setup-docker@master | |
- name: Install binary | |
run: | | |
.github/scripts/release_linux_static.sh ${{ matrix.dir }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts-${{ matrix.dir }} | |
path: bin | |
release_linux: | |
needs: [cabal, stack, nix, notify-tests, lint] | |
if: github.ref == 'refs/heads/release' | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: "9.8.2" | |
cabal-version: "3.12" | |
- name: Install binary | |
run: | | |
.github/scripts/release_linux.sh | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts-ubuntu-latest | |
path: bin | |
merge: | |
runs-on: "ubuntu-latest" | |
needs: [release_osx, release_linux, release_linux_static] | |
steps: | |
- name: Merge Artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: build-artifacts | |
pattern: build-artifacts-* | |
delete-merged: true |