Skip to content

Commit 9f17bef

Browse files
pks-tgitster
authored andcommitted
ci: unify setup of some environment variables
Both GitHub Actions and Azure Pipelines set up the environment variables GIT_TEST_OPTS, GIT_PROVE_OPTS and MAKEFLAGS. And while most values are actually the same, the setup is completely duplicate. With the upcoming support for GitLab CI this duplication would only extend even further. Unify the setup of those environment variables so that only the uncommon parts are separated. While at it, we also perform some additional small improvements: - We now always pass `--state=failed,slow,save` via GIT_PROVE_OPTS. It doesn't hurt on platforms where we don't persist the state, so this further reduces boilerplate. - When running on Windows systems we set `--no-chain-lint` and `--no-bin-wrappers`. Interestingly though, we did so _after_ already having exported the respective environment variables. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e624f20 commit 9f17bef

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

ci/lib.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,8 @@ then
174174
# among *all* phases)
175175
cache_dir="$HOME/test-cache/$SYSTEM_PHASENAME"
176176

177-
export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save"
178-
export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml"
179-
MAKEFLAGS="$MAKEFLAGS --jobs=10"
180-
test windows_nt != "$CI_OS_NAME" ||
181-
GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
177+
GIT_TEST_OPTS="--write-junit-xml"
178+
JOBS=10
182179
elif test true = "$GITHUB_ACTIONS"
183180
then
184181
CI_TYPE=github-actions
@@ -198,17 +195,27 @@ then
198195

199196
cache_dir="$HOME/none"
200197

201-
export GIT_PROVE_OPTS="--timer --jobs 10"
202-
export GIT_TEST_OPTS="--verbose-log -x --github-workflow-markup"
203-
MAKEFLAGS="$MAKEFLAGS --jobs=10"
204-
test windows != "$CI_OS_NAME" ||
205-
GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
198+
GIT_TEST_OPTS="--github-workflow-markup"
199+
JOBS=10
206200
else
207201
echo "Could not identify CI type" >&2
208202
env >&2
209203
exit 1
210204
fi
211205

206+
MAKEFLAGS="$MAKEFLAGS --jobs=$JOBS"
207+
GIT_PROVE_OPTS="--timer --jobs $JOBS --state=failed,slow,save"
208+
209+
GIT_TEST_OPTS="$GIT_TEST_OPTS --verbose-log -x"
210+
case "$CI_OS_NAME" in
211+
windows|windows_nt)
212+
GIT_TEST_OPTS="$GIT_TEST_OPTS --no-chain-lint --no-bin-wrappers"
213+
;;
214+
esac
215+
216+
export GIT_TEST_OPTS
217+
export GIT_PROVE_OPTS
218+
212219
good_trees_file="$cache_dir/good-trees"
213220

214221
mkdir -p "$cache_dir"

0 commit comments

Comments
 (0)