Skip to content

Commit d43879b

Browse files
committed
chore(ci): switch CI to nix
1 parent d85cdc1 commit d43879b

File tree

12 files changed

+650
-238
lines changed

12 files changed

+650
-238
lines changed

.github/actionlint.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
self-hosted-runner:
2+
labels:
3+
- nix
4+
- nixos

.github/workflows/ci.yml

Lines changed: 91 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- msrv-build
2020
- code-quality
2121
- python-api
22-
- docs
22+
- doc
2323
- cadical-each-feature
2424
- kissat-each-feature
2525
- cadical-valgrind
@@ -35,7 +35,7 @@ jobs:
3535
echo "🏗️ MSRV build: ${{ needs.msrv-build.result }}"
3636
echo "✨ Code Quality: ${{ needs.code-quality.result }}"
3737
echo "🐍 Python API: ${{ needs.python-api.result }}"
38-
echo "📑 Check documentation: ${{ needs.docs.result }}"
38+
echo "📑 Check documentation: ${{ needs.doc.result }}"
3939
echo "🧪 CaDiCaL test each feature: ${{ needs.cadical-each-feature.result }}"
4040
echo "🧪 Kissat test each feature: ${{ needs.kissat-each-feature.result }}"
4141
echo "🤖 CaDiCaL Valgrind: ${{ needs.cadical-valgrind.result }}"
@@ -55,7 +55,7 @@ jobs:
5555
run: exit 1
5656
- if: ${{ needs.python-api.result != 'success' }}
5757
run: exit 1
58-
- if: ${{ needs.docs.result != 'success' }}
58+
- if: ${{ needs.doc.result != 'success' }}
5959
run: exit 1
6060
- if: ${{ needs.cadical-each-feature.result == 'failure' }}
6161
run: exit 1
@@ -71,114 +71,167 @@ jobs:
7171
run: exit 1
7272
- if: ${{ needs.capi-valgrind.result == 'failure' }}
7373
run: exit 1
74+
dev-deps:
75+
name: 🏗️ Dev dependencies
76+
runs-on: [self-hosted, nix]
77+
steps:
78+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
79+
- name: 🏗️ Build dev dependencies
80+
run: nix build .#devDeps
7481
tests:
7582
name: 🧪 Workspace tests
76-
runs-on: self-hosted
83+
runs-on: [self-hosted, nix]
84+
needs:
85+
- dev-deps
7786
steps:
7887
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
7988
- name: 🧪 Run tests
80-
run: just test-ci
89+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').tests"
90+
- name: 🧪 Run tests for external solver CaDiCaL
91+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').externalCadical"
92+
- name: 🧪 Run tests for external solver Kissat
93+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').externalKissat"
94+
- name: 🧪 Run tests for external solver Gimsatul
95+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').externalGimsatul"
8196
msrv-build:
8297
name: 🏗️ MSRV build
83-
runs-on: self-hosted
98+
runs-on: [self-hosted, nix]
8499
steps:
85100
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
86-
- name: 🏗️ Build
87-
run: just msrv-ci
101+
- name: 🏗️ Check MSRV builds
102+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').msrv"
88103
code-quality:
89104
name: ✨ Code Quality
90-
runs-on: self-hosted
105+
runs-on: [self-hosted, nix]
106+
needs:
107+
- dev-deps
91108
steps:
92109
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
93-
- name: ✨ Run code quality checks
94-
run: just code-quality-ci
110+
- name: ✨ Check formatting
111+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').treefmt"
112+
- name: ✨ Check typos
113+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').typos"
114+
- name: ✨ Check spelling
115+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').spellcheck"
116+
- name: ✨ Check generated readmes
117+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').readmes"
118+
- name: ✨ Check generated code
119+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').codegen"
95120
python-api:
96121
name: 🐍 Python API
97-
runs-on: self-hosted
122+
runs-on: [self-hosted, nix]
98123
steps:
99124
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
100-
- name: ✨ Run Python API checks
101-
run: just python-api-ci
102-
docs:
125+
- uses: actions/checkout@v4
126+
- name: ✨ Build Python API and check
127+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').pyapi"
128+
doc:
103129
name: 📑 Check documentation
104-
runs-on: self-hosted
130+
runs-on: [self-hosted, nix]
131+
needs:
132+
- dev-deps
105133
steps:
106134
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
107-
- name: ✨ Run docs checks
108-
run: just docs-ci
135+
- uses: actions/checkout@v4
136+
- name: ✨ Build doc
137+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').doc"
138+
- name: 🧪 Run doc tests
139+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').docTests"
109140
coverage:
110141
name: 📋 Test coverage
111-
runs-on: self-hosted
142+
runs-on: [self-hosted, nix]
143+
needs:
144+
- tests
145+
- doc
112146
steps:
113147
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
114-
- name: ✨ Generate coverage report
115-
run: just coverage-ci
148+
- name: ✨ Collect coverage reports
149+
run: nix build .#testCoverage
150+
- run: ls result
116151
- name: ✨ Publish to Coveralls
117-
uses: coverallsapp/github-action@master
152+
uses: coverallsapp/github-action@v2.3.6
118153
with:
119154
github-token: ${{ secrets.GITHUB_TOKEN }}
155+
format: lcov
156+
files: result/tests.lcov result/external-cadical.lcov
120157
# TODO: Kani
121158
feature-powerset:
122159
name: 🔌 Test feature powerset
123-
runs-on: self-hosted
160+
runs-on: [self-hosted, nix]
161+
needs:
162+
- dev-deps
124163
if: contains(github.event.pull_request.labels.*.name, 'heavy-tests')
125164
steps:
126165
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
127166
- name: ✨ Run feature powerset checks
128-
run: just feature-powerset-ci
167+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').featurePowerset"
129168
cadical-each-feature:
130169
name: 🧪 CaDiCaL test each feature
131-
runs-on: self-hosted
170+
runs-on: [self-hosted, nix]
171+
needs:
172+
- dev-deps
132173
if: contains(github.event.pull_request.labels.*.name, 'solvers/cadical')
133174
steps:
134175
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
135176
- name: 🧪 Test each feature
136-
run: just cadical-each-feature-ci
177+
run: nix develop ".#ci" --command cargo hack --each-feature --exclude-features logging nextest run -p rustsat-cadical
137178
kissat-each-feature:
138179
name: 🧪 Kissat test each feature
139-
runs-on: self-hosted
180+
runs-on: [self-hosted, nix]
181+
needs:
182+
- dev-deps
140183
if: contains(github.event.pull_request.labels.*.name, 'solvers/kissat')
141184
steps:
142185
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
143186
- name: 🧪 Test each feature
144-
run: just kissat-each-feature-ci
187+
run: nix develop ".#ci" --command cargo hack --each-feature nextest run -p rustsat-kissat
145188
cadical-valgrind:
146189
name: 🤖 CaDiCaL Valgrind
147-
runs-on: self-hosted
190+
runs-on: [self-hosted, nix]
191+
needs:
192+
- dev-deps
148193
if: contains(github.event.pull_request.labels.*.name, 'solvers/cadical')
149194
steps:
150195
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
151196
- name: 🧪 Tests through valgrind
152-
run: just cadical-valgrind-ci
197+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').cadicalValgrind"
153198
kissat-valgrind:
154199
name: 🤖 Kissat Valgrind
155-
runs-on: self-hosted
200+
runs-on: [self-hosted, nix]
201+
needs:
202+
- dev-deps
156203
if: contains(github.event.pull_request.labels.*.name, 'solvers/kissat')
157204
steps:
158205
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
159206
- name: 🧪 Tests through valgrind
160-
run: just kissat-valgrind-ci
207+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').kissatValgrind"
161208
minisat-valgrind:
162209
name: 🤖 Minisat Valgrind
163-
runs-on: self-hosted
210+
runs-on: [self-hosted, nix]
211+
needs:
212+
- dev-deps
164213
if: contains(github.event.pull_request.labels.*.name, 'solvers/minisat')
165214
steps:
166215
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
167216
- name: 🧪 Tests through valgrind
168-
run: just minisat-valgrind-ci
217+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').minisatValgrind"
169218
glucose-valgrind:
170219
name: 🤖 Glucose Valgrind
171-
runs-on: self-hosted
220+
runs-on: [self-hosted, nix]
221+
needs:
222+
- dev-deps
172223
if: contains(github.event.pull_request.labels.*.name, 'solvers/glucose')
173224
steps:
174225
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
175226
- name: 🧪 Tests through valgrind
176-
run: just glucose-valgrind-ci
227+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').glucoseValgrind"
177228
capi-valgrind:
178229
name: 🤖 C-API Valgrind
179-
runs-on: self-hosted
230+
runs-on: [self-hosted, nix]
231+
needs:
232+
- dev-deps
180233
if: contains(github.event.pull_request.labels.*.name, 'c-api')
181234
steps:
182235
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
183236
- name: 🧪 Tests through valgrind
184-
run: just capi-valgrind-ci
237+
run: nix build ".#checks.$(nix eval --impure --expr 'builtins.currentSystem').capiValgrind"

.github/workflows/labeler.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ jobs:
66
permissions:
77
contents: read
88
pull-requests: write
9-
runs-on: self-hosted
9+
issues: write
10+
runs-on: ubuntu-latest
1011
steps:
1112
- uses: actions/labeler@v5

.github/workflows/pages.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ concurrency:
1515
jobs:
1616
# Build job
1717
build:
18-
runs-on: self-hosted
18+
runs-on: [self-hosted, nix]
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2222
- name: 🏗️ Build pages
23-
run: just pages-ci
23+
run: nix build .#pages
2424
- name: ⬆️ Upload artifact
25-
# Automatically uploads an artifact from the './_site' directory by default
2625
uses: actions/upload-pages-artifact@v3
26+
with:
27+
path: result/
2728
# Deployment job
2829
deploy:
2930
environment:

.github/workflows/semver-checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ env:
88
jobs:
99
all:
1010
name: 🛡️ Semver checks
11-
runs-on: self-hosted
11+
runs-on: [self-hosted, nix]
1212
steps:
1313
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
1414
- name: 🛡️ Run semver checks
15-
run: just semver-checks-ci
15+
run: nix run nixpkgs#just semver-checks

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/target
2+
/target-ci
3+
4+
/result
25

36
**/*.o
47
**/*.out

flake.lock

Lines changed: 22 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)