Skip to content

Commit c03fcf0

Browse files
committed
Refresh the GitHub Actions CI
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 462ebd8 commit c03fcf0

File tree

3 files changed

+72
-10
lines changed

3 files changed

+72
-10
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: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
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
1621

1722
case "$1" in
1823
--static)
@@ -25,12 +30,25 @@ case "$1" in
2530
BUILD_SHARED_LIBS=ON
2631
;;
2732

33+
--system)
34+
BUILD_SYSTEM=ON
35+
;;
36+
2837
*)
29-
echo "Usage: $0 <--dynamic|--static>">&2
30-
exit 1
38+
usage
3139
;;
3240
esac
3341

42+
if [ -z "${BUILD_SHARED_LIBS}" ]; then
43+
usage
44+
fi
45+
46+
if [ "${BUILD_SYSTEM}" = "ON" ]; then
47+
BUILD_INSTALL_PREFIX="/usr"
48+
else
49+
BUILD_INSTALL_PREFIX="${BUILD_PATH}/install"
50+
fi
51+
3452
mkdir -p "${BUILD_PATH}/build" "${BUILD_PATH}/install/lib"
3553

3654
cd "${BUILD_PATH}/build" &&
@@ -40,7 +58,7 @@ cmake -DTHREADSAFE=ON \
4058
-DREGEX_BACKEND=builtin \
4159
-DCMAKE_C_FLAGS=-fPIC \
4260
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
43-
-DCMAKE_INSTALL_PREFIX="${BUILD_PATH}/install" \
61+
-DCMAKE_INSTALL_PREFIX="${BUILD_INSTALL_PREFIX}" \
4462
-DCMAKE_INSTALL_LIBDIR="lib" \
4563
"${VENDORED_PATH}" &&
4664

0 commit comments

Comments
 (0)