build cross-compiled and emulated targets for releases only

This commit is contained in:
acetone
2026-10-03 02:51:57 -04:00
parent 296481f213
commit 70c3f0611a
5 changed files with 49 additions and 37 deletions
+27 -8
View File
@@ -20,8 +20,17 @@ on:
jobs:
build:
name: Build universal binary
runs-on: macos-15
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
# the universal binary needs cross-compilation, so it is built for releases only
include: ${{ fromJSON(github.ref_type == 'tag' && '[{"name":"universal","runner":"macos-15","archs":"arm64 x86_64"}]' || '[{"name":"arm64","runner":"macos-15","archs":"arm64"},{"name":"x86_64","runner":"macos-15-intel","archs":"x86_64"}]') }}
env:
ARCHS: ${{ matrix.archs }}
steps:
- name: Checkout
@@ -32,24 +41,34 @@ jobs:
- name: Check binary
run: |
lipo -archs i2pd | grep -w arm64
lipo -archs i2pd | grep -w x86_64
for arch in $ARCHS; do lipo -archs i2pd | grep -w $arch; done
otool -L i2pd
test -z "$(otool -L i2pd | grep -E '^[[:space:]]' | grep -vE '^[[:space:]]+(/usr/lib/|/System/Library/)')"
vtool -show-build i2pd | grep -E 'architecture|minos|sdk'
test "$(vtool -show-build i2pd | grep -c 'minos 12\.0$')" = 2
set -- $ARCHS
test "$(vtool -show-build i2pd | grep -c 'minos 12\.0$')" = $#
./i2pd --version
./i2pd --version | grep -E '^OpenSSL (3\.([5-9]|[1-9][0-9])|[4-9])\.'
./i2pd --version | grep -E '^Boost version 1\.(8[1-9]|9[0-9])\.'
- name: Run
run: |
mkdir datadir
./i2pd --datadir=datadir --log=file --logfile=datadir/i2pd.log --loglevel=info &
sleep 15
kill -0 $!
grep 'Daemon: Starting NetDB' datadir/i2pd.log
kill -9 $!
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: i2pd-macos
name: i2pd-macos-${{ matrix.name }}
path: i2pd
test:
name: Run on ${{ matrix.target-name }}
name: Run universal binary on ${{ matrix.target-name }}
if: github.ref_type == 'tag'
needs: build
runs-on: ${{ matrix.target }}
@@ -66,7 +85,7 @@ jobs:
- name: Download binary
uses: actions/download-artifact@v4
with:
name: i2pd-macos
name: i2pd-macos-universal
- name: Run
run: |
+8 -22
View File
@@ -22,41 +22,27 @@ on:
jobs:
build:
name: musl ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-latest
platform: linux/amd64
- arch: aarch64
runner: ubuntu-24.04-arm
platform: linux/arm64
- arch: armhf
runner: ubuntu-latest
platform: linux/arm/v6
qemu: true
- arch: x86
runner: ubuntu-latest
platform: linux/386
setarch: linux32
- arch: s390x
runner: ubuntu-latest
platform: linux/s390x
qemu: true
# armhf and s390x run under QEMU, so they are built for releases only
arch: ${{ fromJSON(github.ref_type == 'tag' && '["x86_64", "aarch64", "x86", "armhf", "s390x"]' || '["x86_64", "aarch64", "x86"]') }}
env:
PLATFORM: ${{ fromJSON('{"x86_64":"linux/amd64","aarch64":"linux/arm64","x86":"linux/386","armhf":"linux/arm/v6","s390x":"linux/s390x"}')[matrix.arch] }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
if: ${{ matrix.qemu }}
if: ${{ matrix.arch == 'armhf' || matrix.arch == 's390x' }}
uses: docker/setup-qemu-action@v3
- name: Build in Alpine
run: docker run --rm --platform ${{ matrix.platform }} -v "$PWD":/src -w /src alpine:3.22 ${{ matrix.setarch }} sh contrib/static/build-musl.sh
run: docker run --rm --platform $PLATFORM -v "$PWD":/src -w /src alpine:3.22 ${{ matrix.arch == 'x86' && 'linux32' || '' }} sh contrib/static/build-musl.sh
- name: Check binary
run: |
+2 -2
View File
@@ -80,8 +80,8 @@ jobs:
zip -qr9 release/i2pd_${TAG}_${build#*:}_mingw.zip i2pd.exe README.txt \
contrib/i2pd.conf contrib/tunnels.conf contrib/certificates contrib/tunnels.d contrib/webconsole
done
chmod +x artifacts/i2pd-macos/i2pd
tar -czf release/i2pd_${TAG}_osx.tar.gz -C artifacts/i2pd-macos i2pd
chmod +x artifacts/i2pd-macos-universal/i2pd
tar -czf release/i2pd_${TAG}_osx.tar.gz -C artifacts/i2pd-macos-universal i2pd
for dir in artifacts/i2pd-freebsd-*; do
chmod +x $dir/i2pd
rel=${dir##*-}