From 8580a59b856ce78cd040111c3833c567b20725a0 Mon Sep 17 00:00:00 2001 From: John Ky Date: Sun, 11 Aug 2024 09:45:44 +1000 Subject: [PATCH] Fix build --- .github/workflows/haskell.yml | 122 +++++++++++++------- hw-streams.cabal | 4 +- src/HaskellWorks/Data/Streams/Stream/Ops.hs | 2 +- 3 files changed, 82 insertions(+), 46 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index df34cb7..533e2b0 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -1,4 +1,4 @@ -name: Binaries +name: Haskell CI defaults: run: @@ -17,52 +17,88 @@ jobs: strategy: fail-fast: false matrix: - ghc: ["9.2.2", "9.0.2", "8.10.7", "8.8.4", "8.6.5"] - os: [ubuntu-latest, macOS-latest, windows-latest] + cabal: ["3.12"] + ghc: ["9.10.1", "9.8.1", "9.6.3", "9.4.8"] + os: [ubuntu-latest, windows-latest] - steps: - - uses: actions/checkout@v2 - - - uses: haskell/actions/setup@v1 - id: setup-haskell - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: 3.6.2.0 - - - name: Set some window specific things - if: matrix.os == 'windows-latest' - run: echo 'EXE_EXT=.exe' >> $GITHUB_ENV + 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.10.1" + cabal: "3.12" + os: macos-latest - - name: Configure project - run: cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+ + env: + # Modify this value to "invalidate" the cabal cache. + CABAL_CACHE_VERSION: "2024-08-05" - - 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 }} - 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/archive - skip: "${{ secrets.BINARY_CACHE_URI != '' }}" - - - name: Build - run: cabal build all --enable-tests --enable-benchmarks + steps: - - 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 diff --git a/hw-streams.cabal b/hw-streams.cabal index f6a61b4..a0acfdc 100644 --- a/hw-streams.cabal +++ b/hw-streams.cabal @@ -34,14 +34,14 @@ common directory { build-depends: directory >= common doctest { build-depends: doctest >= 0.16.2 && < 0.21 } common doctest-discover { build-depends: doctest-discover >= 0.2 && < 0.3 } common exceptions { build-depends: exceptions >= 0.8 && < 0.11 } -common ghc-prim { build-depends: ghc-prim >= 0.4 && < 0.10 } +common ghc-prim { build-depends: ghc-prim >= 0.4 && < 0.12 } common hedgehog { build-depends: hedgehog >= 0.5 && < 1.3 } common hspec { build-depends: hspec >= 2.4 && < 3 } common hw-bits { build-depends: hw-bits >= 0.7.0.3 && < 0.8 } common hw-hspec-hedgehog { build-depends: hw-hspec-hedgehog >= 0.1 && < 0.2 } common hw-prim { build-depends: hw-prim >= 0.6.2.17 && < 0.7 } common mmap { build-depends: mmap >= 0.5 && < 0.6 } -common primitive { build-depends: primitive >= 0.6.3.0 && < 0.8 } +common primitive { build-depends: primitive >= 0.6.3.0 && < 0.10 } common QuickCheck { build-depends: QuickCheck >= 2.10 && < 2.15 } common transformers { build-depends: transformers >= 0.4 && < 0.7 } common vector { build-depends: vector >= 0.12 && < 0.14 } diff --git a/src/HaskellWorks/Data/Streams/Stream/Ops.hs b/src/HaskellWorks/Data/Streams/Stream/Ops.hs index fca989a..8a980e8 100644 --- a/src/HaskellWorks/Data/Streams/Stream/Ops.hs +++ b/src/HaskellWorks/Data/Streams/Stream/Ops.hs @@ -14,7 +14,7 @@ import qualified HaskellWorks.Data.Bits.BitWise as BW import qualified HaskellWorks.Data.Streams.Stream as HW ltWord :: Word64 -> Word64 -> Word64 -ltWord (W64# a#) (W64# b#) = fromIntegral (I64# (ltWord# a# b#)) +ltWord (W64# a#) (W64# b#) = fromIntegral (I# (ltWord64# a# b#)) {-# INLINE ltWord #-} comp :: Stream Word64 -> Stream Word64