|
1 | | -name: Tests |
| 1 | +name: CI |
2 | 2 |
|
| 3 | +# Trigger the workflow on push or pull request, but only for the main branch |
3 | 4 | on: |
4 | 5 | pull_request: |
5 | 6 | push: |
6 | 7 | branches: ["main"] |
7 | 8 |
|
8 | 9 | jobs: |
9 | | - generateMatrix: |
10 | | - name: "Generate matrix" |
11 | | - runs-on: ubuntu-latest |
| 10 | + generate-matrix: |
| 11 | + name: "Generate matrix from cabal" |
12 | 12 | outputs: |
13 | 13 | matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 14 | + runs-on: ubuntu-latest |
14 | 15 | steps: |
15 | | - - name: Checkout base repo |
16 | | - uses: actions/checkout@v3 |
17 | 16 | - name: Extract the tested GHC versions |
18 | 17 | id: set-matrix |
19 | | - run: | |
20 | | - wget -q https://github.com/Kleidukos/get-tested/releases/download/v0.1.4.0/get-tested-0.1.4.0-linux-amd64 -O get-tested |
21 | | - chmod +x get-tested |
22 | | - ./get-tested --ubuntu pg-transact-effectful.cabal >> $GITHUB_OUTPUT |
23 | | -
|
| 18 | + uses: kleidukos/get-tested@v0.1.7.0 |
| 19 | + with: |
| 20 | + cabal-file: pg-transact-effectful.cabal |
| 21 | + ubuntu-version: "latest" |
| 22 | + version: 0.1.7.0 |
24 | 23 | tests: |
25 | 24 | name: ${{ matrix.ghc }} on ${{ matrix.os }} |
26 | | - needs: generateMatrix |
| 25 | + needs: generate-matrix |
27 | 26 | runs-on: ${{ matrix.os }} |
28 | 27 | strategy: |
29 | | - matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }} |
| 28 | + matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} |
30 | 29 | steps: |
31 | | - - name: Checkout base repo |
32 | | - uses: actions/checkout@v3 |
33 | | - |
34 | | - - name: "Configure ghcup" |
35 | | - run: | |
36 | | - ghcup config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; |
37 | | -
|
38 | | - - name: Set up Haskell |
39 | | - id: setup-haskell |
40 | | - uses: haskell/actions/setup@v2 |
41 | | - with: |
42 | | - ghc-version: "${{ matrix.ghc }}" |
43 | | - cabal-version: "latest" |
44 | | - |
45 | | - - name: Configure environment |
46 | | - run: | |
47 | | - # sudo apt install -y postgresql-14 libpq-dev |
48 | | - # echo "/usr/lib/postgresql/14/bin/" >> $GITHUB_PATH |
49 | | - echo "$HOME/.ghcup/bin" >> $GITHUB_PATH |
50 | | - echo "$HOME/.cabal/bin" >> $GITHUB_PATH |
51 | | - echo "$HOME/.local/bin" >> $GITHUB_PATH |
52 | | - cabal freeze |
53 | | -
|
54 | | - - name: Cache |
55 | | - uses: actions/cache@v3 |
56 | | - with: |
57 | | - path: ${{ steps.setup-haskell.outputs.cabal-store }} |
58 | | - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} |
59 | | - restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- |
60 | | - |
61 | | - - name: Build |
62 | | - run: | |
63 | | - make build |
| 30 | + - name: Checkout base repo |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Set up Haskell |
| 34 | + id: setup-haskell |
| 35 | + uses: haskell-actions/setup@v2 |
| 36 | + with: |
| 37 | + ghc-version: ${{ matrix.ghc }} |
| 38 | + cabal-version: 'latest' |
| 39 | + |
| 40 | + - name: Freeze |
| 41 | + run: cabal freeze |
| 42 | + |
| 43 | + - name: Haskell cache restoration |
| 44 | + uses: actions/cache@v4.2.0 |
| 45 | + with: |
| 46 | + path: ${{ steps.setup-haskell.outputs.cabal-store }} |
| 47 | + key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('**/plan.json') }} |
| 48 | + restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}- |
| 49 | + |
| 50 | + - name: Build Library |
| 51 | + run: cabal build pg-transact-effectful |
0 commit comments