Skip to content

Refresh the GitHub Actions CI #632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 48 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
strategy:
fail-fast: false
matrix:
go: [ '1.11', '1.12', '1.13' ]
go: [ '1.11', '1.12', '1.13', '1.14' ]
name: Go ${{ matrix.go }}

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- name: Set up Go
Expand All @@ -71,13 +71,13 @@ jobs:
fail-fast: false
name: Go (dynamic)

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.13'
go-version: '1.14'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
Expand All @@ -87,3 +87,47 @@ jobs:
make build-libgit2-dynamic
- name: Test
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" ./...
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The `master` branch follows the tip of libgit2 itself (with some lag) and as suc

### 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
----------
Expand Down
57 changes: 39 additions & 18 deletions script/build-libgit2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,62 @@

set -e

if [ "$#" -eq "0" ]; then
echo "Usage: $0 <--dynamic|--static>">&2
usage() {
echo "Usage: $0 <--dynamic|--static> [--system]">&2
exit 1
}

if [ "$#" -eq "0" ]; then
usage
fi

ROOT="$(cd "$(dirname "$0")/.." && echo "${PWD}")"
VENDORED_PATH="${ROOT}/vendor/libgit2"
BUILD_SYSTEM=OFF

while [ $# -gt 0 ]; do
case "$1" in
--static)
BUILD_PATH="${ROOT}/static-build"
BUILD_SHARED_LIBS=OFF
;;

case "$1" in
--static)
BUILD_PATH="${ROOT}/static-build"
BUILD_SHARED_LIBS=OFF
;;
--dynamic)
BUILD_PATH="${ROOT}/dynamic-build"
BUILD_SHARED_LIBS=ON
;;

--dynamic)
BUILD_PATH="${ROOT}/dynamic-build"
BUILD_SHARED_LIBS=ON
;;
--system)
BUILD_SYSTEM=ON
;;

*)
echo "Usage: $0 <--dynamic|--static>">&2
exit 1
;;
esac
*)
usage
;;
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" &&
cmake -DTHREADSAFE=ON \
-DBUILD_CLAR=OFF \
-DBUILD_SHARED_LIBS"=${BUILD_SHARED_LIBS}" \
-DREGEX_BACKEND=builtin \
-DCMAKE_C_FLAGS=-fPIC \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
-DCMAKE_INSTALL_PREFIX="${BUILD_PATH}/install" \
-DCMAKE_INSTALL_PREFIX="${BUILD_INSTALL_PREFIX}" \
-DCMAKE_INSTALL_LIBDIR="lib" \
"${VENDORED_PATH}" &&

Expand Down