Avoid unnecessary rebuilding in CI #110
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: Haskell CI | |
on: | |
push: | |
branches: [develop, main, master] | |
pull_request: | |
branches: [develop, main, master] | |
workflow_dispatch: # For manual triggering | |
schedule: | |
- cron: "3 14 15 * *" # 14:03 on the 15th of every month (UTC) | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ghc: ['8.8.4', '8.10.7', '9.0.2', '9.2.8', '9.4.8', '9.6.4', '9.8.2'] | |
fail-fast: false | |
name: Build with GHC ${{ matrix.ghc }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-cabal | |
with: | |
path: ~/.cabal | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Haskell setup | |
uses: haskell-actions/setup@main | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
- name: Install native dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends libcurl4-openssl-dev | |
- name: Configure | |
run: | | |
cabal update | |
cabal configure --enable-tests --enable-benchmarks -f werror | |
- name: Build dependencies | |
run: cabal build --only-dependencies | |
- name: Build | |
run: cabal build all | |
- name: Run tests | |
run: cabal test all |