ci: merge scripts which install dependencies
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>
Patrick Steinhardt committed
Apr 12, 2024 at 06:44 UTC
9cdeb34b962d5c1633ac5d23ebba4e24a816242a
4 files changed
+31
-53
.github/workflows/main.yml
+1
-1
@@ -359,7 +359,7 @@ jobs:
359
if: matrix.vector.jobname != 'linux32'
360
- uses: actions/checkout@v1 # cannot be upgraded because Node.js Actions aren't supported in this container
361
if: matrix.vector.jobname == 'linux32'
362
- - run: ci/install-docker-dependencies.sh
362
+ - run: ci/install-dependencies.sh
363
- run: ci/run-build-and-tests.sh
364
- name: print test failures
365
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
.gitlab-ci.yml
+2
-2
@@ -12,7 +12,7 @@ test:linux:
12
variables:
13
CUSTOM_PATH: "/custom"
14
before_script:
15
- - ./ci/install-docker-dependencies.sh
15
+ - ./ci/install-dependencies.sh
16
script:
17
- useradd builder --create-home
18
- chown -R builder "${CI_PROJECT_DIR}"
@@ -100,7 +100,7 @@ static-analysis:
100
variables:
101
jobname: StaticAnalysis
102
before_script:
103
- - ./ci/install-docker-dependencies.sh
103
+ - ./ci/install-dependencies.sh
104
script:
105
- ./ci/run-static-analysis.sh
106
- ./ci/check-directional-formatting.bash
ci/install-dependencies.sh
+28
-4
@@ -5,6 +5,8 @@
5
6
. ${0%/*}/lib.sh
7
8
+begin_group "Install dependencies"
9
+
10
P4WHENCE=https://cdist2.perforce.com/perforce/r21.2
11
LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION
12
@@ -20,14 +22,27 @@ then
22
fi
23
24
case "$distro" in
25
+alpine-*)
26
+ apk add --update shadow sudo build-base curl-dev openssl-dev expat-dev gettext \
27
+ pcre2-dev python3 musl-libintl perl-utils ncurses \
28
+ apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
29
+ bash cvs gnupg perl-cgi perl-dbd-sqlite >/dev/null
30
+ ;;
31
+fedora-*)
32
+ dnf -yq update >/dev/null &&
33
+ dnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
34
+ ;;
35
ubuntu-*)
36
+ # Required so that apt doesn't wait for user input on certain packages.
37
+ export DEBIAN_FRONTEND=noninteractive
38
+
39
sudo apt-get -q update
40
sudo apt-get -q -y install \
26
- language-pack-is libsvn-perl apache2 \
27
- make libssl-dev libcurl4-openssl-dev libexpat-dev \
41
+ language-pack-is libsvn-perl apache2 cvs cvsps git gnupg subversion \
42
+ make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo \
43
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
29
- libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl \
30
- $CC_PACKAGE $PYTHON_PACKAGE
44
+ libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
45
+ ${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
46
47
mkdir --parents "$CUSTOM_PATH"
48
wget --quiet --directory-prefix="$CUSTOM_PATH" \
@@ -39,6 +54,13 @@ ubuntu-*)
54
-C "$CUSTOM_PATH" --strip-components=1 "git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs"
55
rm "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
56
;;
57
+ubuntu32-*)
58
+ sudo linux32 --32bit i386 sh -c '
59
+ apt update >/dev/null &&
60
+ apt install -y build-essential libcurl4-openssl-dev \
61
+ libssl-dev libexpat-dev gettext python >/dev/null
62
+ '
63
+ ;;
64
macos-*)
65
export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
66
# Uncomment this if you want to run perf tests:
@@ -98,3 +120,5 @@ then
120
else
121
echo >&2 "WARNING: git-lfs wasn't installed, see above for clues why"
122
fi
123
+
124
+end_group "Install dependencies"
ci/install-docker-dependencies.sh
deleted
-46
@@ -1,46 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# Install dependencies required to build and test Git inside container
4
-#
5
-
6
-. ${0%/*}/lib.sh
7
-
8
-begin_group "Install dependencies"
9
-
10
-case "$jobname" in
11
-linux32)
12
- linux32 --32bit i386 sh -c '
13
- apt update >/dev/null &&
14
- apt install -y build-essential libcurl4-openssl-dev \
15
- libssl-dev libexpat-dev gettext python >/dev/null
16
- '
17
- ;;
18
-linux-musl)
19
- apk add --update shadow sudo build-base curl-dev openssl-dev expat-dev gettext \
20
- pcre2-dev python3 musl-libintl perl-utils ncurses \
21
- apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
22
- bash cvs gnupg perl-cgi perl-dbd-sqlite >/dev/null
23
- ;;
24
-linux-*|StaticAnalysis)
25
- # Required so that apt doesn't wait for user input on certain packages.
26
- export DEBIAN_FRONTEND=noninteractive
27
-
28
- apt update -q &&
29
- apt install -q -y sudo git make language-pack-is libsvn-perl apache2 libssl-dev \
30
- libcurl4-openssl-dev libexpat-dev tcl tk gettext zlib1g-dev \
31
- perl-modules liberror-perl libauthen-sasl-perl libemail-valid-perl \
32
- libdbd-sqlite3-perl libio-socket-ssl-perl libnet-smtp-ssl-perl ${CC_PACKAGE:-${CC:-gcc}} \
33
- apache2 cvs cvsps gnupg libcgi-pm-perl subversion
34
-
35
- if test "$jobname" = StaticAnalysis
36
- then
37
- apt install -q -y coccinelle
38
- fi
39
- ;;
40
-pedantic)
41
- dnf -yq update >/dev/null &&
42
- dnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
43
- ;;
44
-esac
45
-
46
-end_group "Install dependencies"