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 ae59a4e44f3 (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/211122.86ee78yxts.gmgdl@evledraar.gmail.com/ 2. https://lore.kernel.org/git/211123.86ilwjujmd.gmgdl@evledraar.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Nov 23, 2021 at 17:29 UTC 25715419bf4d105d755e0f6d2228e1ac0bd06b88
2 files changed +20 -12
.github/workflows/main.yml
+9
@@ -225,10 +225,19 @@ jobs:
225 - jobname: linux-clang
226 cc: clang
227 pool: ubuntu-latest
228 + - jobname: linux-sha256
229 + cc: clang
230 + os: ubuntu
231 + pool: ubuntu-latest
232 - jobname: linux-gcc
233 cc: gcc
234 cc_package: gcc-8
235 pool: ubuntu-latest
236 + - jobname: linux-TEST-vars
237 + cc: gcc
238 + os: ubuntu
239 + cc_package: gcc-8
240 + pool: ubuntu-latest
241 - jobname: osx-clang
242 cc: clang
243 pool: macos-latest
ci/run-build-and-tests.sh
+11 -12
@@ -10,16 +10,13 @@ windows*) cmd //c mklink //j t\\.prove "$(cygpath -aw "$cache_dir/.prove")";;
10 *) ln -s "$cache_dir/.prove" t/.prove;;
11 esac
12
13 -if test "$jobname" = "pedantic"
14 -then
15 - export DEVOPTS=pedantic
16 -fi
13 +export MAKE_TARGETS="all test"
14
18 -make
15 case "$jobname" in
16 linux-gcc)
17 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
22 - make test
18 + ;;
19 +linux-TEST-vars)
20 export GIT_TEST_SPLIT_INDEX=yes
21 export GIT_TEST_MERGE_ALGORITHM=recursive
22 export GIT_TEST_FULL_IN_PACK_ARRAY=true
@@ -33,23 +30,25 @@ linux-gcc)
30 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
31 export GIT_TEST_WRITE_REV_INDEX=1
32 export GIT_TEST_CHECKOUT_WORKERS=2
36 - make test
33 ;;
34 linux-clang)
35 export GIT_TEST_DEFAULT_HASH=sha1
40 - make test
36 + ;;
37 +linux-sha256)
38 export GIT_TEST_DEFAULT_HASH=sha256
42 - make test
39 ;;
40 pedantic)
41 # Don't run the tests; we only care about whether Git can be
42 # built.
47 - ;;
48 -*)
49 - make test
43 + export DEVOPTS=pedantic
44 + export MAKE_TARGETS=all
45 ;;
46 esac
47
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
52 check_unignored_build_artifacts
53
54 save_good_tree