Skip to content

Commit 55c9e66

Browse files
committed
Merge branch 'ab/ci-setup-simplify' into seen
* ab/ci-setup-simplify: (25 commits) CI: don't use "set -x" in "ci/lib.sh" output CI: set PYTHON_PATH setting for osx-{clang,gcc} into "$jobname" case CI: set CC in MAKEFLAGS directly, don't add it to the environment CI: add more variables to MAKEFLAGS, except under vs-build CI: narrow down variable definitions in --build and --test CI: only invoke ci/lib.sh as "steps" in main.yml CI: pre-select test slice in Windows & VS tests ci/run-test-slice.sh: replace shelling out with "echo" CI: move "env" definitions into ci/lib.sh CI: combine ci/install{,-docker}-dependencies.sh CI: split up and reduce "ci/test-documentation.sh" CI: invoke "make artifacts-tar" directly in windows-build CI: check ignored unignored build artifacts in "win[+VS] build" too CI: remove "run-build-and-tests.sh", run "make [test]" directly CI: export variables via a wrapper CI: consistently use "export" in ci/lib.sh CI: move p4 and git-lfs variables to ci/install-dependencies.sh CI: have "static-analysis" run "check-builtins", not "documentation" CI: have "static-analysis" run a "make ci-static-analysis" target CI: don't have "git grep" invoke a pager in tree content check ...
2 parents 239afb5 + 01b0e0e commit 55c9e66

21 files changed

+346
-577
lines changed

.github/workflows/main.yml

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: CI
22

33
on: [push, pull_request]
44

5-
env:
6-
DEVELOPER: 1
7-
85
jobs:
96
ci-config:
107
name: config
@@ -79,27 +76,36 @@ jobs:
7976
8077
windows-build:
8178
name: win build
79+
env:
80+
jobname: windows-build
8281
needs: ci-config
8382
if: needs.ci-config.outputs.enabled == 'yes'
8483
runs-on: windows-latest
8584
steps:
8685
- uses: actions/checkout@v2
8786
- uses: git-for-windows/setup-git-for-windows-sdk@v1
87+
- run: ci/lib.sh --build
88+
shell: bash
8889
- name: build
8990
shell: bash
9091
env:
9192
HOME: ${{runner.workspace}}
92-
NO_PERL: 1
93-
run: . /etc/profile && ci/make-test-artifacts.sh artifacts
93+
run: . /etc/profile && make artifacts-tar
94+
if: success()
95+
- run: ci/check-unignored-build-artifacts.sh
96+
if: success()
97+
shell: bash
9498
- name: zip up tracked files
9599
run: git archive -o artifacts/tracked.tar.gz HEAD
96100
- name: upload tracked files and build artifacts
97101
uses: actions/upload-artifact@v2
98102
with:
99103
name: windows-artifacts
100-
path: artifacts
104+
path: ${{env.ARTIFACTS_DIRECTORY}}
101105
windows-test:
102106
name: win test
107+
env:
108+
jobname: windows-test
103109
runs-on: windows-latest
104110
needs: [windows-build]
105111
strategy:
@@ -116,9 +122,14 @@ jobs:
116122
shell: bash
117123
run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
118124
- uses: git-for-windows/setup-git-for-windows-sdk@v1
125+
- run: ci/lib.sh --test
126+
shell: bash
127+
- name: select tests
128+
run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10
129+
shell: bash
119130
- name: test
120131
shell: bash
121-
run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
132+
run: . /etc/profile && make -C t -e
122133
- name: ci/print-test-failures.sh
123134
if: failure()
124135
shell: bash
@@ -131,11 +142,10 @@ jobs:
131142
path: ${{env.FAILED_TEST_ARTIFACTS}}
132143
vs-build:
133144
name: win+VS build
145+
env:
146+
jobname: vs-build
134147
needs: ci-config
135148
if: needs.ci-config.outputs.enabled == 'yes'
136-
env:
137-
NO_PERL: 1
138-
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
139149
runs-on: windows-latest
140150
steps:
141151
- uses: actions/checkout@v2
@@ -159,6 +169,8 @@ jobs:
159169
- name: copy dlls to root
160170
shell: cmd
161171
run: compat\vcbuild\vcpkg_copy_dlls.bat release
172+
- run: ci/lib.sh --build
173+
shell: bash
162174
- name: generate Visual Studio solution
163175
shell: bash
164176
run: |
@@ -169,20 +181,20 @@ jobs:
169181
- name: bundle artifact tar
170182
shell: bash
171183
env:
172-
MSVC: 1
173184
VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg
174185
run: |
175-
mkdir -p artifacts &&
176-
eval "$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)"
186+
eval "$(make -n artifacts-tar 2>&1 | grep -e ^mkdir -e ^tar)"
177187
- name: zip up tracked files
178188
run: git archive -o artifacts/tracked.tar.gz HEAD
179189
- name: upload tracked files and build artifacts
180190
uses: actions/upload-artifact@v2
181191
with:
182192
name: vs-artifacts
183-
path: artifacts
193+
path: ${{env.ARTIFACTS_DIRECTORY}}
184194
vs-test:
185195
name: win+VS test
196+
env:
197+
jobname: vs-test
186198
runs-on: windows-latest
187199
needs: vs-build
188200
strategy:
@@ -199,11 +211,14 @@ jobs:
199211
- name: extract tracked files and build artifacts
200212
shell: bash
201213
run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
214+
- run: ci/lib.sh --test
215+
shell: bash
216+
- name: select tests
217+
run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10
218+
shell: bash
202219
- name: test
203220
shell: bash
204-
env:
205-
NO_SVN_TESTS: 1
206-
run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
221+
run: . /etc/profile && make -C t -e
207222
- name: ci/print-test-failures.sh
208223
if: failure()
209224
shell: bash
@@ -223,44 +238,35 @@ jobs:
223238
matrix:
224239
vector:
225240
- jobname: linux-clang
226-
cc: clang
227241
pool: ubuntu-latest
228242
- jobname: linux-sha256
229-
cc: clang
230243
os: ubuntu
231244
pool: ubuntu-latest
232245
- jobname: linux-gcc
233-
cc: gcc
234-
cc_package: gcc-8
235246
pool: ubuntu-latest
236247
- jobname: linux-TEST-vars
237-
cc: gcc
238248
os: ubuntu
239-
cc_package: gcc-8
240249
pool: ubuntu-latest
241250
- jobname: osx-clang
242-
cc: clang
243251
pool: macos-latest
244252
- jobname: osx-gcc
245-
cc: gcc
246-
cc_package: gcc-9
247253
pool: macos-latest
248254
- jobname: linux-gcc-default
249-
cc: gcc
250255
pool: ubuntu-latest
251256
- jobname: linux-leaks
252-
cc: gcc
253257
pool: ubuntu-latest
254258
env:
255-
CC: ${{matrix.vector.cc}}
256-
CC_PACKAGE: ${{matrix.vector.cc_package}}
257259
jobname: ${{matrix.vector.jobname}}
258260
runs_on_pool: ${{matrix.vector.pool}}
259261
runs-on: ${{matrix.vector.pool}}
260262
steps:
261263
- uses: actions/checkout@v2
262264
- run: ci/install-dependencies.sh
263-
- run: ci/run-build-and-tests.sh
265+
- run: ci/lib.sh --build
266+
- run: make
267+
- run: ci/lib.sh --test
268+
- run: make test
269+
if: success()
264270
- run: ci/print-test-failures.sh
265271
if: failure()
266272
- name: Upload failed tests' directories
@@ -284,16 +290,21 @@ jobs:
284290
image: daald/ubuntu32:xenial
285291
- jobname: pedantic
286292
image: fedora
293+
skip-tests: no
287294
env:
288295
jobname: ${{matrix.vector.jobname}}
289296
runs-on: ubuntu-latest
290297
container: ${{matrix.vector.image}}
291298
steps:
292299
- uses: actions/checkout@v1
293-
- run: ci/install-docker-dependencies.sh
294-
- run: ci/run-build-and-tests.sh
300+
- run: ci/install-dependencies.sh
301+
- run: ci/lib.sh --build
302+
- run: make
303+
- run: ci/lib.sh --test
304+
- run: make test
305+
if: success() && matrix.vector.skip-tests != 'no'
295306
- run: ci/print-test-failures.sh
296-
if: failure()
307+
if: failure() && matrix.vector.skip-tests != 'no'
297308
- name: Upload failed tests' directories
298309
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
299310
uses: actions/upload-artifact@v1
@@ -309,8 +320,8 @@ jobs:
309320
steps:
310321
- uses: actions/checkout@v2
311322
- run: ci/install-dependencies.sh
312-
- run: ci/run-static-analysis.sh
313-
- run: ci/check-directional-formatting.bash
323+
- run: ci/lib.sh --build
324+
- run: make ci-static-analysis
314325
sparse:
315326
needs: ci-config
316327
if: needs.ci-config.outputs.enabled == 'yes'
@@ -330,6 +341,7 @@ jobs:
330341
- uses: actions/checkout@v2
331342
- name: Install other dependencies
332343
run: ci/install-dependencies.sh
344+
- run: ci/lib.sh --build
333345
- run: make sparse
334346
documentation:
335347
name: documentation
@@ -341,4 +353,18 @@ jobs:
341353
steps:
342354
- uses: actions/checkout@v2
343355
- run: ci/install-dependencies.sh
344-
- run: ci/test-documentation.sh
356+
- run: ci/lib.sh --build
357+
- run: make check-docs
358+
- run: "make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)"
359+
shell: bash
360+
- run: ci/test-documentation.sh AsciiDoc
361+
if: success()
362+
- run: ci/check-unignored-build-artifacts.sh
363+
if: success()
364+
- run: make clean
365+
- run: "make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)"
366+
shell: bash
367+
- run: ci/test-documentation.sh Asciidoctor
368+
if: success()
369+
- run: ci/check-unignored-build-artifacts.sh
370+
if: success()

Makefile

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3046,6 +3046,20 @@ coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c
30463046
# See contrib/coccinelle/README
30473047
coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
30483048

3049+
.PHONY: check-coccicheck
3050+
check-coccicheck: coccicheck
3051+
$(QUIET_CHECK)for cocci_patch in contrib/coccinelle/*.patch; do \
3052+
if test -s "$$cocci_patch"; then \
3053+
echo "Coccinelle suggests the following changes in '$$cocci_patch':"; \
3054+
cat "$$cocci_patch"; \
3055+
fail=UnfortunatelyYes; \
3056+
fi \
3057+
done; \
3058+
if test -n "$$fail"; then \
3059+
echo "error: Coccinelle suggested some changes"; \
3060+
exit 1; \
3061+
fi
3062+
30493063
.PHONY: coccicheck coccicheck-pending
30503064

30513065
### Installation rules
@@ -3403,7 +3417,7 @@ check-docs::
34033417
### Make sure built-ins do not have dups and listed in git.c
34043418
#
34053419
check-builtins::
3406-
./check-builtins.sh
3420+
$(QUIET_CHECK)./check-builtins.sh
34073421

34083422
### Test suite coverage testing
34093423
#
@@ -3481,3 +3495,18 @@ $(FUZZ_PROGRAMS): all
34813495
$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
34823496

34833497
fuzz-all: $(FUZZ_PROGRAMS)
3498+
3499+
### CI "check" targets
3500+
#
3501+
# These targets are run from the CI, see .github/workflows/main.yml,
3502+
# but can also be run manually to run the same assertions locally.
3503+
3504+
.PHONY: ci-check-directional-formatting
3505+
ci-check-directional-formatting:
3506+
$(QUIET_CHECK)ci/check-directional-formatting.bash
3507+
3508+
.PHONY: ci-static-analysis
3509+
ci-static-analysis: ci-check-directional-formatting
3510+
ci-static-analysis: check-builtins
3511+
ci-static-analysis: check-coccicheck
3512+
ci-static-analysis: hdr-check

ci/check-directional-formatting.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
# U+2066..U+2069: LRI, RLI, FSI and PDI
2424
regex='(\u202a|\u202b|\u202c|\u202d|\u202e|\u2066|\u2067|\u2068|\u2069)'
2525

26-
! LC_CTYPE=C git grep -El "$(LC_CTYPE=C.UTF-8 printf "$regex")" \
26+
! LC_CTYPE=C git -P grep -El "$(LC_CTYPE=C.UTF-8 printf "$regex")" \
2727
-- ':(exclude,attr:binary)' ':(exclude)*.po'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
#
3+
# Check whether the build created anything not in our .gitignore
4+
#
5+
6+
set -ex
7+
8+
. ${0%/*}/lib-tput.sh
9+
10+
check_unignored_build_artifacts ()
11+
{
12+
! git ls-files --other --exclude-standard --error-unmatch \
13+
-- ':/*' 2>/dev/null ||
14+
{
15+
echo "$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)"
16+
false
17+
}
18+
}
19+
20+
check_unignored_build_artifacts

0 commit comments

Comments
 (0)