Skip to content

Commit 03256f3

Browse files
avargitster
authored andcommitted
CI: set CC in MAKEFLAGS directly, don't add it to the environment
Rather than pass a "$CC" and "$CC_PACKAGE" in the environment to be picked up in ci/lib.sh let's instead have ci/lib.sh itself add it directly to MAKEFLAGS. Setting CC=gcc by default made for confusing trace output, and since a preceding change to carry it and others over across "steps" in the GitHub CI it's been even more misleading. E.g. the "win+VS build" job confusingly has CC=gcc set, even though it builds with MSVC. Let's instead reply on the Makefile default of CC=cc, and only override it for those jobs where it's needed. This does mean that we'll need to set it for the "pedantic" job, which previously relied on the default CC=gcc in case "clang" become the default on that platform. This partially reverts my 707d2f2 (CI: use "$runs_on_pool", not "$jobname" to select packages & config, 2021-11-23), i.e. we're now aiming to only set those variables specific jobs need. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ae739fa commit 03256f3

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -238,37 +238,24 @@ jobs:
238238
matrix:
239239
vector:
240240
- jobname: linux-clang
241-
cc: clang
242241
pool: ubuntu-latest
243242
- jobname: linux-sha256
244-
cc: clang
245243
os: ubuntu
246244
pool: ubuntu-latest
247245
- jobname: linux-gcc
248-
cc: gcc
249-
cc_package: gcc-8
250246
pool: ubuntu-latest
251247
- jobname: linux-TEST-vars
252-
cc: gcc
253248
os: ubuntu
254-
cc_package: gcc-8
255249
pool: ubuntu-latest
256250
- jobname: osx-clang
257-
cc: clang
258251
pool: macos-latest
259252
- jobname: osx-gcc
260-
cc: gcc
261-
cc_package: gcc-9
262253
pool: macos-latest
263254
- jobname: linux-gcc-default
264-
cc: gcc
265255
pool: ubuntu-latest
266256
- jobname: linux-leaks
267-
cc: gcc
268257
pool: ubuntu-latest
269258
env:
270-
CC: ${{matrix.vector.cc}}
271-
CC_PACKAGE: ${{matrix.vector.cc_package}}
272259
jobname: ${{matrix.vector.jobname}}
273260
runs_on_pool: ${{matrix.vector.pool}}
274261
runs-on: ${{matrix.vector.pool}}

ci/lib.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ setenv () {
5252
fi
5353
}
5454

55-
# Clear MAKEFLAGS that may come from the outside world.
55+
# Clear variables that may come from the outside world.
56+
CC=
57+
CC_PACKAGE=
5658
MAKEFLAGS=
5759

5860
# Common make and cmake build options
@@ -64,8 +66,6 @@ MAKEFLAGS="DEVELOPER=$DEVELOPER SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS"
6466

6567
case "$CI_TYPE" in
6668
github-actions)
67-
CC="${CC:-gcc}"
68-
6969
setenv --test GIT_PROVE_OPTS "--timer --jobs 10"
7070
GIT_TEST_OPTS="--verbose-log -x"
7171
MAKEFLAGS="$MAKEFLAGS --jobs=10"
@@ -135,9 +135,16 @@ vs-test)
135135
setenv --test NO_SVN_TESTS YesPlease
136136
;;
137137
linux-gcc)
138+
CC=gcc
139+
CC_PACKAGE=gcc-8
138140
setenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main
139141
;;
142+
linux-gcc-default)
143+
CC=gcc
144+
;;
140145
linux-TEST-vars)
146+
CC=gcc
147+
CC_PACKAGE=gcc-8
141148
setenv --test GIT_TEST_SPLIT_INDEX yes
142149
setenv --test GIT_TEST_MERGE_ALGORITHM recursive
143150
setenv --test GIT_TEST_FULL_IN_PACK_ARRAY true
@@ -152,13 +159,23 @@ linux-TEST-vars)
152159
setenv --test GIT_TEST_WRITE_REV_INDEX 1
153160
setenv --test GIT_TEST_CHECKOUT_WORKERS 2
154161
;;
162+
osx-gcc)
163+
CC=gcc
164+
CC_PACKAGE=gcc-9
165+
;;
166+
osx-clang)
167+
CC=clang
168+
;;
155169
linux-clang)
170+
CC=clang
156171
setenv --test GIT_TEST_DEFAULT_HASH sha1
157172
;;
158173
linux-sha256)
174+
CC=clang
159175
setenv --test GIT_TEST_DEFAULT_HASH sha256
160176
;;
161177
pedantic)
178+
CC=gcc
162179
# Don't run the tests; we only care about whether Git can be
163180
# built.
164181
setenv --build DEVOPTS pedantic
@@ -173,9 +190,11 @@ linux-musl)
173190
MAKEFLAGS="$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8"
174191
;;
175192
linux-leaks)
193+
CC=gcc
176194
setenv --build SANITIZE leak
177195
setenv --test GIT_TEST_PASSING_SANITIZE_LEAK true
178196
;;
179197
esac
180198

181-
setenv --all MAKEFLAGS "$MAKEFLAGS CC=${CC:-cc}"
199+
MAKEFLAGS="$MAKEFLAGS${CC:+ CC=$CC}"
200+
setenv --all MAKEFLAGS "$MAKEFLAGS"

0 commit comments

Comments
 (0)