Skip to content

Commit 707d2f2

Browse files
avargitster
authored andcommitted
CI: use "$runs_on_pool", not "$jobname" to select packages & config
Change the setup hooks for the CI to use "$runs_on_pool" for the "$regular" job. Now we won't need as much boilerplate when adding new jobs to the "regular" matrix, see 956d2e4 (tests: add a test mode for SANITIZE=leak, run it in CI, 2021-09-23) for the last such commit. I.e. now instead of needing to enumerate each jobname when we select packages we can install things depending on the pool we're running in. That we didn't do this dates back to the now gone dependency on Travis CI, but even if we add a new CI target in the future this'll be easier to port over, since we can probably treat "ubuntu-latest" as a stand-in for some recent Linux that can run "apt" commands. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c08bb26 commit 707d2f2

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,14 @@ jobs:
227227
pool: ubuntu-latest
228228
- jobname: linux-gcc
229229
cc: gcc
230+
cc_package: gcc-8
230231
pool: ubuntu-latest
231232
- jobname: osx-clang
232233
cc: clang
233234
pool: macos-latest
234235
- jobname: osx-gcc
235236
cc: gcc
237+
cc_package: gcc-9
236238
pool: macos-latest
237239
- jobname: linux-gcc-default
238240
cc: gcc
@@ -242,7 +244,9 @@ jobs:
242244
pool: ubuntu-latest
243245
env:
244246
CC: ${{matrix.vector.cc}}
247+
CC_PACKAGE: ${{matrix.vector.cc_package}}
245248
jobname: ${{matrix.vector.jobname}}
249+
runs_on_pool: ${{matrix.vector.pool}}
246250
runs-on: ${{matrix.vector.pool}}
247251
steps:
248252
- uses: actions/checkout@v2

ci/install-dependencies.sh

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@ UBUNTU_COMMON_PKGS="make libssl-dev libcurl4-openssl-dev libexpat-dev
1111
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl
1212
libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl"
1313

14-
case "$jobname" in
15-
linux-clang|linux-gcc|linux-leaks)
14+
case "$runs_on_pool" in
15+
ubuntu-latest)
1616
sudo apt-get -q update
1717
sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \
18-
$UBUNTU_COMMON_PKGS
19-
case "$jobname" in
20-
linux-gcc)
21-
sudo apt-get -q -y install gcc-8
22-
;;
23-
esac
24-
18+
$UBUNTU_COMMON_PKGS $CC_PACKAGE
2519
mkdir --parents "$P4_PATH"
2620
pushd "$P4_PATH"
2721
wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d"
@@ -36,7 +30,7 @@ linux-clang|linux-gcc|linux-leaks)
3630
cp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .
3731
popd
3832
;;
39-
osx-clang|osx-gcc)
33+
macos-latest)
4034
export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
4135
# Uncomment this if you want to run perf tests:
4236
# brew install gnu-time
@@ -50,15 +44,17 @@ osx-clang|osx-gcc)
5044
brew install --cask --no-quarantine perforce
5145
} ||
5246
brew install homebrew/cask/perforce
53-
case "$jobname" in
54-
osx-gcc)
55-
brew install gcc@9
56-
# Just in case the image is updated to contain gcc@9
57-
# pre-installed but not linked.
58-
brew link gcc@9
59-
;;
60-
esac
47+
48+
if test -n "$CC_PACKAGE"
49+
then
50+
BREW_PACKAGE=${CC_PACKAGE/-/@}
51+
brew install "$BREW_PACKAGE"
52+
brew link "$BREW_PACKAGE"
53+
fi
6154
;;
55+
esac
56+
57+
case "$jobname" in
6258
StaticAnalysis)
6359
sudo apt-get -q update
6460
sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \

ci/lib.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,15 @@ export DEFAULT_TEST_TARGET=prove
156156
export GIT_TEST_CLONE_2GB=true
157157
export SKIP_DASHED_BUILT_INS=YesPlease
158158

159-
case "$jobname" in
160-
linux-clang|linux-gcc|linux-leaks)
159+
case "$runs_on_pool" in
160+
ubuntu-latest)
161+
if test "$jobname" = "linux-gcc-default"
162+
then
163+
break
164+
fi
165+
161166
if [ "$jobname" = linux-gcc ]
162167
then
163-
export CC=gcc-8
164168
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3"
165169
else
166170
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python2"
@@ -180,17 +184,17 @@ linux-clang|linux-gcc|linux-leaks)
180184
GIT_LFS_PATH="$HOME/custom/git-lfs"
181185
export PATH="$GIT_LFS_PATH:$P4_PATH:$PATH"
182186
;;
183-
osx-clang|osx-gcc)
187+
macos-latest)
184188
if [ "$jobname" = osx-gcc ]
185189
then
186-
export CC=gcc-9
187190
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python3)"
188191
else
189192
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python2)"
190193
fi
191194
;;
192-
linux-gcc-default)
193-
;;
195+
esac
196+
197+
case "$jobname" in
194198
linux32)
195199
CC=gcc
196200
;;
@@ -200,9 +204,6 @@ linux-musl)
200204
MAKEFLAGS="$MAKEFLAGS NO_REGEX=Yes ICONV_OMITS_BOM=Yes"
201205
MAKEFLAGS="$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8"
202206
;;
203-
esac
204-
205-
case "$jobname" in
206207
linux-leaks)
207208
export SANITIZE=leak
208209
export GIT_TEST_PASSING_SANITIZE_LEAK=true

0 commit comments

Comments
 (0)