1212 description : ' Git ref (SHA or branch) to build from. If omitted, uses the default checkout.'
1313 required : false
1414 type : string
15+ version :
16+ description : ' Version override. If omitted, the build resolves it via git describe.'
17+ required : false
18+ type : string
1519 workflow_call :
1620 inputs :
1721 ref :
1822 description : ' Git ref (SHA or branch) to build from. If omitted, uses the default checkout.'
1923 required : false
2024 type : string
25+ version :
26+ description : ' Version override. If omitted, the build resolves it via git describe.'
27+ required : false
28+ type : string
2129
2230jobs :
2331# =============================================================================
3947 - ephemeral-limit-memory-8192
4048 - ephemeral-limit-cpu-6
4149 container :
42- image : adguard/core-libs:2.11
50+ # 2.12 is the first image with zig, which the musl-cross-* presets use.
51+ image : adguard/core-libs:2.12
4352 permissions :
4453 contents : read
4554 id-token : write
@@ -62,13 +71,28 @@ jobs:
6271 secret/data/ci-secrets/gpg-signing gpgPassword | GPG_PASSWORD
6372
6473 - name : Configure Conan
74+ shell : bash
6575 run : |
76+ # The image's bundled Conan is too old to know about newer compiler
77+ # versions (e.g. the zig wrapper now reports as Clang 22), so install
78+ # an upgraded Conan into a venv. It reuses the image's Conan cache.
79+ python3 -m venv venv
80+ source ./venv/bin/activate
81+ pip install conan
6682 conan remote add --index 0 art ${{ vars.CONAN_REPO_URL }} || true
6783
84+ # The build resolves the version via git describe. A manual `version`
85+ # input forces an override (version.cmake reads the TT_CLIENT_VERSION env
86+ # var), which also drives the artifact name below.
6887 - name : Detect version
6988 id : version
7089 run : |
71- VERSION=$(git describe --tags --match 'v*' | sed -e 's/^v//')
90+ if [ -n "${{ inputs.version }}" ]; then
91+ VERSION="${{ inputs.version }}"
92+ echo "TT_CLIENT_VERSION=${VERSION}" >> "$GITHUB_ENV"
93+ else
94+ VERSION=$(git describe --tags --match 'v*' | sed -e 's/^v//')
95+ fi
7296 echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
7397
7498 - name : Import GPG key
@@ -79,41 +103,26 @@ jobs:
79103 env :
80104 GPG_KEY : devteam@adguard.com
81105 VERSION : ${{ steps.version.outputs.version }}
106+ # The image already provides the Conan dependencies.
107+ SKIP_BOOTSTRAP : 1
82108 shell : bash
83109 run : |
84110 set -x -e
111+ source ./venv/bin/activate
85112
86113 mkdir -p artifacts
87114 ARTIFACTS_DIR=${PWD}/artifacts
88115
89116 rustup +nightly component add rust-src
90117
118+ # One musl-cross-<arch> preset per architecture; see CMakePresets.json.
91119 ARCHES="x86_64 aarch64 armv7 mips mipsel"
92120 for ARCH in $ARCHES; do
93- EABI=
94- SF=
95- case ${ARCH} in
96- armv7) EABI=eabi ;;
97- mips) SF=sf ;;
98- mipsel) SF=sf ;;
99- esac
100-
101- # Rust adds -lunwind when statically linking; create symlink
102- p="$(${ARCH}-linux-musl${EABI}${SF}-gcc -print-file-name=libgcc_eh.a)" && \
103- [ "$p" != "libgcc_eh.a" ] && ln -sf "$(basename "$p")" "$(dirname "$p")/libunwind.a"
104-
105- cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja \
106- -DCMAKE_C_COMPILER=${ARCH}-linux-musl${EABI}${SF}-gcc \
107- -DCMAKE_CXX_COMPILER=${ARCH}-linux-musl${EABI}${SF}-g++ \
108- -DCMAKE_SYSTEM_PROCESSOR=${ARCH} \
109- -DCMAKE_SYSTEM_NAME=Linux \
110- -DCMAKE_CROSSCOMPILING=ON \
111- -S . -B build_${ARCH}
112- cmake --build build_${ARCH} --target trusttunnel_client
113- cmake --build build_${ARCH} --target setup_wizard
121+ BUILD_DIR=cmake-build-musl-cross-${ARCH}-relwithdebinfo
122+ make PRESET=musl-cross-${ARCH}-relwithdebinfo all
114123
115124 NAME=trusttunnel_client-v${VERSION}-linux-${ARCH}
116- pushd build_${ARCH }/trusttunnel
125+ pushd ${BUILD_DIR }/trusttunnel
117126 llvm-strip trusttunnel_client
118127 llvm-strip setup_wizard
119128 gpg --default-key "${GPG_KEY}" --detach-sig \
@@ -141,8 +150,10 @@ jobs:
141150 env :
142151 ARTIFACTORY_USER : ${{ secrets.ARTIFACTORY_USER }}
143152 ARTIFACTORY_API_KEY : ${{ secrets.ARTIFACTORY_API_KEY }}
153+ shell : bash
144154 run : |
145155 set -x
156+ source ./venv/bin/activate
146157 conan remote login art "$ARTIFACTORY_USER" --password "$ARTIFACTORY_API_KEY" || true
147158 conan upload -r art -c "*" 2>&1 | grep --line-buffered "Uploading" || true
148159
@@ -182,10 +193,18 @@ jobs:
182193 pip install conan
183194 conan remote add --index 0 art ${{ vars.CONAN_REPO_URL }} || true
184195
196+ # The build resolves the version via git describe. A manual `version`
197+ # input forces an override (version.cmake reads the TT_CLIENT_VERSION env
198+ # var), which also drives the artifact name below.
185199 - name : Detect version
186200 id : version
187201 run : |
188- VERSION=$(git describe --tags --match 'v*' | sed -e 's/^v//')
202+ if [ -n "${{ inputs.version }}" ]; then
203+ VERSION="${{ inputs.version }}"
204+ echo "TT_CLIENT_VERSION=${VERSION}" >> "$GITHUB_ENV"
205+ else
206+ VERSION=$(git describe --tags --match 'v*' | sed -e 's/^v//')
207+ fi
189208 echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
190209
191210 - name : Import GPG key
@@ -205,21 +224,20 @@ jobs:
205224 - name : Build universal binary
206225 env :
207226 VERSION : ${{ steps.version.outputs.version }}
227+ # The runner image already provides the Conan dependencies.
228+ SKIP_BOOTSTRAP : 1
208229 run : |
209230 set -x -e
210231 source ./venv/bin/activate
211232
233+ # Both slices use the clang-relwithdebinfo preset, so each one gets its
234+ # own BUILD_DIR instead of the preset's default directory.
212235 ARCHES="x86_64 arm64"
213236 for ARCH in $ARCHES; do
214- cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja \
215- -DCMAKE_C_COMPILER=clang \
216- -DCMAKE_CXX_COMPILER=clang++ \
217- -DCMAKE_CXX_FLAGS="-stdlib=libc++" \
218- -DCMAKE_OSX_ARCHITECTURES=${ARCH} \
219- -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
220- -S . -B build_${ARCH}
221- cmake --build build_${ARCH} --target trusttunnel_client
222- cmake --build build_${ARCH} --target setup_wizard
237+ make PRESET=clang-relwithdebinfo \
238+ ARCH=${ARCH} \
239+ BUILD_DIR=build_${ARCH} \
240+ all
223241 done
224242
225243 mkdir -p build_universal
@@ -325,6 +343,13 @@ jobs:
325343 run : |
326344 $ErrorActionPreference = 'Stop'
327345
346+ # The build resolves the version via git describe. A manual `version`
347+ # input forces an override (version.cmake reads the TT_CLIENT_VERSION
348+ # env var).
349+ if ('${{ inputs.version }}' -ne '') {
350+ $Env:TT_CLIENT_VERSION = '${{ inputs.version }}'
351+ }
352+
328353 & conan remote add --index 0 art $Env:CONAN_REPO_URL
329354
330355 # Save vcvars to switch between them
@@ -342,16 +367,14 @@ jobs:
342367 function Build([string]$BuildDir, $VcvarsEnv, [string]$ArchName) {
343368 & {
344369 $VcvarsEnv | foreach { setvar $_ }
345- New-Item -ItemType Directory -Force -Path $BuildDir | Out-Null
346- pushd $BuildDir
347- & cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo `
348- -DCMAKE_C_COMPILER="cl.exe" `
349- -DCMAKE_CXX_COMPILER="cl.exe" `
350- -G Ninja ..
370+ # GNU make is not part of the Windows image, so the Windows job
371+ # drives the msvc-relwithdebinfo preset through cmake directly.
372+ # Every architecture uses the same preset, so each one is
373+ # configured into its own directory.
374+ & cmake --preset msvc-relwithdebinfo -B $BuildDir
351375 if (!$?) { exit 1 }
352- & ninja trusttunnel_client setup_wizard
376+ & cmake --build $BuildDir --target trusttunnel_client setup_wizard
353377 if (!$?) { exit 1 }
354- popd
355378 }
356379
357380 # Collect the unsigned executables; they are signed by the reusable
@@ -421,7 +444,13 @@ jobs:
421444 run : |
422445 set -e -x
423446
424- VERSION=$(git describe --tags --match 'v*' | sed -e 's/^v//')
447+ # Match the version the build stamped: the manual `version` input
448+ # overrides git describe (same as the build-windows job).
449+ if [ -n "${{ inputs.version }}" ]; then
450+ VERSION="${{ inputs.version }}"
451+ else
452+ VERSION=$(git describe --tags --match 'v*' | sed -e 's/^v//')
453+ fi
425454
426455 mkdir -p artifacts
427456
0 commit comments