Skip to content

Commit 59b3468

Browse files
committed
Separate debug configuration into top-level project file
1 parent 74812b0 commit 59b3468

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

.github/workflows/haskell.yml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,29 @@ jobs:
2626
cabal: ["3.10.2.1"]
2727
os: [ubuntu-latest, windows-latest, macOS-latest]
2828
cabal-flags: [""]
29-
no-debug: [""]
29+
cabal-project-file: ["cabal.project.debug"]
3030
exclude:
3131
- ghc: "8.10.7"
3232
os: macOS-latest
3333
include:
3434
- ghc: "8.10.7"
3535
cabal: "3.10.2.1"
3636
os: macOS-13
37+
cabal-project-file: "cabal.project.debug"
3738
- ghc: "9.6.4"
3839
cabal: "3.10.2.1"
3940
os: ubuntu-latest
4041
cabal-flags: "+serialblockio"
42+
cabal-project-file: "cabal.project.debug"
4143
- ghc: "9.6.4"
4244
cabal: "3.10.2.1"
4345
os: ubuntu-latest
44-
no-debug: "no-debug"
46+
cabal-project-file: "cabal.project.release"
4547

4648
timeout-minutes: 60
4749

4850
steps:
51+
4952
- name: CPU info (macOS)
5053
if: ${{ startsWith(matrix.os, 'macOS') }}
5154
run: sysctl -a machdep.cpu
@@ -75,19 +78,13 @@ jobs:
7578
7679
- name: Configure the build
7780
run: |
78-
cabal configure --enable-tests --enable-benchmark --ghc-options="-Werror" --flag="${{ matrix.cabal-flags }}"
79-
cat cabal.project.local
80-
81-
- name: Configure the build (no-debug)
82-
if: ${{ matrix.no-debug }}
83-
run: |
84-
echo "" > cabal.project.debug
85-
cat cabal.project.debug
81+
cabal configure --project-file="${{ matrix.cabal-project-file }}" --enable-tests --enable-benchmark --ghc-options="-Werror" --flag="${{ matrix.cabal-flags }}"
82+
cat "${{ matrix.cabal-project-file }}.local"
8683
8784
- name: Record cabal dependencies
8885
id: record-deps
8986
run: |
90-
cabal build all --dry-run
87+
cabal build all --project-file="${{ matrix.cabal-project-file }}" --dry-run
9188
9289
- name: "Restore cache"
9390
uses: actions/cache/restore@v4
@@ -104,7 +101,8 @@ jobs:
104101
105102
- name: Install cabal dependencies
106103
id: build-dependencies
107-
run: cabal build --only-dependencies --enable-tests --enable-benchmarks all
104+
run: |
105+
cabal build --project-file="${{ matrix.cabal-project-file }}" --only-dependencies --enable-tests --enable-benchmarks all
108106
109107
- name: "Save cache"
110108
uses: actions/cache/save@v4
@@ -118,7 +116,8 @@ jobs:
118116
key: ${{ steps.restore-cabal-cache.outputs.cache-primary-key }}
119117

120118
- name: Build
121-
run: cabal build all
119+
run: |
120+
cabal build all --project-file="${{ matrix.cabal-project-file }}"
122121
123122
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
124123
- name: Set test timeout (Unix)
@@ -134,7 +133,7 @@ jobs:
134133
135134
- name: Run tests
136135
run: |
137-
cabal test -j1 --test-show-details=direct all
136+
cabal test -j1 --test-show-details=direct all --project-file="${{ matrix.cabal-project-file }}"
138137
139138
- name: cabal-docspec
140139
if: ${{ startsWith(matrix.os, 'ubuntu') }}
@@ -184,7 +183,8 @@ jobs:
184183
cabal-update: false
185184

186185
- name: Cabal update
187-
run: cabal update
186+
run: |
187+
cabal update --ignore-project
188188
189189
- name: Setup cabal bin path
190190
run: echo "$HOME/.cabal/bin" >> $GITHUB_PATH
@@ -200,7 +200,8 @@ jobs:
200200
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-
201201
202202
- name: Install stylish-haskell
203-
run: cabal install --ignore-project --index-state="${{ env.hackage-index-state }}" stylish-haskell --constraint 'stylish-haskell == 0.14.6.0'
203+
run: |
204+
cabal install --ignore-project --index-state="${{ env.hackage-index-state }}" stylish-haskell --constraint 'stylish-haskell == 0.14.6.0'
204205
205206
- name: Record stylish-haskell version
206207
run: |
@@ -246,7 +247,8 @@ jobs:
246247
cabal-update: false
247248

248249
- name: Cabal update
249-
run: cabal update
250+
run: |
251+
cabal update --ignore-project
250252
251253
- name: Setup cabal bin path
252254
run: echo "$HOME/.cabal/bin" >> $GITHUB_PATH
@@ -262,7 +264,8 @@ jobs:
262264
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-
263265
264266
- name: Install cabal-fmt
265-
run: cabal install --ignore-project cabal-fmt --index-state="${{ env.hackage-index-state }}" --constraint 'cabal-fmt == 0.1.11'
267+
run: |
268+
cabal install --ignore-project cabal-fmt --index-state="${{ env.hackage-index-state }}" --constraint 'cabal-fmt == 0.1.11'
266269
267270
- name: Record cabal-fmt version
268271
run: |
@@ -298,7 +301,8 @@ jobs:
298301
cabal-update: false
299302

300303
- name: Cabal update
301-
run: cabal update
304+
run:
305+
cabal update --ignore-project
302306

303307
- name: Run cabal check
304308
run: |

cabal.project.debug

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
-- Import release project configuration
2+
import: cabal.project.release
3+
14
package lsm-tree
25
-- apply this to all components
36
-- relevant mostly only for development & testing

cabal.project renamed to cabal.project.release

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ benchmarks: True
1414
-- Luckily, bloomfilter is not commonly used package, so this is good enough.
1515
constraints: bloomfilter <0
1616

17-
-- comment me if you are benchmarking
18-
import: cabal.project.debug
19-
2017
-- comment me if you don't have liburing installed
2118
--
2219
-- TODO: it is slightly unfortunate that one has to manually remove this file

0 commit comments

Comments
 (0)