Skip to content

Commit

Permalink
Produce the build plan before fetching cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleidukos committed Apr 12, 2024
1 parent b1c4b94 commit 00a2ba8
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,43 @@ on:
jobs:
generateMatrix:
name: "Generate matrix from cabal"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Checkout base repo
uses: actions/checkout@v4
- name: Extract the tested GHC versions
id: set-matrix
run: |
wget https://github.com/Kleidukos/get-tested/releases/download/v0.1.5.0/get-tested-0.1.5.0-linux-amd64 -O get-tested
chmod +x get-tested
./get-tested --ubuntu tree-sitter/tree-sitter.cabal >> $GITHUB_OUTPUT
uses: kleidukos/[email protected]
with:
cabal-file: tree-sitter/tree-sitter.cabal
ubuntu-version: "latest"
version: 0.1.7.0
build:
name: ${{ matrix.ghc }} on ${{ matrix.os }}
needs: generateMatrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }}

steps:
- uses: actions/checkout@v4
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main'
- uses: haskell/actions/setup@v2
- name: Checkout base repo
uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
name: Setup Haskell
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: "latest"
- name: Freeze
run: cabal freeze
- name: Cache
uses: actions/cache@v3.3.2
uses: actions/cache@v4
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}-
- uses: actions/cache@v2
- uses: actions/cache@v4
name: Cache dist-newstyle
with:
path: dist-newstyle
Expand Down

0 comments on commit 00a2ba8

Please sign in to comment.