git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	"Victoria Dye" <vdye@github.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v2 4/6] CI: use "$runs_on_pool", not "$jobname" to select packages & config
Date: Sat, 20 Nov 2021 04:28:34 +0100	[thread overview]
Message-ID: <patch-v2-4.6-eca0ad08d4b-20211120T030848Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-v2-0.6-00000000000-20211120T030848Z-avarab@gmail.com>

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 956d2e4639b (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>
---
 .github/workflows/main.yml |  4 ++++
 ci/install-dependencies.sh | 32 ++++++++++++++------------------
 ci/lib.sh                  | 21 +++++++++++----------
 3 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index a91edec46d8..097be4c4405 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -229,6 +229,7 @@ jobs:
           - jobname: linux-gcc
             cc: gcc
             os: ubuntu
+            cc_package: gcc-8
             pool: ubuntu-latest
           - jobname: osx-clang
             cc: clang
@@ -237,6 +238,7 @@ jobs:
           - jobname: osx-gcc
             cc: gcc
             os: osx
+            cc_package: gcc-9
             pool: macos-latest
           - jobname: linux-gcc-default
             cc: gcc
@@ -248,7 +250,9 @@ jobs:
             pool: ubuntu-latest
     env:
       CC: ${{matrix.vector.cc}}
+      CC_PACKAGE: ${{matrix.vector.cc_package}}
       jobname: ${{matrix.vector.jobname}}
+      runs_on_pool: ${{matrix.vector.pool}}
     runs-on: ${{matrix.vector.pool}}
     steps:
     - uses: actions/checkout@v2
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 92e11c7198e..ca1eaa49c14 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -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
  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl"
 
-case "$jobname" in
-linux-clang|linux-gcc|linux-leaks)
+case "$runs_on_pool" in
+ubuntu-latest)
 	sudo apt-get -q update
 	sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \
-		$UBUNTU_COMMON_PKGS
-	case "$jobname" in
-	linux-gcc)
-		sudo apt-get -q -y install gcc-8
-		;;
-	esac
-
+		$UBUNTU_COMMON_PKGS $CC_PACKAGE
 	mkdir --parents "$P4_PATH"
 	pushd "$P4_PATH"
 		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 .
 	popd
 	;;
-osx-clang|osx-gcc)
+macos-latest)
 	export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
 	# Uncomment this if you want to run perf tests:
 	# brew install gnu-time
@@ -50,15 +44,17 @@ osx-clang|osx-gcc)
 		brew install --cask --no-quarantine perforce
 	} ||
 	brew install homebrew/cask/perforce
-	case "$jobname" in
-	osx-gcc)
-		brew install gcc@9
-		# Just in case the image is updated to contain gcc@9
-		# pre-installed but not linked.
-		brew link gcc@9
-		;;
-	esac
+
+	if test -n "$CC_PACKAGE"
+	then
+		BREW_PACKAGE=${CC_PACKAGE/-/@}
+		brew install "$BREW_PACKAGE"
+		brew link "$BREW_PACKAGE"
+	fi
 	;;
+esac
+
+case "$jobname" in
 StaticAnalysis)
 	sudo apt-get -q update
 	sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \
diff --git a/ci/lib.sh b/ci/lib.sh
index 0b3b0144882..cbc2f8f1caa 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -156,11 +156,15 @@ export DEFAULT_TEST_TARGET=prove
 export GIT_TEST_CLONE_2GB=true
 export SKIP_DASHED_BUILT_INS=YesPlease
 
-case "$jobname" in
-linux-clang|linux-gcc|linux-leaks)
+case "$runs_on_pool" in
+ubuntu-latest)
+	if test "$jobname" = "linux-gcc-default"
+	then
+		break
+	fi
+
 	if [ "$jobname" = linux-gcc ]
 	then
-		export CC=gcc-8
 		MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3"
 	else
 		MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python2"
@@ -180,17 +184,17 @@ linux-clang|linux-gcc|linux-leaks)
 	GIT_LFS_PATH="$HOME/custom/git-lfs"
 	export PATH="$GIT_LFS_PATH:$P4_PATH:$PATH"
 	;;
-osx-clang|osx-gcc)
+macos-latest)
 	if [ "$jobname" = osx-gcc ]
 	then
-		export CC=gcc-9
 		MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python3)"
 	else
 		MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python2)"
 	fi
 	;;
-linux-gcc-default)
-	;;
+esac
+
+case "$jobname" in
 linux32)
 	CC=gcc
 	;;
@@ -200,9 +204,6 @@ linux-musl)
 	MAKEFLAGS="$MAKEFLAGS NO_REGEX=Yes ICONV_OMITS_BOM=Yes"
 	MAKEFLAGS="$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8"
 	;;
-esac
-
-case "$jobname" in
 linux-leaks)
 	export SANITIZE=leak
 	export GIT_TEST_PASSING_SANITIZE_LEAK=true
-- 
2.34.0.823.gcc3243ae16c


  parent reply	other threads:[~2021-11-20  3:28 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 13:56 [PATCH 0/2] CI: use shorter names for CI jobs, less truncation Ævar Arnfjörð Bjarmason
2021-11-19 13:56 ` [PATCH 1/2] CI: use shorter names that fit in UX tooltips Ævar Arnfjörð Bjarmason
2021-11-19 14:58   ` Johannes Schindelin
2021-11-19 20:39     ` Ævar Arnfjörð Bjarmason
2021-11-19 16:02   ` Victoria Dye
2021-11-19 20:33     ` Ævar Arnfjörð Bjarmason
2021-11-19 21:55       ` Victoria Dye
2021-11-20  2:51         ` Ævar Arnfjörð Bjarmason
2021-11-19 22:14     ` Junio C Hamano
2021-11-19 13:56 ` [PATCH 2/2] CI: rename the "Linux32" job to lower-case "linux32" Ævar Arnfjörð Bjarmason
2021-11-19 14:57   ` Jeff King
2021-11-19 15:03 ` [PATCH 0/2] CI: use shorter names for CI jobs, less truncation Jeff King
2021-11-19 19:57 ` Junio C Hamano
2021-11-19 20:48   ` Ævar Arnfjörð Bjarmason
2021-11-20  3:28 ` [PATCH v2 0/6] CI: Remove Travis CI, shorten names for GH tooltips, split jobs Ævar Arnfjörð Bjarmason
2021-11-20  3:28   ` [PATCH v2 1/6] CI: remove Travis CI support Ævar Arnfjörð Bjarmason
2021-11-20  3:28   ` [PATCH v2 2/6] CI: use shorter names that fit in UX tooltips Ævar Arnfjörð Bjarmason
2021-11-20  7:01     ` Victoria Dye
2021-11-20  3:28   ` [PATCH v2 3/6] CI: rename the "Linux32" job to lower-case "linux32" Ævar Arnfjörð Bjarmason
2021-11-20  3:28   ` Ævar Arnfjörð Bjarmason [this message]
2021-11-20  3:28   ` [PATCH v2 5/6] CI: don't run "make test" twice in one job Ævar Arnfjörð Bjarmason
2021-11-20  3:28   ` [PATCH v2 6/6] CI: run "documentation" via run-build-and-test.sh Ævar Arnfjörð Bjarmason
2021-11-20  8:05   ` [PATCH v2 0/6] CI: Remove Travis CI, shorten names for GH tooltips, split jobs Johannes Schindelin
2021-11-20 12:14     ` Ævar Arnfjörð Bjarmason
2021-11-20 12:10   ` [PATCH v3 0/5] " Ævar Arnfjörð Bjarmason
2021-11-20 12:10     ` [PATCH v3 1/5] CI: remove Travis CI support Ævar Arnfjörð Bjarmason
2021-11-20 12:10     ` [PATCH v3 2/5] CI: use shorter names that fit in UX tooltips Ævar Arnfjörð Bjarmason
2021-11-20 19:06       ` Victoria Dye
2021-11-20 12:10     ` [PATCH v3 3/5] CI: rename the "Linux32" job to lower-case "linux32" Ævar Arnfjörð Bjarmason
2021-11-20 12:10     ` [PATCH v3 4/5] CI: use "$runs_on_pool", not "$jobname" to select packages & config Ævar Arnfjörð Bjarmason
2021-11-21  7:21       ` Junio C Hamano
2021-11-20 12:10     ` [PATCH v3 5/5] CI: don't run "make test" twice in one job Ævar Arnfjörð Bjarmason
2021-11-23 16:29     ` [PATCH v4 0/5] CI: Remove Travis CI, shorten names for GH tooltips, split jobs Ævar Arnfjörð Bjarmason
2021-11-23 16:29       ` [PATCH v4 1/5] CI: remove Travis CI support Ævar Arnfjörð Bjarmason
2021-11-23 16:29       ` [PATCH v4 2/5] CI: use shorter names that fit in UX tooltips Ævar Arnfjörð Bjarmason
2021-11-23 16:29       ` [PATCH v4 3/5] CI: rename the "Linux32" job to lower-case "linux32" Ævar Arnfjörð Bjarmason
2021-11-23 16:29       ` [PATCH v4 4/5] CI: use "$runs_on_pool", not "$jobname" to select packages & config Ævar Arnfjörð Bjarmason
2021-11-23 16:29       ` [PATCH v4 5/5] CI: don't run "make test" twice in one job Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=patch-v2-4.6-eca0ad08d4b-20211120T030848Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=szeder.dev@gmail.com \
    --cc=vdye@github.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).