diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 7b12a6788..fe1ef0341 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -26,7 +26,7 @@ jobs: cabal: ["3.10.2.1"] os: [ubuntu-latest, windows-latest, macOS-latest] cabal-flags: [""] - no-debug: [""] + cabal-project-file: ["cabal.project.debug"] exclude: - ghc: "8.10.7" os: macOS-latest @@ -34,18 +34,21 @@ jobs: - ghc: "8.10.7" cabal: "3.10.2.1" os: macOS-13 + cabal-project-file: "cabal.project.debug" - ghc: "9.6.4" cabal: "3.10.2.1" os: ubuntu-latest cabal-flags: "+serialblockio" + cabal-project-file: "cabal.project.debug" - ghc: "9.6.4" cabal: "3.10.2.1" os: ubuntu-latest - no-debug: "no-debug" + cabal-project-file: "cabal.project.release" timeout-minutes: 60 steps: + - name: CPU info (macOS) if: ${{ startsWith(matrix.os, 'macOS') }} run: sysctl -a machdep.cpu @@ -75,19 +78,13 @@ jobs: - name: Configure the build run: | - cabal configure --enable-tests --enable-benchmark --ghc-options="-Werror" --flag="${{ matrix.cabal-flags }}" - cat cabal.project.local - - - name: Configure the build (no-debug) - if: ${{ matrix.no-debug }} - run: | - echo "" > cabal.project.debug - cat cabal.project.debug + cabal configure --project-file="${{ matrix.cabal-project-file }}" --enable-tests --enable-benchmark --ghc-options="-Werror" --flag="${{ matrix.cabal-flags }}" + cat "${{ matrix.cabal-project-file }}.local" - name: Record cabal dependencies id: record-deps run: | - cabal build all --dry-run + cabal build all --project-file="${{ matrix.cabal-project-file }}" --dry-run - name: "Restore cache" uses: actions/cache/restore@v4 @@ -104,7 +101,8 @@ jobs: - name: Install cabal dependencies id: build-dependencies - run: cabal build --only-dependencies --enable-tests --enable-benchmarks all + run: | + cabal build --project-file="${{ matrix.cabal-project-file }}" --only-dependencies --enable-tests --enable-benchmarks all - name: "Save cache" uses: actions/cache/save@v4 @@ -118,7 +116,8 @@ jobs: key: ${{ steps.restore-cabal-cache.outputs.cache-primary-key }} - name: Build - run: cabal build all + run: | + cabal build all --project-file="${{ matrix.cabal-project-file }}" # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable - name: Set test timeout (Unix) @@ -134,7 +133,7 @@ jobs: - name: Run tests run: | - cabal test -j1 --test-show-details=direct all + cabal test -j1 --test-show-details=direct all --project-file="${{ matrix.cabal-project-file }}" - name: cabal-docspec if: ${{ startsWith(matrix.os, 'ubuntu') }} @@ -184,7 +183,8 @@ jobs: cabal-update: false - name: Cabal update - run: cabal update + run: | + cabal update --ignore-project - name: Setup cabal bin path run: echo "$HOME/.cabal/bin" >> $GITHUB_PATH @@ -200,7 +200,8 @@ jobs: ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}- - name: Install stylish-haskell - run: cabal install --ignore-project --index-state="${{ env.hackage-index-state }}" stylish-haskell --constraint 'stylish-haskell == 0.14.6.0' + run: | + cabal install --ignore-project --index-state="${{ env.hackage-index-state }}" stylish-haskell --constraint 'stylish-haskell == 0.14.6.0' - name: Record stylish-haskell version run: | @@ -246,7 +247,8 @@ jobs: cabal-update: false - name: Cabal update - run: cabal update + run: | + cabal update --ignore-project - name: Setup cabal bin path run: echo "$HOME/.cabal/bin" >> $GITHUB_PATH @@ -262,7 +264,8 @@ jobs: ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}- - name: Install cabal-fmt - run: cabal install --ignore-project cabal-fmt --index-state="${{ env.hackage-index-state }}" --constraint 'cabal-fmt == 0.1.11' + run: | + cabal install --ignore-project cabal-fmt --index-state="${{ env.hackage-index-state }}" --constraint 'cabal-fmt == 0.1.11' - name: Record cabal-fmt version run: | @@ -298,7 +301,8 @@ jobs: cabal-update: false - name: Cabal update - run: cabal update + run: + cabal update --ignore-project - name: Run cabal check run: | diff --git a/cabal.project b/cabal.project deleted file mode 100644 index dbb839611..000000000 --- a/cabal.project +++ /dev/null @@ -1,31 +0,0 @@ -index-state: - -- Bump this if you need newer packages from Hackage - -- current date: fs-sim-0.3.0.1 - , hackage.haskell.org 2024-10-02T10:41:30Z - -packages: . - -tests: True -benchmarks: True - --- this prevents occurence of Hackage bloomfilter anywhere in the install plan --- that is overconstraining, as we'd only need to make sure lsm-tree --- doesn't depend on Hackage bloomfilter. --- Luckily, bloomfilter is not commonly used package, so this is good enough. -constraints: bloomfilter <0 - --- comment me if you are benchmarking -import: cabal.project.debug - --- comment me if you don't have liburing installed --- --- TODO: it is slightly unfortunate that one has to manually remove this file --- import in case they don't have liburing installed... Currently, it is not --- possible to have conditionals on package flags in a project file. Otherwise, --- we could add a conditional on (+serialblockio) to remove this import automatically. -import: cabal.project.blockio-uring - -source-repository-package - type: git - location: https://github.com/well-typed/quickcheck-lockstep.git - tag: 1852cf87a76dc48c71aa0d9fda3fdc7c8b965011 diff --git a/cabal.project b/cabal.project new file mode 120000 index 000000000..9daebfa81 --- /dev/null +++ b/cabal.project @@ -0,0 +1 @@ +cabal.project.debug \ No newline at end of file diff --git a/cabal.project.debug b/cabal.project.debug index 3fe6522a3..1fe56e9c7 100644 --- a/cabal.project.debug +++ b/cabal.project.debug @@ -1,3 +1,6 @@ +-- Import release project configuration +import: cabal.project.release + package lsm-tree -- apply this to all components -- relevant mostly only for development & testing diff --git a/cabal.project.release b/cabal.project.release new file mode 100644 index 000000000..3509c09c3 --- /dev/null +++ b/cabal.project.release @@ -0,0 +1,28 @@ +index-state: + -- Bump this if you need newer packages from Hackage + -- current date: fs-sim-0.3.0.1 + , hackage.haskell.org 2024-10-02T10:41:30Z + +packages: . + +tests: True +benchmarks: True + +-- this prevents occurence of Hackage bloomfilter anywhere in the install plan +-- that is overconstraining, as we'd only need to make sure lsm-tree +-- doesn't depend on Hackage bloomfilter. +-- Luckily, bloomfilter is not commonly used package, so this is good enough. +constraints: bloomfilter <0 + +-- comment me if you don't have liburing installed +-- +-- TODO: it is slightly unfortunate that one has to manually remove this file +-- import in case they don't have liburing installed... Currently, it is not +-- possible to have conditionals on package flags in a project file. Otherwise, +-- we could add a conditional on (+serialblockio) to remove this import automatically. +import: cabal.project.blockio-uring + +source-repository-package + type: git + location: https://github.com/well-typed/quickcheck-lockstep.git + tag: 1852cf87a76dc48c71aa0d9fda3fdc7c8b965011