1
1
on :
2
2
push :
3
- pull_request :
4
3
5
4
name : continuous integration
6
5
16
15
all_but_latest : true
17
16
access_token : ${{ github.token }}
18
17
19
- check_imported :
20
- name : Check all files imported
21
- runs-on : ubuntu-latest
22
- steps :
23
- - name : cleanup
24
- run : |
25
- find . -name . -o -prune -exec rm -rf -- {} +
26
-
27
- - uses : actions/checkout@v4
28
-
29
- - name : update Algorithm.lean
30
- run : |
31
- git ls-files 'Algorithm/*.lean' | LC_ALL=C sort | sed 's/\.lean//;s,/,.,g;s/^/import /' > Algorithm.lean
32
-
33
- - name : check that all files are imported
34
- run : git diff --exit-code
35
-
36
18
build :
37
19
name : Build
38
20
runs-on : ubuntu-latest
@@ -56,18 +38,12 @@ jobs:
56
38
- name : install elan
57
39
run : |
58
40
set -o pipefail
59
- curl -sSfL https://github.com/leanprover/elan/releases/download/v3.0.0 /elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
41
+ curl -sSfL https://github.com/leanprover/elan/releases/download/v3.1.1 /elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
60
42
./elan-init -y --default-toolchain none
61
43
echo "$HOME/.elan/bin" >> "${GITHUB_PATH}"
62
44
63
45
- uses : actions/checkout@v4
64
46
65
- # We update `Algorithm.lean` as a convenience here,
66
- # but verify that this didn't change anything in the `check_imported` job.
67
- - name : update Algorithm.lean
68
- run : |
69
- find Algorithm -name "*.lean" | LC_ALL=C sort | sed 's/\.lean//;s,/,.,g;s/^/import /' > Algorithm.lean
70
-
71
47
- name : If using a lean-pr-release toolchain, uninstall
72
48
run : |
73
49
if [[ $(cat lean-toolchain) =~ ^leanprover/lean4-pr-releases:pr-release-[0-9]+$ ]]; then
@@ -94,17 +70,71 @@ jobs:
94
70
rm -rf .lake/packages/proofwidgets/.lake/build/ir
95
71
96
72
- name : get cache
73
+ id : get
74
+ run : |
75
+ rm -rf .lake/build/lib/Mutable/
76
+ rm -rf .lake/build/lib/Algorithm/
77
+ # Fail quickly if the cache is completely cold, by checking for Mathlib.Init
78
+ lake exe cache get Mathlib.Init
79
+ lake build --no-build Mathlib.Init && lake exe cache get || echo "No cache for 'Mathlib.Init' available"
80
+
81
+ - name : update {Mutable, Algorithm}.lean
82
+ id : mk_all
97
83
run : |
98
- lake exe cache clean
99
- lake exe cache get
84
+
85
+ if ! lake exe mk_all --check
86
+ then
87
+ echo "Not all lean files are in the import all files"
88
+ echo "mk_all=false" >> "${GITHUB_OUTPUT}"
89
+ else
90
+ echo "mk_all=true" >> "${GITHUB_OUTPUT}"
91
+ fi
100
92
101
93
- name : build algorithm
102
94
id : build
103
95
uses : liskin/gh-problem-matcher-wrap@v3
104
96
with :
105
97
linters : gcc
106
98
run : |
107
- bash -o pipefail -c "env LEAN_ABORT_ON_PANIC=1 lake build -KCI | tee stdout.log"
99
+ bash -o pipefail -c "env LEAN_ABORT_ON_PANIC=1 lake build --wfail -KCI"
100
+
101
+ - name : Check {Mutable, Algorithm}.lean
102
+ run : |
103
+ if [ ${{ steps.mk_all.outputs.mk_all }} == "false" ]
104
+ then
105
+ echo "Please run 'lake exe mk_all' to regenerate the import all files"
106
+ exit 1
107
+ fi
108
+
109
+ - name : check for noisy stdout lines
110
+ id : noisy
111
+ run : |
112
+ buildMsgs="$(
113
+ ## we exploit `lake`s replay feature: since the cache is present, running
114
+ ## `lake build` will reproduce all the outputs without having to recompute
115
+ lake build Mutable Algorithm |
116
+ ## we filter out the output lines that begin with `✔ [xx/yy]`, where xx, yy
117
+ ## are either numbers or ?, and the "Build completed successfully." message.
118
+ ## We keep the rest, which are actual outputs of the files
119
+ awk '!($0 ~ "^\\s*✔ \\[[?0-9]*/[?0-9]*\\]" || $0 == "Build completed successfully."){ print $0 }')"
120
+ if [ -n "${buildMsgs}" ]
121
+ then
122
+ printf $'%s\n' "${buildMsgs}"
123
+ exit 1
124
+ fi
125
+
126
+ - name : verify `lake exe graph` works
127
+ run : |
128
+ lake exe graph
129
+ rm import_graph.dot
130
+
131
+ # - name: test algorithm
132
+ # id: test
133
+ # uses: liskin/gh-problem-matcher-wrap@v3
134
+ # with:
135
+ # linters: gcc
136
+ # run:
137
+ # lake test
108
138
109
139
- name : check for unused imports
110
140
id : shake
@@ -120,10 +150,3 @@ jobs:
120
150
with :
121
151
linters : gcc
122
152
run : env LEAN_ABORT_ON_PANIC=1 lake exe runLinter Algorithm
123
-
124
- - name : check for noisy stdout lines
125
- id : noisy
126
- run : |
127
- grep --after-context=1 "stdout" stdout.log && ret=0
128
- grep --after-context=1 "stderr" stdout.log && new=0
129
- if [ "${ret}" == "0" ] || [ "${new}" == "0" ]; then exit 1; fi
0 commit comments