Skip to content

Commit ee0be29

Browse files
committed
Add CI job to compile git-crypt for 4 platform targets
Matrix: darwin-arm64, darwin-x64, linux-x64, linux-arm64. macOS builds statically link OpenSSL. Linux builds are fully static via Alpine/musl. Binaries uploaded as workflow artifacts.
1 parent 8ee861f commit ee0be29

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,78 @@ jobs:
2020
- run: npm run build
2121
- run: npm test
2222

23+
build-git-crypt:
24+
if: startsWith(github.ref, 'refs/tags/v')
25+
strategy:
26+
matrix:
27+
include:
28+
- target: darwin-arm64
29+
os: macos-14
30+
- target: darwin-x64
31+
os: macos-13
32+
- target: linux-x64
33+
os: ubuntu-latest
34+
platform: linux/amd64
35+
- target: linux-arm64
36+
os: ubuntu-latest
37+
platform: linux/arm64
38+
runs-on: ${{ matrix.os }}
39+
steps:
40+
- uses: actions/checkout@v6
41+
42+
- name: Read git-crypt version
43+
id: version
44+
run: |
45+
echo "version=$(sed -n '1p' git-crypt-version.txt)" >> "$GITHUB_OUTPUT"
46+
echo "checksum=$(sed -n '2p' git-crypt-version.txt)" >> "$GITHUB_OUTPUT"
47+
48+
- name: Download and verify git-crypt source
49+
run: |
50+
curl -fsSL "https://github.com/AGWA/git-crypt/archive/${{ steps.version.outputs.version }}.tar.gz" -o git-crypt-src.tar.gz
51+
echo "${{ steps.version.outputs.checksum }} git-crypt-src.tar.gz" | shasum -a 256 -c
52+
tar xzf git-crypt-src.tar.gz
53+
54+
- name: Build (macOS)
55+
if: runner.os == 'macOS'
56+
run: |
57+
brew install openssl@3
58+
OPENSSL_DIR="$(brew --prefix openssl@3)"
59+
cd "git-crypt-${{ steps.version.outputs.version }}"
60+
make CXXFLAGS="-O2 -Wall -I${OPENSSL_DIR}/include" LDLIBS="${OPENSSL_DIR}/lib/libcrypto.a"
61+
strip git-crypt
62+
mkdir -p ../bin
63+
cp git-crypt ../bin/
64+
65+
- name: Set up QEMU
66+
if: matrix.platform == 'linux/arm64'
67+
uses: docker/setup-qemu-action@v3
68+
69+
- name: Build (Linux static)
70+
if: runner.os == 'Linux'
71+
run: |
72+
docker run --rm --platform "${{ matrix.platform }}" \
73+
-v "$PWD:/build" -w /build alpine sh -c "
74+
apk add g++ make musl-dev openssl-dev file &&
75+
cd git-crypt-${{ steps.version.outputs.version }} &&
76+
LDFLAGS='-static' make &&
77+
strip git-crypt &&
78+
./git-crypt --version &&
79+
file git-crypt &&
80+
mkdir -p ../bin &&
81+
cp git-crypt ../bin/
82+
"
83+
84+
- name: Smoke test
85+
if: runner.os == 'macOS'
86+
run: |
87+
./bin/git-crypt --version
88+
file ./bin/git-crypt
89+
90+
- uses: actions/upload-artifact@v4
91+
with:
92+
name: git-crypt-${{ matrix.target }}
93+
path: bin/git-crypt
94+
2395
publish:
2496
needs: test
2597
if: startsWith(github.ref, 'refs/tags/v')

0 commit comments

Comments
 (0)