diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4bc4fc..4ebd82d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,45 +6,48 @@ on: push: branches: [master] +permissions: + contents: read + jobs: build: + name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - cabal: ["3.2.0.0", "3.4.0.0", "3.6.0.0", "3.8.0.0"] - ghc: ["8.10.7", "9.0.2", "9.2.2", "9.4.6"] os: [ubuntu-latest] - exclude: - - cabal: "3.2.0.0" - ghc: "9.0.2" - - cabal: "3.2.0.0" - ghc: "9.2.2" - - cabal: "3.4.0.0" - ghc: "9.2.2" - - cabal: "3.6.0.0" - ghc: "8.10.7" - - cabal: "3.6.0.0" - ghc: "9.0.2" + ghc-version: ['9.4', '9.2', '9.0', '8.10'] steps: - - uses: actions/checkout@v2 - if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master' - - - uses: haskell/actions/setup@v1 - name: Setup Haskell - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} + - uses: actions/checkout@v3 - - uses: actions/cache@v1 - name: Cache ~/.cabal/store - with: - path: ~/.cabal/store - key: ${{ runner.os }}-${{ matrix.ghc }}-cabal + - name: Set up GHC ${{ matrix.ghc-version }} + uses: haskell/actions/setup@v2 + id: setup + with: + ghc-version: ${{ matrix.ghc-version }} + cabal-version: 'latest' - - name: Build - run: | - cabal v2-update - cabal v2-build --enable-tests --enable-benchmarks - - name: Test - run: | - cabal v2-test + - name: Configure the build + run: | + cabal configure --enable-tests --enable-benchmarks --disable-documentation + cabal build --dry-run + - name: Restore cached dependencies + uses: actions/cache/restore@v3 + 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 + run: cabal build all --only-dependencies + - name: Save cached dependencies + uses: actions/cache/save@v3 + if: ${{ steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }} + with: + path: ${{ steps.setup.outputs.cabal-store }} + key: ${{ steps.cache.outputs.cache-primary-key }} + - name: Build + run: cabal build all