-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new workflow with automatic GHC matrix generation
- Loading branch information
1 parent
0311a30
commit 86eba78
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
|
||
concurrency: | ||
group: build-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
generate-ghc-matrix: | ||
name: "Generate GHC matrix from .cabal file" | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Extract the tested-with GHC versions | ||
id: set-matrix | ||
uses: kleidukos/[email protected] | ||
with: | ||
cabal-file: cassava-megaparsec.cabal | ||
ubuntu: true | ||
version: 0.1.6.0 | ||
|
||
build: | ||
name: GHC ${{ matrix.ghc }} on ${{ matrix.os }} | ||
needs: generate-ghc-matrix | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: ${{ fromJSON(needs.generate-ghc-matrix.outputs.matrix) }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Haskell tools | ||
uses: haskell-actions/setup@v2 | ||
id: setup | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
cabal-version: 'latest' | ||
cabal-update: true | ||
- name: Configure the build | ||
run: | | ||
cabal configure --enable-tests --disable-documentation | ||
cabal build all --dry-run | ||
- name: Restore cached dependencies | ||
uses: actions/cache/restore@v4 | ||
id: cache | ||
env: | ||
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} | ||
with: | ||
path: ${{ steps.setup.outputs.cabal-store }} | ||
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} | ||
restore-keys: ${{ env.key }}- | ||
- name: Install dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: cabal build all --only-dependencies | ||
- name: Save cached dependencies | ||
uses: actions/cache/save@v4 | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
with: | ||
path: ${{ steps.setup.outputs.cabal-store }} | ||
key: ${{ steps.cache.outputs.cache-primary-key }} | ||
- name: Build | ||
run: cabal build all | ||
- name: Run tests | ||
run: cabal test all | ||
env: | ||
ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_TOKEN }} |