diff --git a/.ci/apply_settings.sh b/.ci/apply_settings.sh index 7dbf9a70..89ec75c9 100755 --- a/.ci/apply_settings.sh +++ b/.ci/apply_settings.sh @@ -1,8 +1,11 @@ #!/bin/bash +set -uo pipefail + if [[ "$check_haddock" != @(True|False) ]]; then echo "check_haddock: Expected True or False, got \"$check_haddock\"" >&2 exit 1 fi sed <.ci/cabal.project.local.in >cabal.project.local " - s/__CHECK_HADDOCK__/$check_haddock/" + s/__CHECK_HADDOCK__/$check_haddock/ + s/__CLASH_VERSION__/$clash_version/" diff --git a/.ci/build_docs.sh b/.ci/build_docs.sh index 611f80d0..816ec320 100755 --- a/.ci/build_docs.sh +++ b/.ci/build_docs.sh @@ -1,10 +1,7 @@ #!/bin/bash set -xeou pipefail -cabal v2-haddock \ - --constraint=clash-prelude==$clash_version \ - clash-protocols \ - |& tee haddock_log +cabal v2-haddock all |& tee haddock_log set +e diff --git a/.ci/cabal.project.local.in b/.ci/cabal.project.local.in index 179f79dc..4212f5a2 100644 --- a/.ci/cabal.project.local.in +++ b/.ci/cabal.project.local.in @@ -1,6 +1,13 @@ package * documentation: __CHECK_HADDOCK__ +package clash-protocols-base + documentation: False + ghc-options: -Werror + package clash-protocols documentation: False ghc-options: -Werror + +constraints: + clash-prelude == __CLASH_VERSION__ diff --git a/.ci/test_cabal.sh b/.ci/test_cabal.sh index 337c0ac5..998e9dc6 100755 --- a/.ci/test_cabal.sh +++ b/.ci/test_cabal.sh @@ -1,6 +1,6 @@ #!/bin/bash set -xeou pipefail -cabal v2-run unittests --constraint=clash-prelude==$clash_version -fci --enable-tests -cabal v2-run doctests --constraint=clash-prelude==$clash_version -fci --enable-tests -cabal v2-sdist clash-protocols +cabal v2-run unittests --enable-tests +cabal v2-run doctests --enable-tests +cabal v2-sdist all diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ce36633..21ef9594 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,10 @@ name: CI -# Trigger the workflow on all pull requests and pushes/merges to master branch +# Trigger the workflow on all pull requests and pushes/merges to main branch on: pull_request: push: - branches: [master] + branches: [main] concurrency: @@ -22,13 +22,19 @@ jobs: - name: Setup Stack / GHC uses: haskell-actions/setup@v2 with: - ghc-version: '9.4.8' - cabal-version: '3.10.2.1' + ghc-version: '9.8.4' + cabal-version: '3.14.1.1' enable-stack: true stack-version: 'latest' - - name: Cache dependencies - uses: actions/cache@v4 + # Ask Stack to use system GHC instead of installing its own copy + - name: Use system GHC + run: | + stack config set system-ghc --global true + + - name: Restore cached dependencies + uses: actions/cache/restore@v4 + id: cache with: path: ~/.stack key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }} @@ -37,10 +43,19 @@ jobs: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}- ${{ runner.os }}-ghc-${{ matrix.ghc }}- - # Ask Stack to use system GHC instead of installing its own copy - - name: Use system GHC - run: | - stack config set system-ghc --global true + - name: Install dependencies + run: stack build --test --only-dependencies + + # Cache dependencies already at this point, so that we do not have to + # rebuild them should the subsequent steps fail + - name: Save cached dependencies + uses: actions/cache/save@v4 + # Trying to save over an existing cache gives distracting + # "Warning: Cache save failed." since they are immutable + if: ${{ steps.cache.outputs.cache-hit != 'true' }} + with: + path: ~/.stack + key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }} - name: Test with Stack run: | @@ -56,7 +71,7 @@ jobs: clash: - "1.8.2" cabal: - - "3.10" + - "3.14.1.1" ghc: - "9.0.2" - "9.2.8" @@ -65,11 +80,11 @@ jobs: - "9.10.1" include: - check_haddock: "False" - - ghc: "9.6.4" + - ghc: "9.6.6" check_haddock: "True" os: "ubuntu-latest" clash: "1.8.2" - cabal: "3.10" + cabal: "3.14.1.1" env: check_haddock: ${{ matrix.check_haddock }} @@ -95,8 +110,14 @@ jobs: cabal v2-freeze mv cabal.project.freeze frozen - - name: Cache dependencies - uses: actions/cache@v4 + - name: Restore cached dependencies + uses: actions/cache/restore@v4 + id: cache + env: + key: + ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ + steps.setup-haskell.outputs.cabal-version }}${{ + matrix.project-variant }} with: path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }} @@ -105,9 +126,23 @@ jobs: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}- ${{ runner.os }}-ghc-${{ matrix.ghc }}- + - name: Install dependencies + run: cabal v2-build all --enable-tests --only-dependencies + + # Cache dependencies already at this point, so that we do not have to + # rebuild them should the subsequent steps fail + - name: Save cached dependencies + uses: actions/cache/save@v4 + # Trying to save over an existing cache gives distracting + # "Warning: Cache save failed." since they are immutable + if: ${{ steps.cache.outputs.cache-hit != 'true' }} + with: + path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} + key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }} + - name: Build run: | - cabal build all --constraint=clash-prelude==$clash_version -fci + cabal v2-build all --enable-tests - name: Test run: | diff --git a/clash-protocols-base/clash-protocols-base.cabal b/clash-protocols-base/clash-protocols-base.cabal index d42c32ad..e1f88851 100644 --- a/clash-protocols-base/clash-protocols-base.cabal +++ b/clash-protocols-base/clash-protocols-base.cabal @@ -9,11 +9,6 @@ license-file: LICENSE author: Martijn Bastiaan, QBayLogic B.V. maintainer: Martijn Bastiaan -flag ci - Description: Running on CI? Used to set fail-on-warning flag. - Manual: True - Default: False - flag large-tuples description: Generate instances for classes such as `Units` and `TaggedBundle` for tuples @@ -75,9 +70,6 @@ common common-options -- a no-specialize pragma to every function with a blackbox. -fno-worker-wrapper - if flag(ci) - ghc-options: -Werror - default-language: Haskell2010 build-depends: base >= 4.15.0.0, diff --git a/clash-protocols/clash-protocols.cabal b/clash-protocols/clash-protocols.cabal index c797c3d7..4ff374ce 100644 --- a/clash-protocols/clash-protocols.cabal +++ b/clash-protocols/clash-protocols.cabal @@ -20,11 +20,6 @@ data-files: src/Protocols/Hedgehog.hs src/Protocols/Hedgehog/*.hs -flag ci - Description: Running on CI? Used to set fail-on-warning flag. - Manual: True - Default: False - flag large-tuples description: Generate instances for classes such as `Units` and `TaggedBundle` for tuples @@ -86,9 +81,6 @@ common common-options -- a no-specialize pragma to every function with a blackbox. -fno-worker-wrapper - if flag(ci) - ghc-options: -Werror - default-language: Haskell2010 build-depends: base >= 4.15.0.0, diff --git a/stack.yaml b/stack.yaml index f93ba15c..66bffc6c 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-21.25 # ghc-9.4.8 +resolver: lts-23.6 # ghc-9.8.4 packages: - clash-protocols-base @@ -7,5 +7,7 @@ packages: extra-deps: - git: https://github.com/cchalmers/circuit-notation.git commit: 564769c52aa05b90f81bbc898b7af7087d96613d -- clash-prelude-1.8.1 -- clash-prelude-hedgehog-1.8.1 +- clash-prelude-1.8.2 +- clash-prelude-hedgehog-1.8.2 +- hedgehog-1.4@sha256:9860ab34ab3951d9515c71b777d8c9c47610aae7339933e17d26ad9a4afa5618,4754 +- tasty-1.4.3@sha256:5b53fded93109f6704b599c3498eb73c5b0ed1a975f1912dd98b4b19c61f8bc9,2653