]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ci: merge scripts which install dependencies
authorPatrick Steinhardt <ps@pks.im>
Fri, 12 Apr 2024 04:44:32 +0000 (06:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 Apr 2024 15:47:50 +0000 (08:47 -0700)
We have two different scripts which install dependencies, one for
dockerized jobs and one for non-dockerized ones. Naturally, these
scripts have quite some duplication. Furthermore, either of these
scripts is missing some test dependencies that the respective other
script has, thus reducing test coverage.

Merge those two scripts such that there is a single source of truth for
test dependencies, only.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
.github/workflows/main.yml
.gitlab-ci.yml
ci/install-dependencies.sh
ci/install-docker-dependencies.sh [deleted file]

index 71cd4e5486ca0c11102e320e1ff54d5a8310ec68..5838986895d3a5dff4c9d07e29410cd6631ece6a 100644 (file)
@@ -359,7 +359,7 @@ jobs:
       if: matrix.vector.jobname != 'linux32'
     - uses: actions/checkout@v1 # cannot be upgraded because Node.js Actions aren't supported in this container
       if: matrix.vector.jobname == 'linux32'
-    - run: ci/install-docker-dependencies.sh
+    - run: ci/install-dependencies.sh
     - run: ci/run-build-and-tests.sh
     - name: print test failures
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
index 3a0ef4d4d49f513386ed74d6518291b20f8e83e3..ba65f50aaca151bdc8b53e5aae810a588259d259 100644 (file)
@@ -12,7 +12,7 @@ test:linux:
   variables:
     CUSTOM_PATH: "/custom"
   before_script:
-    - ./ci/install-docker-dependencies.sh
+    - ./ci/install-dependencies.sh
   script:
     - useradd builder --create-home
     - chown -R builder "${CI_PROJECT_DIR}"
@@ -100,7 +100,7 @@ static-analysis:
   variables:
     jobname: StaticAnalysis
   before_script:
-    - ./ci/install-docker-dependencies.sh
+    - ./ci/install-dependencies.sh
   script:
     - ./ci/run-static-analysis.sh
     - ./ci/check-directional-formatting.bash
index bafe37f2d1059170076a60c5796dc47ef2fc95cb..e673797115f76a8f9471e4a9f0d31fef547546fd 100755 (executable)
@@ -5,6 +5,8 @@
 
 . ${0%/*}/lib.sh
 
+begin_group "Install dependencies"
+
 P4WHENCE=https://cdist2.perforce.com/perforce/r21.2
 LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION
 
@@ -20,14 +22,27 @@ then
 fi
 
 case "$distro" in
+alpine-*)
+       apk add --update shadow sudo build-base curl-dev openssl-dev expat-dev gettext \
+               pcre2-dev python3 musl-libintl perl-utils ncurses \
+               apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
+               bash cvs gnupg perl-cgi perl-dbd-sqlite >/dev/null
+       ;;
+fedora-*)
+       dnf -yq update >/dev/null &&
+       dnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
+       ;;
 ubuntu-*)
+       # Required so that apt doesn't wait for user input on certain packages.
+       export DEBIAN_FRONTEND=noninteractive
+
        sudo apt-get -q update
        sudo apt-get -q -y install \
-               language-pack-is libsvn-perl apache2 \
-               make libssl-dev libcurl4-openssl-dev libexpat-dev \
+               language-pack-is libsvn-perl apache2 cvs cvsps git gnupg subversion \
+               make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo \
                tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
-               libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl \
-               $CC_PACKAGE $PYTHON_PACKAGE
+               libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
+               ${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
 
        mkdir --parents "$CUSTOM_PATH"
        wget --quiet --directory-prefix="$CUSTOM_PATH" \
@@ -39,6 +54,13 @@ ubuntu-*)
                -C "$CUSTOM_PATH" --strip-components=1 "git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs"
        rm "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
        ;;
+ubuntu32-*)
+       sudo linux32 --32bit i386 sh -c '
+               apt update >/dev/null &&
+               apt install -y build-essential libcurl4-openssl-dev \
+                       libssl-dev libexpat-dev gettext python >/dev/null
+       '
+       ;;
 macos-*)
        export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
        # Uncomment this if you want to run perf tests:
@@ -98,3 +120,5 @@ then
 else
        echo >&2 "WARNING: git-lfs wasn't installed, see above for clues why"
 fi
+
+end_group "Install dependencies"
diff --git a/ci/install-docker-dependencies.sh b/ci/install-docker-dependencies.sh
deleted file mode 100755 (executable)
index eb2c9e1..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-#
-# Install dependencies required to build and test Git inside container
-#
-
-. ${0%/*}/lib.sh
-
-begin_group "Install dependencies"
-
-case "$jobname" in
-linux32)
-       linux32 --32bit i386 sh -c '
-               apt update >/dev/null &&
-               apt install -y build-essential libcurl4-openssl-dev \
-                       libssl-dev libexpat-dev gettext python >/dev/null
-       '
-       ;;
-linux-musl)
-       apk add --update shadow sudo build-base curl-dev openssl-dev expat-dev gettext \
-               pcre2-dev python3 musl-libintl perl-utils ncurses \
-               apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
-               bash cvs gnupg perl-cgi perl-dbd-sqlite >/dev/null
-       ;;
-linux-*|StaticAnalysis)
-       # Required so that apt doesn't wait for user input on certain packages.
-       export DEBIAN_FRONTEND=noninteractive
-
-       apt update -q &&
-       apt install -q -y sudo git make language-pack-is libsvn-perl apache2 libssl-dev \
-               libcurl4-openssl-dev libexpat-dev tcl tk gettext zlib1g-dev \
-               perl-modules liberror-perl libauthen-sasl-perl libemail-valid-perl \
-               libdbd-sqlite3-perl libio-socket-ssl-perl libnet-smtp-ssl-perl ${CC_PACKAGE:-${CC:-gcc}} \
-               apache2 cvs cvsps gnupg libcgi-pm-perl subversion
-
-       if test "$jobname" = StaticAnalysis
-       then
-               apt install -q -y coccinelle
-       fi
-       ;;
-pedantic)
-       dnf -yq update >/dev/null &&
-       dnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
-       ;;
-esac
-
-end_group "Install dependencies"