From 3b313a7e1975139cd638146deace4b3dccb77339 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Wed, 6 Jan 2021 04:21:10 +0200 Subject: [PATCH 1/3] CI: GitHub: Cabal: improvement of the GitHub caching A riff on the theme of https://markkarpov.com/post/github-actions-for-haskell-ci.html --- .github/workflows/Cabal-Linux.yml | 37 ++++++++++++------- .github/workflows/On-Release-Cabal-Linux.yml | 38 +++++++++++++------- 2 files changed, 49 insertions(+), 26 deletions(-) diff --git a/.github/workflows/Cabal-Linux.yml b/.github/workflows/Cabal-Linux.yml index d8b9e80a1..2eb2cefe1 100644 --- a/.github/workflows/Cabal-Linux.yml +++ b/.github/workflows/Cabal-Linux.yml @@ -8,6 +8,8 @@ on: schedule: - cron: "45 02 * * *" +env: + cabalConfig: --enable-tests --enable-benchmarks --disable-optimization --enable-deterministic jobs: @@ -18,18 +20,13 @@ jobs: matrix: ghc: [ "8.10", "8.4" ] steps: - - uses: actions/checkout@v2 + - name: "Git checkout" + uses: actions/checkout@v2 with: submodules: recursive - - name: "Cache of ~/.cabal/packages, ~/.cabal/store and dist-newstyle" - uses: actions/cache@v2 - with: - path: | - ~/.cabal/packages - ~/.cabal/store - dist-newstyle - key: ${{ runner.os }}-Cabal-${{ matrix.ghc }} - - uses: haskell/actions/setup@v1 + - name: "Haskell env setup" + id: HaskEnvSetup + uses: haskell/actions/setup@v1 with: ghc-version: ${{ matrix.ghc }} - name: "Install additional system packages" @@ -37,6 +34,20 @@ jobs: # 2020-08-01: NOTE: Nix instantiate still needed for HNix tests - name: "Install Nix" uses: cachix/install-nix-action@v12 - - run: cabal v2-configure --disable-optimization --enable-tests --enable-deterministic - - run: cabal v2-build - - run: cabal v2-test + - name: "Repository update" + run: cabal v2-update + # NOTE: Freeze is for the caching + - name: "Configuration freeze" + run: cabal v2-freeze $cabalConfig + - name: "Configuring GitHub cache" + uses: actions/cache@v2 + with: + path: | + ${{ steps.HaskEnvSetup.outputs.cabal-store }} + dist-newstyle + key: ${{ runner.os }}-Cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} + restore-keys: ${{ runner.os }}-Cabal-${{ matrix.ghc }}- + - name: "Build" + run: cabal v2-build $cabalConfig + - name: "Tests" + run: cabal v2-test $cabalConfig diff --git a/.github/workflows/On-Release-Cabal-Linux.yml b/.github/workflows/On-Release-Cabal-Linux.yml index 8cd9e8c82..b59b6a5af 100644 --- a/.github/workflows/On-Release-Cabal-Linux.yml +++ b/.github/workflows/On-Release-Cabal-Linux.yml @@ -5,6 +5,9 @@ on: # created: a draft is saved, or a release or pre-release is published without previously being saved as a draft types: [ created ] +env: + cabalConfig: --enable-tests --enable-benchmarks --disable-optimization --enable-deterministic + jobs: build10: @@ -15,18 +18,13 @@ jobs: # Since CI by default tests boundary GHCs, test middle versions of GHCs ghc: [ "8.8", "8.6"] steps: - - uses: actions/checkout@v2 + - name: "Git checkout" + uses: actions/checkout@v2 with: submodules: recursive - - name: Cache of ~/.cabal/packages, ~/.cabal/store and dist-newstyle - uses: actions/cache@v2 - with: - path: | - ~/.cabal/packages - ~/.cabal/store - dist-newstyle - key: ${{ runner.os }}-Cabal-${{ matrix.ghc }} - - uses: haskell/actions/setup@v1 + - name: "Haskell env setup" + id: HaskEnvSetup + uses: haskell/actions/setup@v1 with: ghc-version: ${{ matrix.ghc }} - name: "Install additional system packages" @@ -34,6 +32,20 @@ jobs: # 2020-08-01: NOTE: Nix instantiate still needed for HNix tests - name: "Install Nix" uses: cachix/install-nix-action@v12 - - run: cabal v2-configure --disable-optimization --enable-tests --enable-deterministic - - run: cabal v2-build - - run: cabal v2-test + - name: "Repository update" + run: cabal v2-update + # NOTE: Freeze is for the caching + - name: "Configuration freeze" + run: cabal v2-freeze $cabalConfig + - name: "Configuring GitHub cache" + uses: actions/cache@v2 + with: + path: | + ${{ steps.HaskEnvSetup.outputs.cabal-store }} + dist-newstyle + key: ${{ runner.os }}-Cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} + restore-keys: ${{ runner.os }}-Cabal-${{ matrix.ghc }}- + - name: "Build" + run: cabal v2-build $cabalConfig + - name: "Tests" + run: cabal v2-test $cabalConfig From 099bf20aa3a5acfae86395a93907f9a2147c201a Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Wed, 6 Jan 2021 04:22:47 +0200 Subject: [PATCH 2/3] CI: GitHub: Cabal: add Haddock check --- .github/workflows/Cabal-Linux.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/Cabal-Linux.yml b/.github/workflows/Cabal-Linux.yml index 2eb2cefe1..835ce9f4f 100644 --- a/.github/workflows/Cabal-Linux.yml +++ b/.github/workflows/Cabal-Linux.yml @@ -51,3 +51,6 @@ jobs: run: cabal v2-build $cabalConfig - name: "Tests" run: cabal v2-test $cabalConfig + - name: "Haddock" + if: ${{ matrix.ghc == '8.10' }} + run: cabal v2-haddock $cabalConfig From 0b81cb691827df2ea88d6f01970be03b0519e0c4 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Wed, 6 Jan 2021 04:28:33 +0200 Subject: [PATCH 3/3] CI: GitHub: Cabal: add Haddock add distribution check --- .github/workflows/Cabal-Linux.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/Cabal-Linux.yml b/.github/workflows/Cabal-Linux.yml index 835ce9f4f..fbcfedec3 100644 --- a/.github/workflows/Cabal-Linux.yml +++ b/.github/workflows/Cabal-Linux.yml @@ -54,3 +54,6 @@ jobs: - name: "Haddock" if: ${{ matrix.ghc == '8.10' }} run: cabal v2-haddock $cabalConfig + - name: "Source distribution file" + if: ${{ matrix.ghc == '8.10' }} + run: cabal v2-sdist