ci #213
Workflow file for this run
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 | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
cabal: | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc: | |
- vers: "9.10.1" | |
proj_file: "--project-file cabal.ghc9101.project" | |
- vers: "9.12.1" | |
proj_file: "" | |
os: | |
- "macos-latest" | |
- "ubuntu-latest" | |
- "windows-latest" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup haskell | |
uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc.vers }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 23.x | |
- name: Configure | |
run: cabal configure ${{ matrix.ghc.proj_file }} --enable-tests --ghc-options -Werror | |
- name: Build | |
run: cabal build ${{ matrix.ghc.proj_file }} exe:pacer | |
- name: Unit tests | |
id: unit | |
run: cabal test ${{ matrix.ghc.proj_file }} pacer:unit --test-options '--hedgehog-tests 1000000 --size-cutoff 100000' | |
- name: Functional tests | |
id: functional | |
run: cabal test ${{ matrix.ghc.proj_file }} pacer:functional --test-options '--size-cutoff 100000' | |
- name: Generate charts html/hs | |
# TODO: [Testing html] | |
# | |
# It would be nice if we could test that the html page actually | |
# does what we want because it is possible for webpack to succeed yet | |
# the page is broken. | |
# | |
# It may be possible to require 0 console errors, though of course that | |
# could be overly restrictive. | |
run: | | |
cabal run pacer ${{ matrix.ghc.proj_file }} -- chart --data examples | |
# Let's test it overwrites successfully | |
cabal run pacer ${{ matrix.ghc.proj_file }} -- chart --data examples | |
- name: Benchmarks | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
id: bench | |
run: | | |
cabal bench ${{ matrix.ghc.proj_file }} --benchmark-options ' | |
+RTS -T -RTS | |
-t100 | |
--csv bench/${{ matrix.os }}_${{ matrix.ghc.vers }}_ci.csv | |
--svg bench/${{ matrix.os }}_${{ matrix.ghc.vers }}_ci.svg | |
--baseline bench/baseline_${{ matrix.os }}_${{ matrix.ghc.vers }}_ci.csv | |
--fail-if-slower 20 | |
--fail-if-faster 20' | |
- uses: actions/upload-artifact@v4 | |
name: Bench upload | |
if: ${{ failure() && steps.bench.conclusion == 'failure' }} | |
with: | |
name: bench_artifacts_${{ matrix.os }}_${{ matrix.ghc.vers }} | |
path: | | |
bench/${{ matrix.os }}_${{ matrix.ghc.vers }}_ci.csv | |
bench/${{ matrix.os }}_${{ matrix.ghc.vers }}_ci.svg | |
stack: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- "macos-latest" | |
- "ubuntu-latest" | |
- "windows-latest" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup haskell | |
uses: haskell-actions/setup@v2 | |
with: | |
enable-stack: true | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 23.x | |
- name: Build | |
run: stack build --ghc-options -Werror | |
- name: Unit tests | |
id: unit | |
run: stack test pacer:test:unit --ghc-options -Werror --test-arguments '--hedgehog-tests 1000000' | |
- name: Functional tests | |
id: functional | |
run: stack test pacer:test:functional --ghc-options -Werror | |
- name: Generate charts html/hs | |
# See TODO: [Testing html] | |
run: | | |
stack run pacer -- chart --data examples | |
# Let's test it overwrites successfully | |
stack run pacer -- chart --data examples | |
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@v30 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Compile & run tests | |
run: nix build -L | |
# Enter dev shell w/o npm. | |
- name: Test executable | |
run: nix develop --unset PATH .#ci -c bash -c ".github/scripts/nix_test.sh" | |
lint: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup nix | |
uses: cachix/install-nix-action@v30 | |
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 | |
# TODO: Re-enable once hlint is working with ghc 9.10. | |
# | |
# Don't usually want this in CI, but we have this here to test that | |
# it actually runs. | |
# - name: Refactor | |
# run: nix run .#lint-refactor |