Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit c0bad1f

Browse files
author
Paulo Gomes
committed
build: add GH workflow test.yaml
Signed-off-by: Paulo Gomes <[email protected]>
1 parent 028519d commit c0bad1f

File tree

3 files changed

+82
-43
lines changed

3 files changed

+82
-43
lines changed

.github/workflows/build.yaml

+3-25
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,9 @@ permissions:
1717
id-token: write # needed for keyless signing
1818

1919
jobs:
20-
21-
darwin-all-libs-test:
22-
runs-on: macos-11
23-
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v3
26-
- name: Test build script for darwin-amd64 - libgit2-all
27-
run: |
28-
make dev-test
29-
rm -rf ${GITHUB_WORKSPACE}/build rm -rf ${GITHUB_WORKSPACE}/libgit2
30-
env:
31-
MACOSX_DEPLOYMENT_TARGET: 10.15
32-
33-
darwin-libgit2-only-test:
34-
runs-on: macos-11
35-
steps:
36-
- name: Checkout
37-
uses: actions/checkout@v3
38-
- name: Test build script for darwin-amd64 - libgit2-only
39-
run: |
40-
LIBGIT2_ONLY=true make dev-test
41-
env:
42-
MACOSX_DEPLOYMENT_TARGET: 10.15
43-
44-
docker-build-all-libs:
20+
# changing this job name for some reason caused GitHub checks to
21+
# hang at `Expected — Waiting for status to be reported`.
22+
build:
4523
runs-on: ubuntu-latest
4624
env:
4725
PLATFORMS: linux/amd64,linux/arm/v7,linux/arm64

.github/workflows/release.yaml

+34-18
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ on:
1212
default: 'rc'
1313
required: true
1414

15-
1615
permissions:
1716
contents: write # needed to write releases
1817
id-token: write # needed for keyless signing
1918

2019
jobs:
21-
2220
linux-x86_64-all-libs:
2321
runs-on: ubuntu-latest
2422
steps:
@@ -29,7 +27,7 @@ jobs:
2927
TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs \
3028
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
3129
./hack/static.sh all
32-
30+
3331
mkdir -p ./libgit2-linux-all-libs/
3432
mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs/include ./libgit2-linux-all-libs/
3533
mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs/share ./libgit2-linux-all-libs/
@@ -41,7 +39,7 @@ jobs:
4139
- uses: actions/upload-artifact@v3
4240
with:
4341
name: release-artifact
44-
path: '*.tar.gz'
42+
path: "*.tar.gz"
4543
if-no-files-found: error
4644

4745
linux-x86_64-libgit2-only:
@@ -64,7 +62,7 @@ jobs:
6462
- uses: actions/upload-artifact@v3
6563
with:
6664
name: release-artifact
67-
path: '*.tar.gz'
65+
path: "*.tar.gz"
6866
if-no-files-found: error
6967

7068
darwin-all-libs:
@@ -75,8 +73,8 @@ jobs:
7573
# both outcomes onto a single binary for each static library.
7674
#
7775
# `macos-11` has been picked as support for arm64 was only added on Xcode 12.
78-
# Although some minor versions of Catalina 10.15 can support it, at the time
79-
# of testing, GitHub's macos-10.15 did not seem to.
76+
# Although some minor versions of Catalina 10.15 can support it, at the time
77+
# of testing, GitHub's macos-10.15 did not seem to.
8078
# Cross-compiling to arm64 on that runner consistently failed.
8179
runs-on: macos-11
8280
steps:
@@ -90,22 +88,21 @@ jobs:
9088
TARGET_DIR=${GITHUB_WORKSPACE}/build/darwin-all-libs \
9189
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
9290
./hack/static.sh all
93-
91+
9492
TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64 \
9593
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/arm \
9694
TARGET_ARCH=arm64 \
9795
CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
9896
./hack/static.sh all
9997
10098
101-
LIBGIT2_SED="s;-L/Applications/Xcode_.* ;;g"
99+
LIBGIT2_SED="s;-L/Applications/Xcode.* ;;g"
102100
LIBGIT2PC="${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/pkgconfig/libgit2.pc"
103101
104-
# pkgconfig files may contain absolute paths to its dependencies that is specific
105-
# to the runner - machine used to compile the library.
106-
# We need to remove the absolute path of iconv, so when the library is consumed
107-
# pkgconfig will automatically try to find it through the default search paths
108-
# on the target machine.
102+
# pkgconfig includes absolute paths that are specific to the runner machine.
103+
# We need to remove the absolute path for iconv, so when the libgit2 library
104+
# is consumed pkgconfig will automatically try to find it through the default
105+
# search paths on the target machine.
109106
if command -v gsed &> /dev/null; then
110107
gsed -i "${LIBGIT2_SED}" "${LIBGIT2PC}"
111108
else
@@ -147,7 +144,7 @@ jobs:
147144
- uses: actions/upload-artifact@v3
148145
with:
149146
name: release-artifact
150-
path: '*.tar.gz'
147+
path: "*.tar.gz"
151148
if-no-files-found: error
152149

153150
# similar to darwin-all-libs, but only compiles libgit2.
@@ -168,6 +165,19 @@ jobs:
168165
CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
169166
./hack/static.sh build_libgit2_only
170167
168+
LIBGIT2_SED="s;-L/Applications/Xcode.* ;;g"
169+
LIBGIT2PC="${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/pkgconfig/libgit2.pc"
170+
171+
# pkgconfig includes absolute paths that are specific to the runner machine.
172+
# We need to remove the absolute path for iconv, so when the libgit2 library
173+
# is consumed pkgconfig will automatically try to find it through the default
174+
# search paths on the target machine.
175+
if command -v gsed &> /dev/null; then
176+
gsed -i "${LIBGIT2_SED}" "${LIBGIT2PC}"
177+
else
178+
sed -i "" "${LIBGIT2_SED}" "${LIBGIT2PC}"
179+
fi
180+
171181
mkdir -p ./darwin-libgit2-only/lib
172182
mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/include ./darwin-libgit2-only/
173183
@@ -182,13 +192,19 @@ jobs:
182192
- uses: actions/upload-artifact@v3
183193
with:
184194
name: release-artifact
185-
path: '*.tar.gz'
195+
path: "*.tar.gz"
186196
if-no-files-found: error
187197

188198
goreleaser:
189199
runs-on: ubuntu-latest
190-
needs: [linux-x86_64-all-libs, linux-x86_64-libgit2-only, darwin-all-libs, darwin-libgit2-only]
191-
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
200+
needs:
201+
[
202+
linux-x86_64-all-libs,
203+
linux-x86_64-libgit2-only,
204+
darwin-all-libs,
205+
darwin-libgit2-only,
206+
]
207+
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
192208
steps:
193209
- uses: actions/checkout@v3
194210
with:

.github/workflows/test.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: "Test"
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- README.md
9+
pull_request:
10+
paths-ignore:
11+
- README.md
12+
13+
permissions: {}
14+
15+
jobs:
16+
darwin-dev-test:
17+
strategy:
18+
matrix:
19+
libgit_only: [true, false]
20+
runs-on: macos-11
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
- name: Test build script for darwin-amd64
25+
run: |
26+
rm -rf ${GITHUB_WORKSPACE}/build
27+
make dev-test
28+
env:
29+
LIBGIT2_ONLY: ${{ matrix.libgit_only }}
30+
MACOSX_DEPLOYMENT_TARGET: 10.15
31+
32+
linux-dev-test:
33+
strategy:
34+
matrix:
35+
libgit_only: [true, false]
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v3
40+
- name: Test build script for linux-amd64
41+
run: |
42+
rm -rf ${GITHUB_WORKSPACE}/build
43+
make dev-test
44+
env:
45+
LIBGIT2_ONLY: ${{ matrix.libgit_only }}

0 commit comments

Comments
 (0)