Skip to content

Commit 5314951

Browse files
authored
Refresh the GitHub Actions CI (libgit2#632)
This change: * Builds the library with Go 1.14, too. * Builds the non-legacy tests with Ubuntu Focal (20.04). * Adds testing for system-wide libraries, both static and dynamic versions. * Fixes a typo in the README.
1 parent fc6eaf3 commit 5314951

File tree

3 files changed

+88
-23
lines changed

3 files changed

+88
-23
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ jobs:
4646
strategy:
4747
fail-fast: false
4848
matrix:
49-
go: [ '1.11', '1.12', '1.13' ]
49+
go: [ '1.11', '1.12', '1.13', '1.14' ]
5050
name: Go ${{ matrix.go }}
5151

52-
runs-on: ubuntu-18.04
52+
runs-on: ubuntu-20.04
5353

5454
steps:
5555
- name: Set up Go
@@ -71,13 +71,13 @@ jobs:
7171
fail-fast: false
7272
name: Go (dynamic)
7373

74-
runs-on: ubuntu-18.04
74+
runs-on: ubuntu-20.04
7575

7676
steps:
7777
- name: Set up Go
7878
uses: actions/setup-go@v1
7979
with:
80-
go-version: '1.13'
80+
go-version: '1.14'
8181
id: go
8282
- name: Check out code into the Go module directory
8383
uses: actions/checkout@v1
@@ -87,3 +87,47 @@ jobs:
8787
make build-libgit2-dynamic
8888
- name: Test
8989
run: make test-dynamic
90+
91+
build-system-dynamic:
92+
strategy:
93+
fail-fast: false
94+
name: Go (system-wide, dynamic)
95+
96+
runs-on: ubuntu-20.04
97+
98+
steps:
99+
- name: Set up Go
100+
uses: actions/setup-go@v1
101+
with:
102+
go-version: '1.14'
103+
id: go
104+
- name: Check out code into the Go module directory
105+
uses: actions/checkout@v1
106+
- name: Build libgit2
107+
run: |
108+
git submodule update --init
109+
sudo ./script/build-libgit2.sh --dynamic --system
110+
- name: Test
111+
run: make test
112+
113+
build-system-static:
114+
strategy:
115+
fail-fast: false
116+
name: Go (system-wide, static)
117+
118+
runs-on: ubuntu-20.04
119+
120+
steps:
121+
- name: Set up Go
122+
uses: actions/setup-go@v1
123+
with:
124+
go-version: '1.14'
125+
id: go
126+
- name: Check out code into the Go module directory
127+
uses: actions/checkout@v1
128+
- name: Build libgit2
129+
run: |
130+
git submodule update --init
131+
sudo ./script/build-libgit2.sh --static --system
132+
- name: Test
133+
run: go test --count=1 --tags "static,system_libgit2" ./...

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The `master` branch follows the tip of libgit2 itself (with some lag) and as suc
3131

3232
### Which branch to send Pull requests to
3333

34-
If there's something version-specific that you'd want to contribute to, you can send them to the `release-${MAJOR}-${MINOR}` branches, which follow libgit2's releases.
34+
If there's something version-specific that you'd want to contribute to, you can send them to the `release-${MAJOR}.${MINOR}` branches, which follow libgit2's releases.
3535

3636
Installing
3737
----------

script/build-libgit2.sh

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,62 @@
66

77
set -e
88

9-
if [ "$#" -eq "0" ]; then
10-
echo "Usage: $0 <--dynamic|--static>">&2
9+
usage() {
10+
echo "Usage: $0 <--dynamic|--static> [--system]">&2
1111
exit 1
12+
}
13+
14+
if [ "$#" -eq "0" ]; then
15+
usage
1216
fi
1317

1418
ROOT="$(cd "$(dirname "$0")/.." && echo "${PWD}")"
1519
VENDORED_PATH="${ROOT}/vendor/libgit2"
20+
BUILD_SYSTEM=OFF
21+
22+
while [ $# -gt 0 ]; do
23+
case "$1" in
24+
--static)
25+
BUILD_PATH="${ROOT}/static-build"
26+
BUILD_SHARED_LIBS=OFF
27+
;;
1628

17-
case "$1" in
18-
--static)
19-
BUILD_PATH="${ROOT}/static-build"
20-
BUILD_SHARED_LIBS=OFF
21-
;;
29+
--dynamic)
30+
BUILD_PATH="${ROOT}/dynamic-build"
31+
BUILD_SHARED_LIBS=ON
32+
;;
2233

23-
--dynamic)
24-
BUILD_PATH="${ROOT}/dynamic-build"
25-
BUILD_SHARED_LIBS=ON
26-
;;
34+
--system)
35+
BUILD_SYSTEM=ON
36+
;;
2737

28-
*)
29-
echo "Usage: $0 <--dynamic|--static>">&2
30-
exit 1
31-
;;
32-
esac
38+
*)
39+
usage
40+
;;
41+
esac
42+
shift
43+
done
3344

34-
mkdir -p "${BUILD_PATH}/build" "${BUILD_PATH}/install/lib"
45+
if [ -z "${BUILD_SHARED_LIBS}" ]; then
46+
usage
47+
fi
48+
49+
if [ "${BUILD_SYSTEM}" = "ON" ]; then
50+
BUILD_INSTALL_PREFIX="/usr"
51+
else
52+
BUILD_INSTALL_PREFIX="${BUILD_PATH}/install"
53+
mkdir -p "${BUILD_PATH}/install/lib"
54+
fi
3555

56+
mkdir -p "${BUILD_PATH}/build" &&
3657
cd "${BUILD_PATH}/build" &&
3758
cmake -DTHREADSAFE=ON \
3859
-DBUILD_CLAR=OFF \
3960
-DBUILD_SHARED_LIBS"=${BUILD_SHARED_LIBS}" \
4061
-DREGEX_BACKEND=builtin \
4162
-DCMAKE_C_FLAGS=-fPIC \
4263
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
43-
-DCMAKE_INSTALL_PREFIX="${BUILD_PATH}/install" \
64+
-DCMAKE_INSTALL_PREFIX="${BUILD_INSTALL_PREFIX}" \
4465
-DCMAKE_INSTALL_LIBDIR="lib" \
4566
"${VENDORED_PATH}" &&
4667

0 commit comments

Comments
 (0)