Skip to content

Commit e8ed284

Browse files
authored
Merge pull request #35 from MetaRocq/nix-CI
Nix CI
2 parents f06f22d + 1f13595 commit e8ed284

File tree

20 files changed

+871
-97
lines changed

20 files changed

+871
-97
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 329 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,329 @@
1+
jobs:
2+
ceres:
3+
needs:
4+
- coq
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Determine which commit to initially checkout
8+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{
9+
github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha
10+
}}\" >> $GITHUB_ENV\nfi\n"
11+
- name: Git checkout
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
ref: ${{ env.target_commit }}
16+
- name: Determine which commit to test
17+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{
18+
github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url
19+
}} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git
20+
merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null
21+
2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\
22+
\ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha
23+
}}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\
24+
\ fi\nfi\n"
25+
- name: Git checkout
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
ref: ${{ env.tested_commit }}
30+
- name: Cachix install
31+
uses: cachix/install-nix-action@v30
32+
with:
33+
nix_path: nixpkgs=channel:nixpkgs-unstable
34+
- name: Cachix setup metarocq
35+
uses: cachix/cachix-action@v15
36+
with:
37+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
38+
extraPullNames: coq, coq-community, math-comp
39+
name: metarocq
40+
- id: stepGetDerivation
41+
name: Getting derivation for current job (ceres)
42+
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
43+
\"default\" --argstr job \"ceres\" \\\n --dry-run 2> err > out || (touch
44+
fail; true)\n"
45+
- name: Error reporting
46+
run: "echo \"out=\"; cat out\necho \"err=\"; cat err\n"
47+
- name: Failure check
48+
run: if [ -e fail ]; then exit 1; else exit 0; fi;
49+
- id: stepCheck
50+
name: Checking presence of CI target for current job
51+
run: (echo -n status=; cat out err | grep "built:" | sed "s/.*/built/") >> $GITHUB_OUTPUT
52+
- if: steps.stepCheck.outputs.status == 'built'
53+
name: 'Building/fetching previous CI target: coq'
54+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
55+
--argstr job "coq"
56+
- if: steps.stepCheck.outputs.status == 'built'
57+
name: 'Building/fetching previous CI target: stdlib'
58+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
59+
--argstr job "stdlib"
60+
- if: steps.stepCheck.outputs.status == 'built'
61+
name: Building/fetching current CI target
62+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
63+
--argstr job "ceres"
64+
coq:
65+
needs: []
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Determine which commit to initially checkout
69+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{
70+
github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha
71+
}}\" >> $GITHUB_ENV\nfi\n"
72+
- name: Git checkout
73+
uses: actions/checkout@v4
74+
with:
75+
fetch-depth: 0
76+
ref: ${{ env.target_commit }}
77+
- name: Determine which commit to test
78+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{
79+
github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url
80+
}} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git
81+
merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null
82+
2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\
83+
\ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha
84+
}}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\
85+
\ fi\nfi\n"
86+
- name: Git checkout
87+
uses: actions/checkout@v4
88+
with:
89+
fetch-depth: 0
90+
ref: ${{ env.tested_commit }}
91+
- name: Cachix install
92+
uses: cachix/install-nix-action@v30
93+
with:
94+
nix_path: nixpkgs=channel:nixpkgs-unstable
95+
- name: Cachix setup metarocq
96+
uses: cachix/cachix-action@v15
97+
with:
98+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
99+
extraPullNames: coq, coq-community, math-comp
100+
name: metarocq
101+
- id: stepGetDerivation
102+
name: Getting derivation for current job (coq)
103+
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
104+
\"default\" --argstr job \"coq\" \\\n --dry-run 2> err > out || (touch fail;
105+
true)\n"
106+
- name: Error reporting
107+
run: "echo \"out=\"; cat out\necho \"err=\"; cat err\n"
108+
- name: Failure check
109+
run: if [ -e fail ]; then exit 1; else exit 0; fi;
110+
- id: stepCheck
111+
name: Checking presence of CI target for current job
112+
run: (echo -n status=; cat out err | grep "built:" | sed "s/.*/built/") >> $GITHUB_OUTPUT
113+
- if: steps.stepCheck.outputs.status == 'built'
114+
name: Building/fetching current CI target
115+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
116+
--argstr job "coq"
117+
equations:
118+
needs:
119+
- coq
120+
runs-on: ubuntu-latest
121+
steps:
122+
- name: Determine which commit to initially checkout
123+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{
124+
github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha
125+
}}\" >> $GITHUB_ENV\nfi\n"
126+
- name: Git checkout
127+
uses: actions/checkout@v4
128+
with:
129+
fetch-depth: 0
130+
ref: ${{ env.target_commit }}
131+
- name: Determine which commit to test
132+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{
133+
github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url
134+
}} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git
135+
merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null
136+
2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\
137+
\ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha
138+
}}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\
139+
\ fi\nfi\n"
140+
- name: Git checkout
141+
uses: actions/checkout@v4
142+
with:
143+
fetch-depth: 0
144+
ref: ${{ env.tested_commit }}
145+
- name: Cachix install
146+
uses: cachix/install-nix-action@v30
147+
with:
148+
nix_path: nixpkgs=channel:nixpkgs-unstable
149+
- name: Cachix setup metarocq
150+
uses: cachix/cachix-action@v15
151+
with:
152+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
153+
extraPullNames: coq, coq-community, math-comp
154+
name: metarocq
155+
- id: stepGetDerivation
156+
name: Getting derivation for current job (equations)
157+
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
158+
\"default\" --argstr job \"equations\" \\\n --dry-run 2> err > out || (touch
159+
fail; true)\n"
160+
- name: Error reporting
161+
run: "echo \"out=\"; cat out\necho \"err=\"; cat err\n"
162+
- name: Failure check
163+
run: if [ -e fail ]; then exit 1; else exit 0; fi;
164+
- id: stepCheck
165+
name: Checking presence of CI target for current job
166+
run: (echo -n status=; cat out err | grep "built:" | sed "s/.*/built/") >> $GITHUB_OUTPUT
167+
- if: steps.stepCheck.outputs.status == 'built'
168+
name: 'Building/fetching previous CI target: coq'
169+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
170+
--argstr job "coq"
171+
- if: steps.stepCheck.outputs.status == 'built'
172+
name: 'Building/fetching previous CI target: stdlib'
173+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
174+
--argstr job "stdlib"
175+
- if: steps.stepCheck.outputs.status == 'built'
176+
name: Building/fetching current CI target
177+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
178+
--argstr job "equations"
179+
metarocq:
180+
needs:
181+
- coq
182+
- equations
183+
runs-on: ubuntu-latest
184+
steps:
185+
- name: Determine which commit to initially checkout
186+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{
187+
github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha
188+
}}\" >> $GITHUB_ENV\nfi\n"
189+
- name: Git checkout
190+
uses: actions/checkout@v4
191+
with:
192+
fetch-depth: 0
193+
ref: ${{ env.target_commit }}
194+
- name: Determine which commit to test
195+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{
196+
github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url
197+
}} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git
198+
merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null
199+
2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\
200+
\ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha
201+
}}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\
202+
\ fi\nfi\n"
203+
- name: Git checkout
204+
uses: actions/checkout@v4
205+
with:
206+
fetch-depth: 0
207+
ref: ${{ env.tested_commit }}
208+
- name: Cachix install
209+
uses: cachix/install-nix-action@v30
210+
with:
211+
nix_path: nixpkgs=channel:nixpkgs-unstable
212+
- name: Cachix setup metarocq
213+
uses: cachix/cachix-action@v15
214+
with:
215+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
216+
extraPullNames: coq, coq-community, math-comp
217+
name: metarocq
218+
- id: stepGetDerivation
219+
name: Getting derivation for current job (metarocq)
220+
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
221+
\"default\" --argstr job \"metarocq\" \\\n --dry-run 2> err > out || (touch
222+
fail; true)\n"
223+
- name: Error reporting
224+
run: "echo \"out=\"; cat out\necho \"err=\"; cat err\n"
225+
- name: Failure check
226+
run: if [ -e fail ]; then exit 1; else exit 0; fi;
227+
- id: stepCheck
228+
name: Checking presence of CI target for current job
229+
run: (echo -n status=; cat out err | grep "built:" | sed "s/.*/built/") >> $GITHUB_OUTPUT
230+
- if: steps.stepCheck.outputs.status == 'built'
231+
name: 'Building/fetching previous CI target: coq'
232+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
233+
--argstr job "coq"
234+
- if: steps.stepCheck.outputs.status == 'built'
235+
name: 'Building/fetching previous CI target: equations'
236+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
237+
--argstr job "equations"
238+
- if: steps.stepCheck.outputs.status == 'built'
239+
name: Building/fetching current CI target
240+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
241+
--argstr job "metarocq"
242+
verified-extraction:
243+
needs:
244+
- coq
245+
- equations
246+
- metarocq
247+
- ceres
248+
runs-on: ubuntu-latest
249+
steps:
250+
- name: Determine which commit to initially checkout
251+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{
252+
github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha
253+
}}\" >> $GITHUB_ENV\nfi\n"
254+
- name: Git checkout
255+
uses: actions/checkout@v4
256+
with:
257+
fetch-depth: 0
258+
ref: ${{ env.target_commit }}
259+
- name: Determine which commit to test
260+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{
261+
github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url
262+
}} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git
263+
merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null
264+
2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\
265+
\ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha
266+
}}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\
267+
\ fi\nfi\n"
268+
- name: Git checkout
269+
uses: actions/checkout@v4
270+
with:
271+
fetch-depth: 0
272+
ref: ${{ env.tested_commit }}
273+
- name: Cachix install
274+
uses: cachix/install-nix-action@v30
275+
with:
276+
nix_path: nixpkgs=channel:nixpkgs-unstable
277+
- name: Cachix setup metarocq
278+
uses: cachix/cachix-action@v15
279+
with:
280+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
281+
extraPullNames: coq, coq-community, math-comp
282+
name: metarocq
283+
- id: stepGetDerivation
284+
name: Getting derivation for current job (verified-extraction)
285+
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
286+
\"default\" --argstr job \"verified-extraction\" \\\n --dry-run 2> err >
287+
out || (touch fail; true)\n"
288+
- name: Error reporting
289+
run: "echo \"out=\"; cat out\necho \"err=\"; cat err\n"
290+
- name: Failure check
291+
run: if [ -e fail ]; then exit 1; else exit 0; fi;
292+
- id: stepCheck
293+
name: Checking presence of CI target for current job
294+
run: (echo -n status=; cat out err | grep "built:" | sed "s/.*/built/") >> $GITHUB_OUTPUT
295+
- if: steps.stepCheck.outputs.status == 'built'
296+
name: 'Building/fetching previous CI target: coq'
297+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
298+
--argstr job "coq"
299+
- if: steps.stepCheck.outputs.status == 'built'
300+
name: 'Building/fetching previous CI target: equations'
301+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
302+
--argstr job "equations"
303+
- if: steps.stepCheck.outputs.status == 'built'
304+
name: 'Building/fetching previous CI target: metarocq'
305+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
306+
--argstr job "metarocq"
307+
- if: steps.stepCheck.outputs.status == 'built'
308+
name: 'Building/fetching previous CI target: ceres'
309+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
310+
--argstr job "ceres"
311+
- if: steps.stepCheck.outputs.status == 'built'
312+
name: Building/fetching current CI target
313+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
314+
--argstr job "verified-extraction"
315+
name: Nix CI for bundle default
316+
on:
317+
pull_request:
318+
paths:
319+
- .github/workflows/nix-action-default.yml
320+
pull_request_target:
321+
paths-ignore:
322+
- .github/workflows/nix-action-default.yml
323+
types:
324+
- opened
325+
- synchronize
326+
- reopened
327+
push:
328+
branches:
329+
- master

0 commit comments

Comments
 (0)