diff --git a/.github/workflows/ci-swift-linker.yml b/.github/workflows/ci-swift-linker.yml new file mode 100644 index 0000000000..f658a7c916 --- /dev/null +++ b/.github/workflows/ci-swift-linker.yml @@ -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 diff --git a/libs/cua-driver/rust/Cargo.lock b/libs/cua-driver/rust/Cargo.lock index 5f3ca6831e..8c3eec1a9e 100644 --- a/libs/cua-driver/rust/Cargo.lock +++ b/libs/cua-driver/rust/Cargo.lock @@ -3795,9 +3795,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "screencapturekit" -version = "6.0.1" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74afe91a6a3f8859ff08339535891819f5438e7cb284c1b74cc8866eb80956bc" +checksum = "9ddaa8d6b16a2762c9a97c9a6297f04cb8ded0487e5ef02dc98b4e2bee3a26c7" dependencies = [ "apple-cf", "apple-metal", diff --git a/libs/cua-driver/rust/crates/platform-macos/Cargo.toml b/libs/cua-driver/rust/crates/platform-macos/Cargo.toml index d53bfe4c7a..5a18e6a516 100644 --- a/libs/cua-driver/rust/crates/platform-macos/Cargo.toml +++ b/libs/cua-driver/rust/crates/platform-macos/Cargo.toml @@ -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 } diff --git a/scripts/ci/macos/test-swift-linker-symbols.sh b/scripts/ci/macos/test-swift-linker-symbols.sh new file mode 100755 index 0000000000..6979ced5f6 --- /dev/null +++ b/scripts/ci/macos/test-swift-linker-symbols.sh @@ -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."