Skip to content

ci

ci #89

Workflow file for this run

---
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:
- "9.10.1"
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 }}
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 23.x
- name: Configure
run: cabal configure --enable-tests --ghc-options -Werror
- name: Build
run: cabal build exe:pacer
- name: Unit tests
id: unit
run: cabal test pacer:unit --test-options '--hedgehog-tests 1000000'
- uses: actions/upload-artifact@v3
name: Unit tests upload
if: ${{ failure() && steps.unit.conclusion == 'failure' }}
with:
name: cabal-unit-tests-artifacts
path: |
test/unit/goldens
- name: Functional tests
id: functional
run: cabal test pacer:functional
- uses: actions/upload-artifact@v3
name: Functional tests upload
if: ${{ failure() && steps.functional.conclusion == 'failure' }}
with:
name: cabal-functional-tests-artifacts
path: |
test/functional/goldens
- name: Generate charts html/hs
# TODO: 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 -- chart --data examples
# Let's test it overwrites successfully
cabal run pacer -- chart --data examples
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: Compile
run: stack build --ghc-options -Werror
- name: Test
run: stack test --ghc-options -Werror
- name: Build
run: stack build exe:pacer --ghc-options -Werror
# yamllint disable rule:line-length
- name: Unit tests
id: unit
run: stack test pacer:unit --ghc-options -Werror --test-arguments '--hedgehog-tests 1000000'
# yamllint enable
- uses: actions/upload-artifact@v3
name: Unit tests upload
if: ${{ failure() && steps.unit.conclusion == 'failure' }}
with:
name: stack-unit-tests-artifacts
path: |
test/unit/goldens
- name: Functional tests
id: functional
run: stack test pacer:functional --ghc-options -Werror
- uses: actions/upload-artifact@v3
name: Functional tests upload
if: ${{ failure() && steps.functional.conclusion == 'failure' }}
with:
name: stack-functional-tests-artifacts
path: |
test/functional/goldens
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
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: HLint
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