Skip to content

Commit c2594fb

Browse files
committed
chore: add Makefile, use make commands in workflow
1 parent 81d243a commit c2594fb

File tree

2 files changed

+46
-9
lines changed

2 files changed

+46
-9
lines changed

.github/workflows/haskell.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1616
- uses: haskell-actions/run-fourmolu@3b7702b41516aa428dfe6e295dc73476ae58f69e # v11
1717
with:
18-
version: "0.14.0.0"
18+
version: "0.17.0.0"
1919
build:
2020
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
2121
runs-on: ${{ matrix.os }}
@@ -43,12 +43,10 @@ jobs:
4343
echo "CABAL_VERSION=${CABAL_VERSION}" >> "${GITHUB_ENV}"
4444
4545
- name: Check cabal file
46-
run: cabal check
46+
run: make cabal-check
4747

4848
- name: Configure the build
49-
run: |
50-
cabal configure --enable-tests --enable-benchmarks --disable-documentation
51-
cabal build --dry-run
49+
run: make configure
5250

5351
- name: Restore cached dependencies
5452
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
@@ -61,7 +59,7 @@ jobs:
6159
restore-keys: ${{ env.key }}-
6260

6361
- name: Build dependencies
64-
run: cabal build --only-dependencies
62+
run: make deps
6563

6664
- name: Save cached dependencies
6765
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
@@ -71,10 +69,10 @@ jobs:
7169
key: ${{ steps.cache.outputs.cache-primary-key }}
7270

7371
- name: Build the package
74-
run: cabal build all
72+
run: make build
7573

7674
- name: Run tests
77-
run: cabal test all
75+
run: make test
7876

7977
- name: Build documentation
80-
run: cabal haddock all --disable-documentation
78+
run: make docs

Makefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
HS_FILES := $(shell git ls-files '*.hs')
2+
3+
.PHONY: format
4+
format:
5+
@test -n "$(HS_FILES)" || { echo "No tracked .hs files found"; exit 0; }
6+
fourmolu -i $(HS_FILES)
7+
8+
.PHONY: format-check
9+
format-check:
10+
@test -n "$(HS_FILES)" || { echo "No tracked .hs files found"; exit 0; }
11+
fourmolu -m check $(HS_FILES)
12+
13+
.PHONY: cabal-check
14+
cabal-check:
15+
cabal check
16+
17+
.PHONY: configure
18+
configure:
19+
cabal configure --enable-tests --enable-benchmarks --disable-documentation
20+
cabal build --dry-run
21+
22+
.PHONY: deps
23+
deps:
24+
cabal build --only-dependencies
25+
26+
.PHONY: build
27+
build:
28+
cabal build all
29+
30+
.PHONY: test
31+
test:
32+
cabal test all
33+
34+
.PHONY: docs
35+
docs:
36+
cabal haddock all --disable-documentation
37+
38+
.PHONY: ci
39+
ci: fmt-check cabal-check configure deps build test docs

0 commit comments

Comments
 (0)