Merge pull request #87 from haskell-github-trust/renovate/actions-cac… #83
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| generate-matrix: | |
| name: Generate GHC matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.get-tested.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - id: get-tested | |
| uses: Kleidukos/get-tested@a55a250eac23bcc4bcd1cb22d77be61baea5a7e2 # v0.1.9.1 | |
| with: | |
| cabal-file: smtp-mail.cabal | |
| ubuntu-version: "latest" | |
| build: | |
| name: GHC ${{ matrix.ghc }} on ${{ matrix.os }} | |
| needs: generate-matrix | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: haskell/ghcup-setup@269e121e9e7528761aca5a606a53fe9d04cd6658 # v1.2.3 | |
| with: | |
| ghc: ${{ matrix.ghc }} | |
| cabal: latest | |
| - name: Update cabal index | |
| run: cabal update | |
| - name: Get cabal store path | |
| id: cabal-store | |
| run: echo "path=$(cabal path --store-dir)" >> "$GITHUB_OUTPUT" | |
| - name: Restore cache | |
| uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: ${{ steps.cabal-store.outputs.path }} | |
| key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }} | |
| - name: Extract New-Hackage-Versions git trailer from Renovate | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: | | |
| git fetch origin ${{ github.event.pull_request.head.sha }} | |
| for constraint in $(git log "--format=%(trailers:key=New-Hackage-Versions,valueonly=true)" ${{ github.event.pull_request.head.sha }} -1) | |
| do | |
| echo "constraints: $constraint" >> cabal.project.local | |
| echo "::notice title=Dependency Constraint Applied::$constraint" | |
| done | |
| - name: Build dependencies | |
| run: cabal build all --only-dependencies | |
| - name: Save cache | |
| uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: ${{ steps.cabal-store.outputs.path }} | |
| key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }} | |
| - name: Build | |
| run: cabal build all | |
| all-builds: | |
| name: All builds passed | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: always() | |
| steps: | |
| - name: Check build results | |
| run: | | |
| if [[ "${{ needs.build.result }}" != "success" ]]; then | |
| echo "One or more builds failed" | |
| exit 1 | |
| fi |