Skip to content

Commit ac88008

Browse files
committed
Better config for CI builds?
1 parent 21f1384 commit ac88008

File tree

5 files changed

+1335
-9
lines changed

5 files changed

+1335
-9
lines changed
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
jobs:
2+
coq:
3+
needs:
4+
- rocq-core
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@v6
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@v6
27+
with:
28+
fetch-depth: 0
29+
ref: ${{ env.tested_commit }}
30+
- name: Cachix install
31+
uses: cachix/install-nix-action@v31
32+
with:
33+
nix_path: nixpkgs=channel:nixpkgs-unstable
34+
- name: Cachix setup metacoq
35+
uses: cachix/cachix-action@v16
36+
with:
37+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
38+
extraPullNames: coq, coq-community
39+
name: metacoq
40+
- id: stepGetDerivation
41+
name: Getting derivation for current job (coq)
42+
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
43+
\"rocq-9.1\" --argstr job \"coq\" \\\n --dry-run 2> err > out || (touch
44+
fail; true)\ncat out err\nif [ -e fail ]; then echo \"Error: getting derivation
45+
failed\"; exit 1; fi\n"
46+
- id: stepCheck
47+
name: Checking presence of CI target for current job
48+
run: "if $(cat out err | grep -q \"built:\") ; then\n echo \"CI target needs
49+
actual building\"\n if $(cat out err | grep -q \"derivations will be built:\"\
50+
) ; then\n echo \"waiting a bit for derivations that should be in cache\"\
51+
\n sleep 30\n fi\nelse\n echo \"CI target already built\"\n echo \"\
52+
status=fetched\" >> $GITHUB_OUTPUT\nfi\n"
53+
- if: steps.stepCheck.outputs.status != 'fetched'
54+
name: 'Building/fetching previous CI target: rocq-core'
55+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
56+
"rocq-9.1" --argstr job "rocq-core"
57+
- if: steps.stepCheck.outputs.status != 'fetched'
58+
name: Building/fetching current CI target
59+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
60+
"rocq-9.1" --argstr job "coq"
61+
metarocq:
62+
needs:
63+
- coq
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Determine which commit to initially checkout
67+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{
68+
github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha
69+
}}\" >> $GITHUB_ENV\nfi\n"
70+
- name: Git checkout
71+
uses: actions/checkout@v6
72+
with:
73+
fetch-depth: 0
74+
ref: ${{ env.target_commit }}
75+
- name: Determine which commit to test
76+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{
77+
github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url
78+
}} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git
79+
merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null
80+
2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\
81+
\ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha
82+
}}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\
83+
\ fi\nfi\n"
84+
- name: Git checkout
85+
uses: actions/checkout@v6
86+
with:
87+
fetch-depth: 0
88+
ref: ${{ env.tested_commit }}
89+
- name: Cachix install
90+
uses: cachix/install-nix-action@v31
91+
with:
92+
nix_path: nixpkgs=channel:nixpkgs-unstable
93+
- name: Cachix setup metacoq
94+
uses: cachix/cachix-action@v16
95+
with:
96+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
97+
extraPullNames: coq, coq-community
98+
name: metacoq
99+
- id: stepGetDerivation
100+
name: Getting derivation for current job (metarocq)
101+
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
102+
\"rocq-9.1\" --argstr job \"metarocq\" \\\n --dry-run 2> err > out || (touch
103+
fail; true)\ncat out err\nif [ -e fail ]; then echo \"Error: getting derivation
104+
failed\"; exit 1; fi\n"
105+
- id: stepCheck
106+
name: Checking presence of CI target for current job
107+
run: "if $(cat out err | grep -q \"built:\") ; then\n echo \"CI target needs
108+
actual building\"\n if $(cat out err | grep -q \"derivations will be built:\"\
109+
) ; then\n echo \"waiting a bit for derivations that should be in cache\"\
110+
\n sleep 30\n fi\nelse\n echo \"CI target already built\"\n echo \"\
111+
status=fetched\" >> $GITHUB_OUTPUT\nfi\n"
112+
- if: steps.stepCheck.outputs.status != 'fetched'
113+
name: 'Building/fetching previous CI target: coq'
114+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
115+
"rocq-9.1" --argstr job "coq"
116+
- if: steps.stepCheck.outputs.status != 'fetched'
117+
name: 'Building/fetching previous CI target: equations'
118+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
119+
"rocq-9.1" --argstr job "equations"
120+
- if: steps.stepCheck.outputs.status != 'fetched'
121+
name: 'Building/fetching previous CI target: stdlib'
122+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
123+
"rocq-9.1" --argstr job "stdlib"
124+
- if: steps.stepCheck.outputs.status != 'fetched'
125+
name: 'Building/fetching previous CI target: metarocq-safechecker-plugin'
126+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
127+
"rocq-9.1" --argstr job "metarocq-safechecker-plugin"
128+
- if: steps.stepCheck.outputs.status != 'fetched'
129+
name: 'Building/fetching previous CI target: metarocq-erasure-plugin'
130+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
131+
"rocq-9.1" --argstr job "metarocq-erasure-plugin"
132+
- if: steps.stepCheck.outputs.status != 'fetched'
133+
name: 'Building/fetching previous CI target: metarocq-translations'
134+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
135+
"rocq-9.1" --argstr job "metarocq-translations"
136+
- if: steps.stepCheck.outputs.status != 'fetched'
137+
name: 'Building/fetching previous CI target: metarocq-quotation'
138+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
139+
"rocq-9.1" --argstr job "metarocq-quotation"
140+
- if: steps.stepCheck.outputs.status != 'fetched'
141+
name: Building/fetching current CI target
142+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
143+
"rocq-9.1" --argstr job "metarocq"
144+
rocq-core:
145+
needs: []
146+
runs-on: ubuntu-latest
147+
steps:
148+
- name: Determine which commit to initially checkout
149+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{
150+
github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha
151+
}}\" >> $GITHUB_ENV\nfi\n"
152+
- name: Git checkout
153+
uses: actions/checkout@v6
154+
with:
155+
fetch-depth: 0
156+
ref: ${{ env.target_commit }}
157+
- name: Determine which commit to test
158+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{
159+
github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url
160+
}} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git
161+
merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null
162+
2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\
163+
\ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha
164+
}}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\
165+
\ fi\nfi\n"
166+
- name: Git checkout
167+
uses: actions/checkout@v6
168+
with:
169+
fetch-depth: 0
170+
ref: ${{ env.tested_commit }}
171+
- name: Cachix install
172+
uses: cachix/install-nix-action@v31
173+
with:
174+
nix_path: nixpkgs=channel:nixpkgs-unstable
175+
- name: Cachix setup metacoq
176+
uses: cachix/cachix-action@v16
177+
with:
178+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
179+
extraPullNames: coq, coq-community
180+
name: metacoq
181+
- id: stepGetDerivation
182+
name: Getting derivation for current job (rocq-core)
183+
run: "NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle
184+
\"rocq-9.1\" --argstr job \"rocq-core\" \\\n --dry-run 2> err > out || (touch
185+
fail; true)\ncat out err\nif [ -e fail ]; then echo \"Error: getting derivation
186+
failed\"; exit 1; fi\n"
187+
- id: stepCheck
188+
name: Checking presence of CI target for current job
189+
run: "if $(cat out err | grep -q \"built:\") ; then\n echo \"CI target needs
190+
actual building\"\n if $(cat out err | grep -q \"derivations will be built:\"\
191+
) ; then\n echo \"waiting a bit for derivations that should be in cache\"\
192+
\n sleep 30\n fi\nelse\n echo \"CI target already built\"\n echo \"\
193+
status=fetched\" >> $GITHUB_OUTPUT\nfi\n"
194+
- if: steps.stepCheck.outputs.status != 'fetched'
195+
name: Building/fetching current CI target
196+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle
197+
"rocq-9.1" --argstr job "rocq-core"
198+
name: Nix CI for bundle rocq-9.1
199+
on:
200+
pull_request:
201+
paths:
202+
- .github/workflows/nix-action-rocq-9.1.yml
203+
branches:
204+
- '9.1'
205+
pull_request_target:
206+
paths-ignore:
207+
- .github/workflows/nix-action-rocq-9.1.yml
208+
types:
209+
- opened
210+
- synchronize
211+
- reopened
212+
branches:
213+
- '9.1'
214+
push:
215+
branches:
216+
- '9.1'

0 commit comments

Comments
 (0)