Skip to content

Commit d25ad94

Browse files
committed
Merge branch 'ps/ci-test-with-jgit'
Tests to ensure interoperability between reftable written by jgit and our code have been added and enabled in CI. * ps/ci-test-with-jgit: t0612: add tests to exercise Git/JGit reftable compatibility t0610: fix non-portable variable assignment t06xx: always execute backend-specific tests ci: install JGit dependency ci: make Perforce binaries executable for all users ci: merge scripts which install dependencies ci: fix setup of custom path for GitLab CI ci: merge custom PATH directories ci: convert "install-dependencies.sh" to use "/bin/sh" ci: drop duplicate package installation for "linux-gcc-default" ci: skip sudo when we are already root ci: expose distro name in dockerized GitHub jobs ci: rename "runs_on_pool" to "distro"
2 parents 5aec723 + 70b81fb commit d25ad94

9 files changed

+228
-109
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ jobs:
303303
CC: ${{matrix.vector.cc}}
304304
CC_PACKAGE: ${{matrix.vector.cc_package}}
305305
jobname: ${{matrix.vector.jobname}}
306-
runs_on_pool: ${{matrix.vector.pool}}
306+
distro: ${{matrix.vector.pool}}
307307
runs-on: ${{matrix.vector.pool}}
308308
steps:
309309
- uses: actions/checkout@v4
@@ -342,20 +342,24 @@ jobs:
342342
vector:
343343
- jobname: linux-musl
344344
image: alpine
345+
distro: alpine-latest
345346
- jobname: linux32
346347
image: daald/ubuntu32:xenial
348+
distro: ubuntu32-16.04
347349
- jobname: pedantic
348350
image: fedora
351+
distro: fedora-latest
349352
env:
350353
jobname: ${{matrix.vector.jobname}}
354+
distro: ${{matrix.vector.distro}}
351355
runs-on: ubuntu-latest
352356
container: ${{matrix.vector.image}}
353357
steps:
354358
- uses: actions/checkout@v4
355359
if: matrix.vector.jobname != 'linux32'
356360
- uses: actions/checkout@v1 # cannot be upgraded because Node.js Actions aren't supported in this container
357361
if: matrix.vector.jobname == 'linux32'
358-
- run: ci/install-docker-dependencies.sh
362+
- run: ci/install-dependencies.sh
359363
- run: ci/run-build-and-tests.sh
360364
- name: print test failures
361365
if: failure() && env.FAILED_TEST_ARTIFACTS != ''

.gitlab-ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ workflow:
99

1010
test:linux:
1111
image: $image
12+
variables:
13+
CUSTOM_PATH: "/custom"
1214
before_script:
13-
- ./ci/install-docker-dependencies.sh
15+
- ./ci/install-dependencies.sh
1416
script:
1517
- useradd builder --create-home
1618
- chown -R builder "${CI_PROJECT_DIR}"
@@ -98,7 +100,7 @@ static-analysis:
98100
variables:
99101
jobname: StaticAnalysis
100102
before_script:
101-
- ./ci/install-docker-dependencies.sh
103+
- ./ci/install-dependencies.sh
102104
script:
103105
- ./ci/run-static-analysis.sh
104106
- ./ci/check-directional-formatting.bash

ci/install-dependencies.sh

Lines changed: 71 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,69 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22
#
33
# Install dependencies required to build and test Git on Linux and macOS
44
#
55

66
. ${0%/*}/lib.sh
77

8+
begin_group "Install dependencies"
9+
810
P4WHENCE=https://cdist2.perforce.com/perforce/r21.2
911
LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION
10-
UBUNTU_COMMON_PKGS="make libssl-dev libcurl4-openssl-dev libexpat-dev
11-
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl
12-
libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl"
12+
JGITWHENCE=https://repo.eclipse.org/content/groups/releases//org/eclipse/jgit/org.eclipse.jgit.pgm/6.8.0.202311291450-r/org.eclipse.jgit.pgm-6.8.0.202311291450-r.sh
1313

14-
case "$runs_on_pool" in
14+
# Make sudo a no-op and execute the command directly when running as root.
15+
# While using sudo would be fine on most platforms when we are root already,
16+
# some platforms like e.g. Alpine Linux do not have sudo available by default
17+
# and would thus break.
18+
if test "$(id -u)" -eq 0
19+
then
20+
sudo () {
21+
"$@"
22+
}
23+
fi
24+
25+
case "$distro" in
26+
alpine-*)
27+
apk add --update shadow sudo build-base curl-dev openssl-dev expat-dev gettext \
28+
pcre2-dev python3 musl-libintl perl-utils ncurses \
29+
apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
30+
bash cvs gnupg perl-cgi perl-dbd-sqlite >/dev/null
31+
;;
32+
fedora-*)
33+
dnf -yq update >/dev/null &&
34+
dnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
35+
;;
1536
ubuntu-*)
37+
# Required so that apt doesn't wait for user input on certain packages.
38+
export DEBIAN_FRONTEND=noninteractive
39+
1640
sudo apt-get -q update
17-
sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \
18-
$UBUNTU_COMMON_PKGS $CC_PACKAGE $PYTHON_PACKAGE
19-
mkdir --parents "$P4_PATH"
20-
pushd "$P4_PATH"
21-
wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d"
22-
wget --quiet "$P4WHENCE/bin.linux26x86_64/p4"
23-
chmod u+x p4d
24-
chmod u+x p4
25-
popd
26-
mkdir --parents "$GIT_LFS_PATH"
27-
pushd "$GIT_LFS_PATH"
28-
wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
29-
tar --extract --gunzip --file "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
30-
cp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .
31-
popd
41+
sudo apt-get -q -y install \
42+
language-pack-is libsvn-perl apache2 cvs cvsps git gnupg subversion \
43+
make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
44+
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
45+
libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
46+
${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
47+
48+
mkdir --parents "$CUSTOM_PATH"
49+
wget --quiet --directory-prefix="$CUSTOM_PATH" \
50+
"$P4WHENCE/bin.linux26x86_64/p4d" "$P4WHENCE/bin.linux26x86_64/p4"
51+
chmod a+x "$CUSTOM_PATH/p4d" "$CUSTOM_PATH/p4"
52+
53+
wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
54+
tar -xzf "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz" \
55+
-C "$CUSTOM_PATH" --strip-components=1 "git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs"
56+
rm "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
57+
58+
wget --quiet "$JGITWHENCE" --output-document="$CUSTOM_PATH/jgit"
59+
chmod a+x "$CUSTOM_PATH/jgit"
60+
;;
61+
ubuntu32-*)
62+
sudo linux32 --32bit i386 sh -c '
63+
apt update >/dev/null &&
64+
apt install -y build-essential libcurl4-openssl-dev \
65+
libssl-dev libexpat-dev gettext python >/dev/null
66+
'
3267
;;
3368
macos-*)
3469
export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
@@ -38,12 +73,11 @@ macos-*)
3873
brew install $BREW_INSTALL_PACKAGES
3974
brew link --force gettext
4075

41-
mkdir -p "$P4_PATH"
42-
pushd "$P4_PATH"
43-
wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
44-
tar -xf helix-core-server.tgz &&
45-
sudo xattr -d com.apple.quarantine p4 p4d 2>/dev/null || true
46-
popd
76+
mkdir -p "$CUSTOM_PATH"
77+
wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
78+
tar -xf helix-core-server.tgz -C "$CUSTOM_PATH" p4 p4d &&
79+
sudo xattr -d com.apple.quarantine "$CUSTOM_PATH/p4" "$CUSTOM_PATH/p4d" 2>/dev/null || true
80+
rm helix-core-server.tgz
4781

4882
if test -n "$CC_PACKAGE"
4983
then
@@ -72,10 +106,6 @@ Documentation)
72106
test -n "$ALREADY_HAVE_ASCIIDOCTOR" ||
73107
sudo gem install --version 1.5.8 asciidoctor
74108
;;
75-
linux-gcc-default)
76-
sudo apt-get -q update
77-
sudo apt-get -q -y install $UBUNTU_COMMON_PKGS
78-
;;
79109
esac
80110

81111
if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1
@@ -87,10 +117,21 @@ then
87117
else
88118
echo >&2 "WARNING: perforce wasn't installed, see above for clues why"
89119
fi
120+
90121
if type git-lfs >/dev/null 2>&1
91122
then
92123
echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
93124
git-lfs version
94125
else
95126
echo >&2 "WARNING: git-lfs wasn't installed, see above for clues why"
96127
fi
128+
129+
if type jgit >/dev/null 2>&1
130+
then
131+
echo "$(tput setaf 6)JGit Version$(tput sgr0)"
132+
jgit version
133+
else
134+
echo >&2 "WARNING: JGit wasn't installed, see above for clues why"
135+
fi
136+
137+
end_group "Install dependencies"

ci/install-docker-dependencies.sh

Lines changed: 0 additions & 46 deletions
This file was deleted.

ci/lib.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ then
279279

280280
cache_dir="$HOME/none"
281281

282-
runs_on_pool=$(echo "$CI_JOB_IMAGE" | tr : -)
282+
distro=$(echo "$CI_JOB_IMAGE" | tr : -)
283283
JOBS=$(nproc)
284284
else
285285
echo "Could not identify CI type" >&2
@@ -318,7 +318,7 @@ export DEFAULT_TEST_TARGET=prove
318318
export GIT_TEST_CLONE_2GB=true
319319
export SKIP_DASHED_BUILT_INS=YesPlease
320320

321-
case "$runs_on_pool" in
321+
case "$distro" in
322322
ubuntu-*)
323323
if test "$jobname" = "linux-gcc-default"
324324
then
@@ -340,23 +340,19 @@ ubuntu-*)
340340
# image.
341341
# Keep that in mind when you encounter a broken OS X build!
342342
export LINUX_GIT_LFS_VERSION="1.5.2"
343-
344-
P4_PATH="$HOME/custom/p4"
345-
GIT_LFS_PATH="$HOME/custom/git-lfs"
346-
export PATH="$GIT_LFS_PATH:$P4_PATH:$PATH"
347343
;;
348344
macos-*)
349345
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python3)"
350346
if [ "$jobname" != osx-gcc ]
351347
then
352348
MAKEFLAGS="$MAKEFLAGS APPLE_COMMON_CRYPTO_SHA1=Yes"
353349
fi
354-
355-
P4_PATH="$HOME/custom/p4"
356-
export PATH="$P4_PATH:$PATH"
357350
;;
358351
esac
359352

353+
CUSTOM_PATH="${CUSTOM_PATH:-$HOME/path}"
354+
export PATH="$CUSTOM_PATH:$PATH"
355+
360356
case "$jobname" in
361357
linux32)
362358
CC=gcc

t/t0600-reffiles-backend.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@ test_description='Test reffiles backend'
44

55
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7+
GIT_TEST_DEFAULT_REF_FORMAT=files
8+
export GIT_TEST_DEFAULT_REF_FORMAT
79

810
TEST_PASSES_SANITIZE_LEAK=true
911
. ./test-lib.sh
1012

11-
if ! test_have_prereq REFFILES
12-
then
13-
skip_all='skipping reffiles specific tests'
14-
test_done
15-
fi
16-
1713
test_expect_success 'setup' '
1814
git commit --allow-empty -m Initial &&
1915
C=$(git rev-parse HEAD) &&

t/t0601-reffiles-pack-refs.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@ test_description='git pack-refs should not change the branch semantic
99
This test runs git pack-refs and git show-ref and checks that the branch
1010
semantic is still the same.
1111
'
12+
1213
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
1314
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
15+
GIT_TEST_DEFAULT_REF_FORMAT=files
16+
export GIT_TEST_DEFAULT_REF_FORMAT
1417

1518
TEST_PASSES_SANITIZE_LEAK=true
1619
. ./test-lib.sh
1720

18-
if ! test_have_prereq REFFILES
19-
then
20-
skip_all='skipping reffiles specific tests'
21-
test_done
22-
fi
23-
2421
test_expect_success 'enable reflogs' '
2522
git config core.logallrefupdates true
2623
'

t/t0610-reftable-basics.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
#
55

66
test_description='reftable basics'
7+
78
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
89
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10+
GIT_TEST_DEFAULT_REF_FORMAT=reftable
11+
export GIT_TEST_DEFAULT_REF_FORMAT
912

1013
. ./test-lib.sh
1114

12-
if ! test_have_prereq REFTABLE
13-
then
14-
skip_all='skipping reftable tests; set GIT_TEST_DEFAULT_REF_FORMAT=reftable'
15-
test_done
16-
fi
17-
1815
INVALID_OID=$(test_oid 001)
1916

2017
test_expect_success 'init: creates basic reftable structures' '
@@ -81,8 +78,8 @@ test_expect_success 'init: reinitializing reftable with files backend fails' '
8178
'
8279

8380
test_expect_perms () {
84-
local perms="$1"
85-
local file="$2"
81+
local perms="$1" &&
82+
local file="$2" &&
8683
local actual="$(ls -l "$file")" &&
8784

8885
case "$actual" in

0 commit comments

Comments
 (0)