From 30b3b6fa1dc48a5ce8b2a41afaeb70e440db3e04 Mon Sep 17 00:00:00 2001 From: John Ky Date: Mon, 5 Aug 2024 21:00:37 +1000 Subject: [PATCH 1/2] Upgrade to hedgehog-1.5 --- .github/workflows/haskell.yml | 4 ++-- hw-ip.cabal | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 2837190..dd12565 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - ghc: ["9.8.1", "9.6.3", "9.4.8", "9.2.8", "9.0.2", "8.10.7"] + ghc: ["9.8.1", "9.6.3", "9.4.8"] os: [ubuntu-latest, macOS-latest, windows-latest] env: @@ -31,7 +31,7 @@ jobs: id: setup-haskell with: ghc-version: ${{ matrix.ghc }} - cabal-version: '3.10.2.1' + cabal-version: '3.10.3.0' - name: Set some window specific things if: matrix.os == 'windows-latest' diff --git a/hw-ip.cabal b/hw-ip.cabal index 8cc3df8..c9191c1 100644 --- a/hw-ip.cabal +++ b/hw-ip.cabal @@ -31,7 +31,7 @@ common containers { build-depends: containers >= common doctest { build-depends: doctest >= 0.16.2 && < 0.23 } common doctest-discover { build-depends: doctest-discover >= 0.2 && < 0.3 } common generic-lens { build-depends: generic-lens >= 2.2 && < 2.3 } -common hedgehog { build-depends: hedgehog >= 0.6 && < 1.5 } +common hedgehog { build-depends: hedgehog >= 0.6 && < 2 } common hspec { build-depends: hspec >= 2.4.4 && < 3 } common hw-bits { build-depends: hw-bits >= 0.7 && < 0.8 } common hw-hspec-hedgehog { build-depends: hw-hspec-hedgehog >= 0.1.0.2 && < 0.2 } From fa0e43775631ab782ba4fb9d88438dea0dc7daa2 Mon Sep 17 00:00:00 2001 From: John Ky Date: Mon, 5 Aug 2024 21:31:24 +1000 Subject: [PATCH 2/2] stuff --- .github/workflows/haskell.yml | 122 +++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 46 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index dd12565..214a396 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -1,4 +1,4 @@ -name: Binaries +name: Haskell CI defaults: run: @@ -17,58 +17,88 @@ jobs: strategy: fail-fast: false matrix: + cabal: ["3.12"] ghc: ["9.8.1", "9.6.3", "9.4.8"] - os: [ubuntu-latest, macOS-latest, windows-latest] + os: [ubuntu-latest, windows-latest] + + include: + # Using include, to make sure there will only be one macOS job, even if the matrix gets expanded later on. + # We want a single job, because macOS runners are scarce. + - ghc: "9.6.3" + cabal: "3.12" + os: macos-latest env: # Modify this value to "invalidate" the cabal cache. - CABAL_CACHE_VERSION: "2024-01-05" + CABAL_CACHE_VERSION: "2024-08-05" steps: - - uses: actions/checkout@v2 - - - uses: haskell-actions/setup@v2 - id: setup-haskell - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: '3.10.3.0' - - - name: Set some window specific things - if: matrix.os == 'windows-latest' - run: echo 'EXE_EXT=.exe' >> $GITHUB_ENV - - - name: Configure project - run: | - cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+ - cabal build all --enable-tests --enable-benchmarks --dry-run - - - name: Cabal cache over S3 - uses: action-works/cabal-cache-s3@v1 - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - with: - region: us-west-2 - dist-dir: dist-newstyle - store-path: ${{ steps.setup-haskell.outputs.cabal-store }} - threads: 16 - archive-uri: ${{ secrets.BINARY_CACHE_URI }}/${{ env.CABAL_CACHE_VERSION }}/${{ runner.os }}/${{ matrix.cabal }}/${{ matrix.ghc }} - skip: "${{ secrets.BINARY_CACHE_URI == '' }}" - - - name: Cabal cache over HTTPS - uses: action-works/cabal-cache-s3@v1 - with: - dist-dir: dist-newstyle - store-path: ${{ steps.setup-haskell.outputs.cabal-store }} - threads: 16 - archive-uri: https://cache.haskellworks.io/${{ env.CABAL_CACHE_VERSION }}/${{ runner.os }}/${{ matrix.cabal }}/${{ matrix.ghc }} - skip: "${{ secrets.BINARY_CACHE_URI != '' }}" - - - name: Build - run: cabal build all --enable-tests --enable-benchmarks - - name: Test - run: cabal test all --enable-tests --enable-benchmarks + - name: Install Haskell + uses: input-output-hk/actions/haskell@latest + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: ${{ matrix.cabal }} + + # - name: Install system dependencies + # uses: input-output-hk/actions/base@latest + # with: + # use-sodium-vrf: true # default is true + + - uses: actions/checkout@v4 + + - name: Cabal update + run: cabal update + + - name: Configure build + run: | + cabal configure --enable-tests --enable-benchmarks + cabal build all --enable-tests --enable-benchmarks --dry-run + + - name: Record dependencies + run: | + cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt + date +"%Y-%m-%d" > date.txt + + - name: View dependencies + run: | + echo "date = $(cat date.txt)" + echo "md5(dependencies.txt) = $(md5sum dependencies.txt)" + echo "md5(date.txt) = $(md5sum date.txt)" + + - name: Upload dependencies.txt + uses: actions/upload-artifact@v2 + with: + name: dependencies + path: dependencies.txt + + - uses: actions/cache@v4 + name: Cache cabal store + with: + path: ${{ steps.setup-haskell.outputs.cabal-store }} + key: cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}-${{ hashFiles('date.txt') }} + restore-keys: | + cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}-${{ hashFiles('date.txt') }} + cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }} + cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }} + + # Now we install the dependencies. If the cache was found and restored in the previous step, + # this should be a no-op, but if the cache key was not found we need to build stuff so we can + # cache it for the next step. + - name: Install dependencies + run: cabal build all --enable-tests --only-dependencies -j --ghc-option=-j4 + + # Now we build. + - name: Build all + run: cabal build all --enable-tests + + - name: Run tests + env: + TMPDIR: ${{ runner.temp }} + TMP: ${{ runner.temp }} + KEEP_WORKSPACE: 1 + run: cabal test all --enable-tests --enable-benchmarks check: needs: build