CI #143
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: | |
# Build every pull request, to check for regressions. | |
pull_request: | |
types: [opened, synchronize] | |
# Build when a PR is merged, to update the README's CI badge. | |
push: | |
branches: [main] | |
# Build once a month, to detect missing upper bounds. | |
schedule: | |
- cron: '0 0 1 * *' | |
jobs: | |
# Check that the build passes with stack on all the provided snapshots, and | |
# thus all the supported ghc versions. | |
stack: | |
name: ${{ matrix.stack_yaml }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
stack_yaml: | |
- stack-8.6.5.yaml | |
- stack-8.8.4.yaml | |
- stack-8.10.7.yaml | |
- stack-9.0.2.yaml | |
- stack-9.2.7.yaml | |
- stack-9.4.5.yaml | |
- stack-9.6.1.yaml | |
os: | |
- ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
name: Cache Stack Artifacts | |
with: | |
path: | | |
~/.stack | |
.stack-work | |
key: ${{ runner.os }}-stack-${{ hashFiles(matrix.stack_yaml) }} | |
- uses: haskell-actions/setup@v2 | |
id: setup-haskell-stack | |
name: Setup Stack | |
with: | |
enable-stack: true | |
stack-setup-ghc: true | |
stack-no-global: true | |
- name: Build | |
run: | | |
stack --stack-yaml=${{ matrix.stack_yaml }} install --test --bench --no-run-tests --no-run-benchmarks | |
- name: Test | |
run: | | |
stack --stack-yaml=${{ matrix.stack_yaml }} test | |
- name: Double-check the example file | |
run: | | |
stack --stack-yaml=${{ matrix.stack_yaml }} exec -- runghc examples/example.hs | diff examples/expected.txt - | |
# Check that the build passes with cabal with the latest version of our | |
# dependencies. | |
cabal: | |
name: newest | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- ghc-version: '9.8.1' | |
os: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: haskell-actions/setup@v2 | |
id: setup-haskell-cabal | |
name: Setup Cabal | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
# This freeze file is regenerated on every build, so we will always test | |
# with the most recent version of our dependencies allowed by our upper | |
# bounds. | |
- name: Freeze | |
run: | | |
cabal v2-configure --enable-tests --enable-benchmarks --test-show-details=direct | |
cabal freeze | |
# Only reuse the cached copy of our dependencies if our freeze file matches | |
# the cache's copy. | |
- uses: actions/cache@v2 | |
name: Cache Cabal Artifacts | |
with: | |
path: | | |
${{ steps.setup-haskell-cabal.outputs.cabal-store }} | |
key: ${{ runner.os }}-cabal-v2-${{ hashFiles('cabal.project.freeze') }} | |
- name: Build | |
run: | | |
cabal v2-build --enable-tests | |
- name: Test | |
run: | | |
cabal v2-test | |
- name: Double-check the example file | |
run: | | |
cabal v2-exec -- runghc examples/example.hs | diff examples/expected.txt - |