Skip to content

Commit ae121fd

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

File tree

4 files changed

+270
-0
lines changed

4 files changed

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

.nix/config.nix

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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 = {};
88+
89+
## If you have write access to one of these caches you can
90+
## provide the auth token or signing key through a secret
91+
## variable on GitHub. Then, you should give the variable
92+
## name here. For instance, coq-community projects can use
93+
## the following line instead of the one above:
94+
# cachix.coq-community.authToken = "CACHIX_AUTH_TOKEN";
95+
96+
## Or if you have a signing key for a given Cachix cache:
97+
# cachix.my-cache.signingKey = "CACHIX_SIGNING_KEY"
98+
99+
## Note that here, CACHIX_AUTH_TOKEN and CACHIX_SIGNING_KEY
100+
## are the names of secret variables. They are set in
101+
## GitHub's web interface.
102+
}

.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)