Skip to content

Commit d9a5f83

Browse files
committed
wip
1 parent 48f30f4 commit d9a5f83

4 files changed

Lines changed: 153 additions & 24 deletions

File tree

.github/workflows/haskell-nix.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Haskell CI with Nix
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
nix-ci:
13+
runs-on: ubuntu-latest
14+
env:
15+
NIX_CONFIG: accept-flake-config = true
16+
17+
steps:
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
20+
- name: Check Nix flake inputs
21+
uses: DeterminateSystems/flake-checker-action@3164002371bc90729c68af0e24d5aacf20d7c9f6 # v12
22+
23+
- name: Install Nix
24+
uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
25+
26+
- name: Enable Nix cache
27+
uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
28+
29+
- name: Show toolchain versions from nix shell
30+
shell: bash
31+
run: |
32+
nix develop --command bash -lc 'ghc --numeric-version'
33+
nix develop --command bash -lc 'cabal --numeric-version'
34+
nix develop --command bash -lc 'stack --numeric-version || true'
35+
nix develop --command bash -lc 'fourmolu --version'
36+
37+
- name: Check formatting
38+
run: nix develop --command make format-check
39+
40+
- name: Check cabal file
41+
run: nix develop --command make cabal-check
42+
43+
- name: Update cabal package index
44+
run: nix develop --command make cabal-update
45+
46+
- name: Configure the build
47+
run: nix develop --command make configure
48+
49+
- name: Build dependencies
50+
run: nix develop --command make deps
51+
52+
- name: Build the package
53+
run: nix develop --command make build
54+
55+
- name: Run tests
56+
run: nix develop --command make test
57+
58+
- name: Build documentation
59+
run: nix develop --command make docs

.github/workflows/haskell.yml

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,83 @@ name: Haskell CI
22

33
on:
44
push:
5+
pull_request:
56
workflow_dispatch:
67

78
permissions:
89
contents: read
910

1011
jobs:
11-
nix-ci:
12+
fourmolu:
1213
runs-on: ubuntu-latest
13-
env:
14-
NIX_CONFIG: accept-flake-config = true
1514

1615
steps:
1716
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1817

19-
- name: Check Nix flake inputs
20-
uses: DeterminateSystems/flake-checker-action@3164002371bc90729c68af0e24d5aacf20d7c9f6 # v12
18+
- uses: haskell-actions/run-fourmolu@v11
19+
with:
20+
version: "0.17.0.0"
2121

22-
- name: Install Nix
23-
uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
22+
build:
23+
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
os: [ubuntu-latest, macos-latest, windows-latest]
29+
ghc-version: ["9.6.7"]
2430

25-
- name: Enable Nix cache
26-
uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
31+
steps:
32+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33+
34+
- name: Set up GHC ${{ matrix.ghc-version }}
35+
uses: haskell-actions/setup@v2
36+
id: setup
37+
with:
38+
ghc-version: ${{ matrix.ghc-version }}
39+
cabal-version: "3.16.0.0"
2740

28-
- name: Show toolchain versions from nix shell
41+
- name: Show toolchain versions
2942
shell: bash
3043
run: |
31-
nix develop --command bash -lc 'ghc --numeric-version'
32-
nix develop --command bash -lc 'cabal --numeric-version'
33-
nix develop --command bash -lc 'stack --numeric-version || true'
34-
nix develop --command bash -lc 'fourmolu --version'
35-
36-
- name: Check formatting
37-
run: nix develop --command make format-check
44+
ghc --numeric-version
45+
cabal --numeric-version
3846
3947
- name: Check cabal file
40-
run: nix develop --command make cabal-check
48+
run: cabal check
4149

4250
- name: Update cabal package index
43-
run: nix develop --command make cabal-update
51+
run: cabal update
4452

4553
- name: Configure the build
46-
run: nix develop --command make configure
54+
run: |
55+
cabal configure --enable-tests --enable-benchmarks --disable-documentation
56+
cabal build --dry-run
57+
58+
- name: Restore cabal store cache
59+
uses: actions/cache/restore@v4
60+
id: cache-restore
61+
with:
62+
path: ${{ steps.setup.outputs.cabal-store }}
63+
key: ${{ runner.os }}-ghc-${{ matrix.ghc-version }}-cabal-${{ hashFiles('**/plan.json') }}
64+
restore-keys: |
65+
${{ runner.os }}-ghc-${{ matrix.ghc-version }}-cabal-
4766
4867
- name: Build dependencies
49-
run: nix develop --command make deps
68+
run: cabal build --only-dependencies
69+
70+
- name: Save cabal store cache
71+
uses: actions/cache/save@v4
72+
if: steps.cache-restore.outputs.cache-hit != 'true'
73+
with:
74+
path: ${{ steps.setup.outputs.cabal-store }}
75+
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
5076

5177
- name: Build the package
52-
run: nix develop --command make build
78+
run: cabal build all
5379

5480
- name: Run tests
55-
run: nix develop --command make test
81+
run: cabal test all
5682

5783
- name: Build documentation
58-
run: nix develop --command make docs
84+
run: cabal haddock all --disable-documentation

.github/workflows/update-flake.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Update Nix Flake
2+
3+
on:
4+
schedule:
5+
# Every 2 weeks on Monday at 06:00 UTC
6+
- cron: "0 6 1,15 * *"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
update-flake:
15+
runs-on: ubuntu-latest
16+
env:
17+
NIX_CONFIG: accept-flake-config = true
18+
19+
steps:
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
22+
- name: Install Nix
23+
uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
24+
25+
- name: Enable Nix cache
26+
uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
27+
28+
- name: Update flake lockfile
29+
run: nix flake update
30+
31+
- name: Create Pull Request
32+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
33+
with:
34+
commit-message: "chore(nix): update flake lockfile"
35+
title: "chore(nix): update flake lockfile"
36+
body: |
37+
Automated flake lockfile update via `nix flake update`.
38+
39+
This PR was created by the scheduled update-flake workflow.
40+
Please review CI results before merging.
41+
branch: automation/update-flake-lock
42+
delete-branch: true
43+
labels: dependencies, automated

simplex-method.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ test-suite simplex-haskell-test
6666
main-is: Spec.hs
6767
other-modules:
6868
Linear.Simplex.Solver.TwoPhaseSpec
69+
Linear.Simplex.UtilSpec
6970
Paths_simplex_method
7071
hs-source-dirs:
7172
test

0 commit comments

Comments
 (0)