Refresh the GitHub Actions CI (#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.

(cherry picked from commit 5314951759)
This commit is contained in:
lhchavez 2020-08-15 17:19:53 -07:00
parent ff0fed0c32
commit 6453cf9f8a
3 changed files with 88 additions and 23 deletions

View File

@ -46,10 +46,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
go: [ '1.11', '1.12', '1.13' ] go: [ '1.11', '1.12', '1.13', '1.14' ]
name: Go ${{ matrix.go }} name: Go ${{ matrix.go }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
steps: steps:
- name: Set up Go - name: Set up Go
@ -71,13 +71,13 @@ jobs:
fail-fast: false fail-fast: false
name: Go (dynamic) name: Go (dynamic)
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
steps: steps:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: '1.13' go-version: '1.14'
id: go id: go
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@v1 uses: actions/checkout@v1
@ -87,3 +87,47 @@ jobs:
make build-libgit2-dynamic make build-libgit2-dynamic
- name: Test - name: Test
run: make test-dynamic run: make test-dynamic
build-system-dynamic:
strategy:
fail-fast: false
name: Go (system-wide, dynamic)
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.14'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Build libgit2
run: |
git submodule update --init
sudo ./script/build-libgit2.sh --dynamic --system
- name: Test
run: make test
build-system-static:
strategy:
fail-fast: false
name: Go (system-wide, static)
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.14'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Build libgit2
run: |
git submodule update --init
sudo ./script/build-libgit2.sh --static --system
- name: Test
run: go test --count=1 --tags "static,system_libgit2" ./...

View File

@ -30,7 +30,7 @@ The `master` branch follows the tip of libgit2 itself (with some lag) and as suc
### Which branch to send Pull requests to ### Which branch to send Pull requests to
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. 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.
Installing Installing
---------- ----------

View File

@ -6,14 +6,20 @@
set -e set -e
if [ "$#" -eq "0" ]; then usage() {
echo "Usage: $0 <--dynamic|--static>">&2 echo "Usage: $0 <--dynamic|--static> [--system]">&2
exit 1 exit 1
}
if [ "$#" -eq "0" ]; then
usage
fi fi
ROOT="$(cd "$(dirname "$0")/.." && echo "${PWD}")" ROOT="$(cd "$(dirname "$0")/.." && echo "${PWD}")"
VENDORED_PATH="${ROOT}/vendor/libgit2" VENDORED_PATH="${ROOT}/vendor/libgit2"
BUILD_SYSTEM=OFF
while [ $# -gt 0 ]; do
case "$1" in case "$1" in
--static) --static)
BUILD_PATH="${ROOT}/static-build" BUILD_PATH="${ROOT}/static-build"
@ -25,21 +31,36 @@ case "$1" in
BUILD_SHARED_LIBS=ON BUILD_SHARED_LIBS=ON
;; ;;
--system)
BUILD_SYSTEM=ON
;;
*) *)
echo "Usage: $0 <--dynamic|--static>">&2 usage
exit 1
;; ;;
esac esac
shift
done
mkdir -p "${BUILD_PATH}/build" "${BUILD_PATH}/install/lib" if [ -z "${BUILD_SHARED_LIBS}" ]; then
usage
fi
if [ "${BUILD_SYSTEM}" = "ON" ]; then
BUILD_INSTALL_PREFIX="/usr"
else
BUILD_INSTALL_PREFIX="${BUILD_PATH}/install"
mkdir -p "${BUILD_PATH}/install/lib"
fi
mkdir -p "${BUILD_PATH}/build" &&
cd "${BUILD_PATH}/build" && cd "${BUILD_PATH}/build" &&
cmake -DTHREADSAFE=ON \ cmake -DTHREADSAFE=ON \
-DBUILD_CLAR=OFF \ -DBUILD_CLAR=OFF \
-DBUILD_SHARED_LIBS"=${BUILD_SHARED_LIBS}" \ -DBUILD_SHARED_LIBS"=${BUILD_SHARED_LIBS}" \
-DCMAKE_C_FLAGS=-fPIC \ -DCMAKE_C_FLAGS=-fPIC \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \ -DCMAKE_BUILD_TYPE="RelWithDebInfo" \
-DCMAKE_INSTALL_PREFIX="${BUILD_PATH}/install" \ -DCMAKE_INSTALL_PREFIX="${BUILD_INSTALL_PREFIX}" \
"${VENDORED_PATH}" && "${VENDORED_PATH}" &&
exec cmake --build . --target install exec cmake --build . --target install