Skip to content

Commit 2571541

Browse files
avargitster
authored andcommitted
CI: don't run "make test" twice in one job
The "linux-clang" and "linux-gcc" jobs both run "make test" twice, but with different environment variables. Running these in sequence seems to have been done to work around some constraint on Travis, see ae59a4e (travis: run tests with GIT_TEST_SPLIT_INDEX, 2018-01-07). By having these run in parallel we'll get jobs that finish much sooner than they otherwise would have. We can also simplify the control flow in "ci/run-build-and-tests.sh" as a result, since we won't run "make test" twice we don't need to run "make" twice at all, let's default to "make all test" after setting the variables, and then override it to just "all" for the compile-only tests. Add a comment to clarify that new "test" targets should adjust $MAKE_TARGETS rather than being added after the "case/esac". This should avoid future confusion where e.g. the compilation-only "pedantic" target will unexpectedly start running tests. See [1] and [2]. 1. https://lore.kernel.org/git/[email protected]/ 2. https://lore.kernel.org/git/[email protected]/ Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 707d2f2 commit 2571541

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,19 @@ jobs:
225225
- jobname: linux-clang
226226
cc: clang
227227
pool: ubuntu-latest
228+
- jobname: linux-sha256
229+
cc: clang
230+
os: ubuntu
231+
pool: ubuntu-latest
228232
- jobname: linux-gcc
229233
cc: gcc
230234
cc_package: gcc-8
231235
pool: ubuntu-latest
236+
- jobname: linux-TEST-vars
237+
cc: gcc
238+
os: ubuntu
239+
cc_package: gcc-8
240+
pool: ubuntu-latest
232241
- jobname: osx-clang
233242
cc: clang
234243
pool: macos-latest

ci/run-build-and-tests.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ windows*) cmd //c mklink //j t\\.prove "$(cygpath -aw "$cache_dir/.prove")";;
1010
*) ln -s "$cache_dir/.prove" t/.prove;;
1111
esac
1212

13-
if test "$jobname" = "pedantic"
14-
then
15-
export DEVOPTS=pedantic
16-
fi
13+
export MAKE_TARGETS="all test"
1714

18-
make
1915
case "$jobname" in
2016
linux-gcc)
2117
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
22-
make test
18+
;;
19+
linux-TEST-vars)
2320
export GIT_TEST_SPLIT_INDEX=yes
2421
export GIT_TEST_MERGE_ALGORITHM=recursive
2522
export GIT_TEST_FULL_IN_PACK_ARRAY=true
@@ -33,23 +30,25 @@ linux-gcc)
3330
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
3431
export GIT_TEST_WRITE_REV_INDEX=1
3532
export GIT_TEST_CHECKOUT_WORKERS=2
36-
make test
3733
;;
3834
linux-clang)
3935
export GIT_TEST_DEFAULT_HASH=sha1
40-
make test
36+
;;
37+
linux-sha256)
4138
export GIT_TEST_DEFAULT_HASH=sha256
42-
make test
4339
;;
4440
pedantic)
4541
# Don't run the tests; we only care about whether Git can be
4642
# built.
47-
;;
48-
*)
49-
make test
43+
export DEVOPTS=pedantic
44+
export MAKE_TARGETS=all
5045
;;
5146
esac
5247

48+
# Any new "test" targets should not go after this "make", but should
49+
# adjust $MAKE_TARGETS. Otherwise compilation-only targets above will
50+
# start running tests.
51+
make $MAKE_TARGETS
5352
check_unignored_build_artifacts
5453

5554
save_good_tree

0 commit comments

Comments
 (0)