Skip to content

Commit abb2045

Browse files
committed
Add Coq Nix Toolbox-based CI to test CoqEAL.
Closes rocq-community#74.
1 parent 4c8364f commit abb2045

File tree

4 files changed

+266
-0
lines changed

4 files changed

+266
-0
lines changed
+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
jobs:
2+
coq:
3+
needs: []
4+
runs-on: ubuntu-latest
5+
steps:
6+
- name: Determine which ref to test
7+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_ref=${{\
8+
\ github.ref }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{\
9+
\ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge\
10+
\ | cut -f1)\n if [ -z \"$merge_commit\" ]; then\n echo \"tested_ref=refs/pull/${{\
11+
\ github.event.number }}/head\" >> $GITHUB_ENV\n else\n echo \"tested_ref=refs/pull/${{\
12+
\ github.event.number }}/merge\" >> $GITHUB_ENV\n fi\nfi\n"
13+
- name: Git checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
ref: ${{ env.tested_ref }}
18+
- name: Cachix install
19+
uses: cachix/install-nix-action@v12
20+
with:
21+
nix_path: nixpkgs=channel:nixpkgs-unstable
22+
- name: Cachix setup coq
23+
uses: cachix/cachix-action@v8
24+
with:
25+
name: coq
26+
- name: Cachix setup coq-community
27+
uses: cachix/cachix-action@v8
28+
with:
29+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
30+
name: coq-community
31+
- name: Cachix setup math-comp
32+
uses: cachix/cachix-action@v8
33+
with:
34+
name: math-comp
35+
- id: stepCheck
36+
name: Checking presence of CI target coq
37+
run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr\
38+
\ bundle \"default\" --argstr job \"coq\" \\\n --dry-run 2>&1 > /dev/null)\n\
39+
echo ::set-output name=status::$(echo $nb_dry_run | grep \"built:\" | sed\
40+
\ \"s/.*/built/\")\n"
41+
- if: steps.stepCheck.outputs.status == 'built'
42+
name: Building/fetching current CI target
43+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
44+
--argstr job "coq"
45+
coqeal:
46+
needs:
47+
- coq
48+
- paramcoq
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Determine which ref to test
52+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_ref=${{\
53+
\ github.ref }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{\
54+
\ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge\
55+
\ | cut -f1)\n if [ -z \"$merge_commit\" ]; then\n echo \"tested_ref=refs/pull/${{\
56+
\ github.event.number }}/head\" >> $GITHUB_ENV\n else\n echo \"tested_ref=refs/pull/${{\
57+
\ github.event.number }}/merge\" >> $GITHUB_ENV\n fi\nfi\n"
58+
- name: Git checkout
59+
uses: actions/checkout@v2
60+
with:
61+
fetch-depth: 0
62+
ref: ${{ env.tested_ref }}
63+
- name: Cachix install
64+
uses: cachix/install-nix-action@v12
65+
with:
66+
nix_path: nixpkgs=channel:nixpkgs-unstable
67+
- name: Cachix setup coq
68+
uses: cachix/cachix-action@v8
69+
with:
70+
name: coq
71+
- name: Cachix setup coq-community
72+
uses: cachix/cachix-action@v8
73+
with:
74+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
75+
name: coq-community
76+
- name: Cachix setup math-comp
77+
uses: cachix/cachix-action@v8
78+
with:
79+
name: math-comp
80+
- id: stepCheck
81+
name: Checking presence of CI target coqeal
82+
run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr\
83+
\ bundle \"default\" --argstr job \"coqeal\" \\\n --dry-run 2>&1 > /dev/null)\n\
84+
echo ::set-output name=status::$(echo $nb_dry_run | grep \"built:\" | sed\
85+
\ \"s/.*/built/\")\n"
86+
- if: steps.stepCheck.outputs.status == 'built'
87+
name: 'Building/fetching previous CI target: coq'
88+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
89+
--argstr job "coq"
90+
- if: steps.stepCheck.outputs.status == 'built'
91+
name: 'Building/fetching previous CI target: paramcoq'
92+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
93+
--argstr job "paramcoq"
94+
- if: steps.stepCheck.outputs.status == 'built'
95+
name: Building/fetching current CI target
96+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
97+
--argstr job "coqeal"
98+
paramcoq:
99+
needs:
100+
- coq
101+
runs-on: ubuntu-latest
102+
steps:
103+
- name: Determine which ref to test
104+
run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_ref=${{\
105+
\ github.ref }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{\
106+
\ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge\
107+
\ | cut -f1)\n if [ -z \"$merge_commit\" ]; then\n echo \"tested_ref=refs/pull/${{\
108+
\ github.event.number }}/head\" >> $GITHUB_ENV\n else\n echo \"tested_ref=refs/pull/${{\
109+
\ github.event.number }}/merge\" >> $GITHUB_ENV\n fi\nfi\n"
110+
- name: Git checkout
111+
uses: actions/checkout@v2
112+
with:
113+
fetch-depth: 0
114+
ref: ${{ env.tested_ref }}
115+
- name: Cachix install
116+
uses: cachix/install-nix-action@v12
117+
with:
118+
nix_path: nixpkgs=channel:nixpkgs-unstable
119+
- name: Cachix setup coq
120+
uses: cachix/cachix-action@v8
121+
with:
122+
name: coq
123+
- name: Cachix setup coq-community
124+
uses: cachix/cachix-action@v8
125+
with:
126+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
127+
name: coq-community
128+
- name: Cachix setup math-comp
129+
uses: cachix/cachix-action@v8
130+
with:
131+
name: math-comp
132+
- id: stepCheck
133+
name: Checking presence of CI target paramcoq
134+
run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr\
135+
\ bundle \"default\" --argstr job \"paramcoq\" \\\n --dry-run 2>&1 > /dev/null)\n\
136+
echo ::set-output name=status::$(echo $nb_dry_run | grep \"built:\" | sed\
137+
\ \"s/.*/built/\")\n"
138+
- if: steps.stepCheck.outputs.status == 'built'
139+
name: 'Building/fetching previous CI target: coq'
140+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
141+
--argstr job "coq"
142+
- if: steps.stepCheck.outputs.status == 'built'
143+
name: Building/fetching current CI target
144+
run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "default"
145+
--argstr job "paramcoq"
146+
name: Nix CI for bundle default
147+
'on':
148+
pull_request:
149+
paths:
150+
- .github/workflows/**
151+
pull_request_target:
152+
types:
153+
- opened
154+
- synchronize
155+
- reopened
156+
push:
157+
branches:
158+
- master

.nix/config.nix

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
## DO NOT CHANGE THIS
3+
format = "1.0.0";
4+
## unless you made an automated or manual update
5+
## to another supported format.
6+
7+
## The attribute to build from the local sources,
8+
## either using nixpkgs data or the overlays located in `.nix/coq-overlays`
9+
## Will determine the default main-job of the bundles defined below
10+
attribute = "paramcoq";
11+
12+
## If you want to select a different attribute (to build from the local sources as well)
13+
## when calling `nix-shell` and `nix-build` without the `--argstr job` argument
14+
# shell-attribute = "{{nix_name}}";
15+
16+
## Maybe the shortname of the library is different from
17+
## the name of the nixpkgs attribute, if so, set it here:
18+
# pname = "{{shortname}}";
19+
20+
## Lists the dependencies, phrased in terms of nix attributes.
21+
## No need to list Coq, it is already included.
22+
## These dependencies will systematically be added to the currently
23+
## known dependencies, if any more than Coq.
24+
## /!\ Remove this field as soon as the package is available on nixpkgs.
25+
## /!\ Manual overlays in `.nix/coq-overlays` should be preferred then.
26+
# buildInputs = [ ];
27+
28+
## Indicate the relative location of your _CoqProject
29+
## If not specified, it defaults to "_CoqProject"
30+
# coqproject = "_CoqProject";
31+
32+
## select an entry to build in the following `bundles` set
33+
## defaults to "default"
34+
default-bundle = "default";
35+
36+
## write one `bundles.name` attribute set per
37+
## alternative configuration
38+
## When generating GitHub Action CI, one workflow file
39+
## will be created per bundle
40+
bundles.default = {
41+
42+
## You can override Coq and other Coq coqPackages
43+
## through the following attribute
44+
coqPackages.coq.override.version = "master";
45+
coqPackages.coqeal.override.version = "master";
46+
47+
## In some cases, light overrides are not available/enough
48+
## in which case you can use either
49+
# coqPackages.<coq-pkg>.overrideAttrs = o: <overrides>;
50+
## or a "long" overlay to put in `.nix/coq-overlays
51+
## you may use `nix-shell --run fetchOverlay <coq-pkg>`
52+
## to automatically retrieve the one from nixpkgs
53+
## if it exists and is correctly named/located
54+
55+
## You can override Coq and other coqPackages
56+
## through the following attribute
57+
## If <ocaml-pkg> does not support light overrides,
58+
## you may use `overrideAttrs` or long overlays
59+
## located in `.nix/ocaml-overlays`
60+
## (there is no automation for this one)
61+
# ocamlPackages.<ocaml-pkg>.override.version = "x.xx";
62+
63+
## You can also override packages from the nixpkgs toplevel
64+
# <nix-pkg>.override.overrideAttrs = o: <overrides>;
65+
## Or put an overlay in `.nix/overlays`
66+
67+
## you may mark a package as a main CI job (one to take deps and
68+
## rev deps from) as follows
69+
# coqPackages.<main-pkg>.main-job = true;
70+
## by default the current package and its shell attributes are main jobs
71+
72+
## you may mark a package as a CI job as follows
73+
# coqPackages.<another-pkg>.job = "test";
74+
## It can then built through
75+
## nix-build --argstr bundle "default" --arg job "test";
76+
## in the absence of such a directive, the job "another-pkg" will
77+
## is still available, but will be automatically included in the CI
78+
## via the command genNixActions only if it is a dependency or a
79+
## reverse dependency of a job flagged as "main-job" (see above).
80+
81+
};
82+
83+
## Cachix caches to use in CI
84+
## Below we list some standard ones
85+
cachix.coq = {};
86+
cachix.math-comp = {};
87+
cachix.coq-community.authToken = "CACHIX_AUTH_TOKEN";
88+
89+
## Or if you have a signing key for a given Cachix cache:
90+
# cachix.my-cache.signingKey = "CACHIX_SIGNING_KEY"
91+
92+
## Note that here, CACHIX_AUTH_TOKEN and CACHIX_SIGNING_KEY
93+
## are the names of secret variables. They are set in
94+
## GitHub's web interface.
95+
}

.nix/coq-nix-toolbox.nix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"4d8cc4ac0ce259be956939f80b3d57c94971a83f"

default.nix

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ config ? {}, withEmacs ? false, print-env ? false, do-nothing ? false,
2+
update-nixpkgs ? false, ci-matrix ? false,
3+
override ? {}, ocaml-override ? {}, global-override ? {},
4+
bundle ? null, job ? null, inNixShell ? null, src ? ./.,
5+
}@args:
6+
let auto = fetchGit {
7+
url = "https://github.com/coq-community/coq-nix-toolbox.git";
8+
ref = "master";
9+
rev = import .nix/coq-nix-toolbox.nix;
10+
};
11+
in
12+
import auto ({inherit src;} // args)

0 commit comments

Comments
 (0)