CI #764
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 | |
# Trigger the workflow on push or pull request, but only for the master branch | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
schedule: | |
- cron: '0 8 * * 3' | |
jobs: | |
stack: | |
name: ${{ matrix.os }} / ${{ matrix.snapshot }} | |
runs-on: ${{ matrix.os }}-latest | |
continue-on-error: ${{ matrix.snapshot == 'nightly' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu | |
- macOS | |
- windows | |
snapshot: | |
- 'lts-12.11' | |
- 'lts-14.18' | |
- 'lts-16.12' | |
- 'lts-18.28' | |
- 'lts-19.33' | |
- 'lts-20.26' | |
- 'lts-21.25' | |
- 'lts-22.18' | |
- 'nightly' | |
exclude: | |
# github actions runs with arm for macos | |
# | |
# older versions of ghc support arm through llvm and the version that | |
# the machine uses is not compatible with ghc. | |
# | |
# So we exclude those builds | |
- snapshot: 'lts-12.11' | |
os: macOS | |
- snapshot: 'lts-14.18' | |
os: macOS | |
- snapshot: 'lts-16.12' | |
os: macOS | |
- snapshot: 'lts-18.28' | |
os: macOS | |
- snapshot: 'lts-19.33' | |
os: macOS | |
steps: | |
- uses: actions/checkout@main | |
- uses: haskell-actions/setup@main | |
name: Setup Haskell Stack | |
id: setuphaskell | |
with: | |
enable-stack: true | |
stack-no-global: true | |
- uses: actions/cache/restore@v4 | |
name: Cache stack files | |
with: | |
path: ${{ steps.setuphaskell.outputs.stack-root }} | |
key: ${{ runner.os }}-${{ matrix.snapshot }}-stack2 | |
- name: Setup stack.yaml | |
shell: bash | |
run: | | |
set -x | |
mv -vf "stack-ci.yaml" ./stack.yaml || true | |
mv -vf "stack-${{ matrix.snapshot }}.yaml" ./stack.yaml || true | |
mv -vf "stack-${{ matrix.snapshot }}-${{ matrix.os }}.yaml" ./stack.yaml || true | |
- name: Build and test | |
shell: bash | |
run: | | |
set -x | |
grep . stack.yaml | |
if grep SKIP stack.yaml; then | |
echo Skipped because that snapshot is broken | |
exit 0 | |
fi | |
stack setup --resolver=${{ matrix.snapshot }} | |
echo "stack_root: ${{ steps.setuphaskell.outputs.stack-root }}" | |
stack --version | |
stack --resolver=${{ matrix.snapshot }} ghc -- --version | |
# we first build everything without running the tests (with unlimited parallelism) | |
stack build --resolver=${{ matrix.snapshot }} --ghc-options=-Werror --test --bench --no-run-tests | |
# once that's done we run the tests in a single threaded fashion to avoid | |
# https://github.com/commercialhaskell/stack/issues/5024#issuecomment-845001389 | |
stack build --resolver=${{ matrix.snapshot }} --ghc-options=-Werror --test --bench -j 1 | |
- uses: actions/cache/save@v4 | |
if: always() | |
with: | |
path: ${{ steps.setuphaskell.outputs.stack-root }} | |
key: ${{ runner.os }}-${{ matrix.snapshot }}-stack2 |