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 956d2e4639 (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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2021-11-23 17:29:11 +01:00 committed by Junio C Hamano
parent c08bb26010
commit 707d2f2fe8
3 changed files with 29 additions and 28 deletions

View File

@ -227,12 +227,14 @@ jobs:
pool: ubuntu-latest pool: ubuntu-latest
- jobname: linux-gcc - jobname: linux-gcc
cc: gcc cc: gcc
cc_package: gcc-8
pool: ubuntu-latest pool: ubuntu-latest
- jobname: osx-clang - jobname: osx-clang
cc: clang cc: clang
pool: macos-latest pool: macos-latest
- jobname: osx-gcc - jobname: osx-gcc
cc: gcc cc: gcc
cc_package: gcc-9
pool: macos-latest pool: macos-latest
- jobname: linux-gcc-default - jobname: linux-gcc-default
cc: gcc cc: gcc
@ -242,7 +244,9 @@ jobs:
pool: ubuntu-latest pool: ubuntu-latest
env: env:
CC: ${{matrix.vector.cc}} CC: ${{matrix.vector.cc}}
CC_PACKAGE: ${{matrix.vector.cc_package}}
jobname: ${{matrix.vector.jobname}} jobname: ${{matrix.vector.jobname}}
runs_on_pool: ${{matrix.vector.pool}}
runs-on: ${{matrix.vector.pool}} runs-on: ${{matrix.vector.pool}}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -11,17 +11,11 @@ UBUNTU_COMMON_PKGS="make libssl-dev libcurl4-openssl-dev libexpat-dev
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl
libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl" libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl"
case "$jobname" in case "$runs_on_pool" in
linux-clang|linux-gcc|linux-leaks) ubuntu-latest)
sudo apt-get -q update sudo apt-get -q update
sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \ sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \
$UBUNTU_COMMON_PKGS $UBUNTU_COMMON_PKGS $CC_PACKAGE
case "$jobname" in
linux-gcc)
sudo apt-get -q -y install gcc-8
;;
esac
mkdir --parents "$P4_PATH" mkdir --parents "$P4_PATH"
pushd "$P4_PATH" pushd "$P4_PATH"
wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d" wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d"
@ -36,7 +30,7 @@ linux-clang|linux-gcc|linux-leaks)
cp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs . cp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .
popd popd
;; ;;
osx-clang|osx-gcc) macos-latest)
export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
# Uncomment this if you want to run perf tests: # Uncomment this if you want to run perf tests:
# brew install gnu-time # brew install gnu-time
@ -50,15 +44,17 @@ osx-clang|osx-gcc)
brew install --cask --no-quarantine perforce brew install --cask --no-quarantine perforce
} || } ||
brew install homebrew/cask/perforce brew install homebrew/cask/perforce
case "$jobname" in
osx-gcc) if test -n "$CC_PACKAGE"
brew install gcc@9 then
# Just in case the image is updated to contain gcc@9 BREW_PACKAGE=${CC_PACKAGE/-/@}
# pre-installed but not linked. brew install "$BREW_PACKAGE"
brew link gcc@9 brew link "$BREW_PACKAGE"
;; fi
esac
;; ;;
esac
case "$jobname" in
StaticAnalysis) StaticAnalysis)
sudo apt-get -q update sudo apt-get -q update
sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \ sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \

View File

@ -156,11 +156,15 @@ export DEFAULT_TEST_TARGET=prove
export GIT_TEST_CLONE_2GB=true export GIT_TEST_CLONE_2GB=true
export SKIP_DASHED_BUILT_INS=YesPlease export SKIP_DASHED_BUILT_INS=YesPlease
case "$jobname" in case "$runs_on_pool" in
linux-clang|linux-gcc|linux-leaks) ubuntu-latest)
if test "$jobname" = "linux-gcc-default"
then
break
fi
if [ "$jobname" = linux-gcc ] if [ "$jobname" = linux-gcc ]
then then
export CC=gcc-8
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3" MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3"
else else
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python2" MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python2"
@ -180,17 +184,17 @@ linux-clang|linux-gcc|linux-leaks)
GIT_LFS_PATH="$HOME/custom/git-lfs" GIT_LFS_PATH="$HOME/custom/git-lfs"
export PATH="$GIT_LFS_PATH:$P4_PATH:$PATH" export PATH="$GIT_LFS_PATH:$P4_PATH:$PATH"
;; ;;
osx-clang|osx-gcc) macos-latest)
if [ "$jobname" = osx-gcc ] if [ "$jobname" = osx-gcc ]
then then
export CC=gcc-9
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python3)" MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python3)"
else else
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python2)" MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python2)"
fi fi
;; ;;
linux-gcc-default) esac
;;
case "$jobname" in
linux32) linux32)
CC=gcc CC=gcc
;; ;;
@ -200,9 +204,6 @@ linux-musl)
MAKEFLAGS="$MAKEFLAGS NO_REGEX=Yes ICONV_OMITS_BOM=Yes" MAKEFLAGS="$MAKEFLAGS NO_REGEX=Yes ICONV_OMITS_BOM=Yes"
MAKEFLAGS="$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8" MAKEFLAGS="$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8"
;; ;;
esac
case "$jobname" in
linux-leaks) linux-leaks)
export SANITIZE=leak export SANITIZE=leak
export GIT_TEST_PASSING_SANITIZE_LEAK=true export GIT_TEST_PASSING_SANITIZE_LEAK=true