Skip to content

Commit 4835594

Browse files
committed
Build variants in parallel
1 parent e61ef06 commit 4835594

2 files changed

Lines changed: 47 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,64 @@ jobs:
1212
name: ${{ matrix.name }}
1313
runs-on: ${{ matrix.os }}
1414
env:
15-
RID: ${{ matrix.name }}
15+
RID: ${{ matrix.rid }}
16+
VARIANT: ${{ matrix.variant }}
1617
strategy:
1718
matrix:
1819
include:
1920
- os: windows-2022
2021
name: win-x86
22+
rid: win-x86
2123
param: -x86
2224
- os: windows-2022
2325
name: win-x64
26+
rid: win-x64
2427
param: -x64
2528
- os: windows-2022
2629
name: win-arm64
30+
rid: win-arm64
2731
param: -arm64
2832
- os: ubuntu-24.04
2933
name: linux-x64
34+
rid: linux-x64
35+
- os: ubuntu-24.04
36+
name: linux-x64-openssl1.1
37+
rid: linux-x64
38+
variant: openssl1.1
3039
- os: ubuntu-24.04
3140
name: linux-arm
41+
rid: linux-arm
42+
- os: ubuntu-24.04
43+
name: linux-arm-openssl1.1
44+
rid: linux-arm
45+
variant: openssl1.1
3246
- os: ubuntu-24.04
3347
name: linux-arm64
48+
rid: linux-arm64
49+
- os: ubuntu-24.04
50+
name: linux-arm64-openssl1.1
51+
rid: linux-arm64
52+
variant: openssl1.1
53+
# debian:bullseye-slim has no ppc64le manifest, so the openssl1.1
54+
# variant is omitted for this RID.
3455
- os: ubuntu-24.04
3556
name: linux-ppc64le
57+
rid: linux-ppc64le
3658
- os: ubuntu-24.04
3759
name: linux-musl-x64
60+
rid: linux-musl-x64
3861
- os: ubuntu-24.04
3962
name: linux-musl-arm
63+
rid: linux-musl-arm
4064
- os: ubuntu-24.04
4165
name: linux-musl-arm64
66+
rid: linux-musl-arm64
4267
- os: macos-26-intel
4368
name: osx-x64
69+
rid: osx-x64
4470
- os: macos-26
4571
name: osx-arm64
72+
rid: osx-arm64
4673
fail-fast: false
4774
steps:
4875
- name: Checkout
@@ -56,7 +83,7 @@ jobs:
5683
if: runner.os == 'macOS'
5784
run: ./build.libgit2.sh
5885
- name: Setup QEMU
59-
if: runner.os == 'Linux' && (matrix.name == 'linux-arm' || matrix.name == 'linux-arm64' || matrix.name == 'linux-ppc64le' || matrix.name == 'linux-musl-arm' || matrix.name == 'linux-musl-arm64')
86+
if: runner.os == 'Linux' && (matrix.rid == 'linux-arm' || matrix.rid == 'linux-arm64' || matrix.rid == 'linux-ppc64le' || matrix.rid == 'linux-musl-arm' || matrix.rid == 'linux-musl-arm64')
6087
uses: docker/setup-qemu-action@v4
6188
- name: Set up Docker Buildx
6289
if: runner.os == 'Linux'
@@ -68,7 +95,7 @@ jobs:
6895
uses: actions/upload-artifact@v7.0.0
6996
with:
7097
name: ${{ matrix.name }}
71-
path: nuget.package/runtimes/${{ matrix.name }}
98+
path: nuget.package/runtimes/${{ matrix.rid }}
7299
package:
73100
name: Create package
74101
needs: build
@@ -103,6 +130,17 @@ jobs:
103130
uses: actions/download-artifact@v8.0.1
104131
with:
105132
path: nuget.package/runtimes/
133+
- name: Merge variant artifacts into RID directories
134+
shell: bash
135+
run: |
136+
cd nuget.package/runtimes
137+
for d in *-openssl1.1; do
138+
[[ -d "$d" ]] || continue
139+
rid="${d%-openssl1.1}"
140+
mkdir -p "$rid/native"
141+
mv "$d/native/"* "$rid/native/"
142+
rm -rf "$d"
143+
done
106144
- name: Create package
107145
run: dotnet pack nuget.package ${{ steps.version.outputs.override && format('/p:MinVerVersionOverride={0}', steps.version.outputs.override) || '' }}
108146
- name: Upload NuGet package

dockerbuild.sh

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
set -e
4-
echo "building for $RID"
4+
echo "building for $RID variant=${VARIANT:-default}"
55

66
# Map RID to Docker platform for native builds (no cross-compilation).
77
if [[ $RID =~ arm64 ]]; then
@@ -40,18 +40,12 @@ mkdir -p nuget.package/runtimes/$RID/native
4040
if [[ $RID == linux-musl* ]]; then
4141
build_in_container "$RID" "Dockerfile.linux-musl" "" ""
4242
extract_runtimes "$RID"
43-
elif [[ $RID == linux-ppc64le ]]; then
44-
# debian:bullseye-slim has no ppc64le manifest, so we skip the openssl1.1
45-
# variant on this arch and ship only the default OpenSSL 3 build.
46-
build_in_container "$RID" "Dockerfile.linux" "" ""
47-
extract_runtimes "$RID"
43+
elif [[ "$VARIANT" == "openssl1.1" ]]; then
44+
# Built on bullseye against OpenSSL 1.1, libssh2 statically linked.
45+
build_in_container "$RID-openssl1.1" "Dockerfile.linux-static-libssh2" "openssl1.1" "debian:bullseye-slim"
46+
extract_runtimes "$RID-openssl1.1"
4847
else
49-
# All glibc-based Linux RIDs get two variants:
50-
# 1. Default: built on bookworm against OpenSSL 3, libssh2 bundled as a separate .so
51-
# 2. openssl1.1: built on bullseye against OpenSSL 1.1, libssh2 statically linked
48+
# Default: built on bookworm against OpenSSL 3, libssh2 bundled as a separate .so.
5249
build_in_container "$RID" "Dockerfile.linux" "" ""
5350
extract_runtimes "$RID"
54-
55-
build_in_container "$RID-openssl1.1" "Dockerfile.linux-static-libssh2" "openssl1.1" "debian:bullseye-slim"
56-
extract_runtimes "$RID-openssl1.1"
5751
fi

0 commit comments

Comments
 (0)