Skip to content

Commit

Permalink
Merge pull request #112 from haskell-works/newhoggy/upgrade-hedgehog
Browse files Browse the repository at this point in the history
Upgrade to hedgehog-1.5
  • Loading branch information
newhoggy authored Aug 5, 2024
2 parents 25156b2 + fa0e437 commit f5a248c
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 48 deletions.
124 changes: 77 additions & 47 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Binaries
name: Haskell CI

defaults:
run:
Expand All @@ -17,58 +17,88 @@ 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"]
os: [ubuntu-latest, macOS-latest, windows-latest]
cabal: ["3.12"]
ghc: ["9.8.1", "9.6.3", "9.4.8"]
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.2.1'

- 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
Expand Down
2 changes: 1 addition & 1 deletion hw-ip.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit f5a248c

Please sign in to comment.