Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci-swift-linker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "CI: macOS Swift linker"

on:
pull_request:
paths:
- "libs/cua-driver/rust/**"
- "scripts/ci/macos/test-swift-linker-symbols.sh"
- ".github/workflows/ci-swift-linker.yml"
push:
branches: [main]
paths:
- "libs/cua-driver/rust/**"
- "scripts/ci/macos/test-swift-linker-symbols.sh"
- ".github/workflows/ci-swift-linker.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: swift-linker-${{ github.ref }}
cancel-in-progress: true

jobs:
link:
name: Fresh macOS link without duplicate symbols
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- uses: dtolnay/rust-toolchain@stable
- name: Verify native linker output
env:
TMPDIR: ${{ runner.temp }}/
run: bash scripts/ci/macos/test-swift-linker-symbols.sh
- name: Preserve linker evidence
if: always()
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08
with:
name: swift-linker-evidence
if-no-files-found: error
path: |
${{ runner.temp }}/cua-swift-linker.*/environment.txt
${{ runner.temp }}/cua-swift-linker.*/build.log
${{ runner.temp }}/cua-swift-linker.*/duplicate-symbols.txt
4 changes: 2 additions & 2 deletions libs/cua-driver/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/cua-driver/rust/crates/platform-macos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ objc2-quartz-core = { version = "0.2", features = ["CALayer"] }
# ffmpeg subprocess on macOS. `macos_15_0` enables the `SCRecordingOutput`
# convenience that finalises an mp4 in-process, removing the per-binary
# Screen Recording TCC prompt that subprocess capture would otherwise trip.
screencapturekit = { version = "6", features = ["macos_15_0"] }
screencapturekit = { version = "8.0.1", features = ["macos_15_0"] }
security-framework = { version = "3.7.0", default-features = false, features = ["OSX_10_15"] }
zeroize = { workspace = true }
getrandom = { workspace = true }
Expand Down
42 changes: 42 additions & 0 deletions scripts/ci/macos/test-swift-linker-symbols.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail

if [[ "$(uname -s)" != Darwin ]]; then
echo "This regression check requires a native macOS linker." >&2
exit 2
fi

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
ARTIFACT_DIR="$(mktemp -d "${TMPDIR:-/tmp}/cua-swift-linker.XXXXXX")"
export CARGO_TARGET_DIR="${ARTIFACT_DIR}/target"
export CARGO_TERM_COLOR=never
export RUSTFLAGS="${RUSTFLAGS:+${RUSTFLAGS} }-W linker-messages"
unset CARGO_ENCODED_RUSTFLAGS

printf 'Evidence: %s\n' "${ARTIFACT_DIR}"
{
git -C "${REPO_ROOT}" rev-parse HEAD
rustc --version
cargo --version
xcrun swift --version
sw_vers
} > "${ARTIFACT_DIR}/environment.txt" 2>&1

set +e
cargo build --manifest-path "${REPO_ROOT}/libs/cua-driver/rust/Cargo.toml" \
--release --locked -p cua-driver 2>&1 | tee "${ARTIFACT_DIR}/build.log"
BUILD_STATUSES=("${PIPESTATUS[@]}")
set -e

if [[ "${BUILD_STATUSES[0]}" != 0 || "${BUILD_STATUSES[1]}" != 0 ]]; then
printf 'FAIL: native build or evidence capture failed (%s).\n' "${BUILD_STATUSES[*]}" >&2
exit 1
fi

if grep -iE 'duplicate symbols?([[:space:]]|:)' "${ARTIFACT_DIR}/build.log" \
> "${ARTIFACT_DIR}/duplicate-symbols.txt"; then
echo "FAIL: successful native build emitted duplicate-symbol linker diagnostics." >&2
exit 1
fi

echo "PASS: fresh native build succeeded without duplicate-symbol linker diagnostics."
Loading