Skip to content

Commit 07b98b4

Browse files
committed
Build improvements (#707)
This change makes the test be verbose and use parallelization if possible (when using gmake to build). (cherry picked from commit 54afccf)
1 parent b7d6ab8 commit 07b98b4

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- name: Test
4141
env:
4242
GOPATH: /home/runner/work/git2go
43-
run: make test-static
43+
run: make TEST_ARGS=-test.v test-static
4444

4545
build-static:
4646
strategy:
@@ -64,7 +64,7 @@ jobs:
6464
git submodule update --init
6565
make build-libgit2-static
6666
- name: Test
67-
run: make test-static
67+
run: make TEST_ARGS=-test.v test-static
6868

6969
build-dynamic:
7070
strategy:
@@ -86,7 +86,7 @@ jobs:
8686
git submodule update --init
8787
make build-libgit2-dynamic
8888
- name: Test
89-
run: make test-dynamic
89+
run: make TEST_ARGS=-test.v test-dynamic
9090

9191
build-system-dynamic:
9292
strategy:
@@ -110,7 +110,7 @@ jobs:
110110
git submodule update --init
111111
sudo env BUILD_LIBGIT_REF=v${{ matrix.libgit2 }} ./script/build-libgit2.sh --dynamic --system
112112
- name: Test
113-
run: make test
113+
run: make TEST_ARGS=-test.v test
114114

115115
build-system-static:
116116
strategy:

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
TEST_ARGS ?= --count=1
2+
13
default: test
24

35
# System library
46
# ==============
57
# This uses whatever version of libgit2 can be found in the system.
68
test:
79
go run script/check-MakeGitError-thread-lock.go
8-
go test --count=1 ./...
10+
go test $(TEST_ARGS) ./...
911

1012
install:
1113
go install ./...
@@ -28,7 +30,7 @@ test-dynamic: dynamic-build/install/lib/libgit2.so
2830
go run script/check-MakeGitError-thread-lock.go
2931
PKG_CONFIG_PATH=dynamic-build/install/lib/pkgconfig \
3032
LD_LIBRARY_PATH=dynamic-build/install/lib \
31-
go test --count=1 ./...
33+
go test $(TEST_ARGS) ./...
3234

3335
install-dynamic: dynamic-build/install/lib/libgit2.so
3436
PKG_CONFIG_PATH=dynamic-build/install/lib/pkgconfig \
@@ -47,7 +49,7 @@ static-build/install/lib/libgit2.a:
4749

4850
test-static: static-build/install/lib/libgit2.a
4951
go run script/check-MakeGitError-thread-lock.go
50-
go test --count=1 --tags "static" ./...
52+
go test --tags "static" $(TEST_ARGS) ./...
5153

5254
install-static: static-build/install/lib/libgit2.a
5355
go install --tags "static" ./...

script/build-libgit2.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,9 @@ cmake -DTHREADSAFE=ON \
7070
-DCMAKE_INSTALL_LIBDIR="lib" \
7171
"${VENDORED_PATH}" &&
7272

73+
if which gmake nproc >/dev/null && [ -f Makefile ]; then
74+
# Make the build parallel if gmake is available and cmake used Makefiles.
75+
exec gmake "-j$(nproc --all)" install
76+
fi
77+
7378
exec cmake --build . --target install

0 commit comments

Comments
 (0)