Fix Apple runner toolchain alignment
Some checks failed
Build Site / Next.js Build (push) Waiting to run
Build Rust / Cargo Test (push) Waiting to run
Build Apple / Build App (iOS Simulator) (push) Failing after 1m46s
Build Apple / Build App (macOS) (push) Failing after 2m6s

This commit is contained in:
Conrad Kramer 2026-03-19 03:36:11 -07:00
parent 9fcaf137ac
commit e0fe21fad8
4 changed files with 41 additions and 19 deletions

View file

@ -106,25 +106,32 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
export PATH="${CARGO_HOME}/bin:${PATH}"
if ! command -v rustup >/dev/null 2>&1; then if ! command -v rustup >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.85.0 curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.93.1
else else
rustup set profile minimal rustup set profile minimal
rustup toolchain install 1.85.0 rustup toolchain install 1.93.1
rustup default 1.85.0 rustup default 1.93.1
fi fi
mkdir -p "${CARGO_HOME}/bin" mkdir -p "${CARGO_HOME}/bin"
echo "${CARGO_HOME}/bin" >> "${GITHUB_PATH}" echo "${CARGO_HOME}/bin" >> "${GITHUB_PATH}"
export PATH="${CARGO_HOME}/bin:${PATH}" export PATH="${CARGO_HOME}/bin:${PATH}"
rustup show active-toolchain
toolchain="$(rustup show active-toolchain | awk '{print $1}')"
cargo_bin="$(rustup which --toolchain "${toolchain}" cargo)"
rustc_bin="$(rustup which --toolchain "${toolchain}" rustc)"
targets='${{ matrix.rust-targets }}' targets='${{ matrix.rust-targets }}'
for target in ${targets//,/ }; do for target in ${targets//,/ }; do
rustup target add "${target}" rustup target add --toolchain "${toolchain}" "${target}"
done done
rustc --version "${rustc_bin}" --version
cargo --version "${cargo_bin}" --version
- name: Install Protobuf - name: Install Protobuf
shell: bash shell: bash

View file

@ -2,7 +2,7 @@ import AsyncAlgorithms
import BurrowConfiguration import BurrowConfiguration
import BurrowCore import BurrowCore
import libburrow import libburrow
import NetworkExtension @preconcurrency import NetworkExtension
import os import os
class PacketTunnelProvider: NEPacketTunnelProvider { class PacketTunnelProvider: NEPacketTunnelProvider {
@ -10,7 +10,14 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
case missingTunnelConfiguration case missingTunnelConfiguration
} }
private static let logger = Logger.logger(for: PacketTunnelProvider.self) private let logger = Logger.logger(for: PacketTunnelProvider.self)
private var client: TunnelClient {
get throws { try _client.get() }
}
private let _client: Result<TunnelClient, Swift.Error> = Result {
try TunnelClient.unix(socketURL: Constants.socketURL)
}
override init() { override init() {
do { do {
@ -19,33 +26,31 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
databasePath: try Constants.databaseURL.path(percentEncoded: false) databasePath: try Constants.databaseURL.path(percentEncoded: false)
) )
} catch { } catch {
Self.logger.error("Failed to spawn networking thread: \(error)") logger.error("Failed to spawn networking thread: \(error)")
} }
} }
nonisolated override func startTunnel(options: [String: NSObject]? = nil) async throws { override func startTunnel(options: [String: NSObject]? = nil) async throws {
do { do {
let client = try TunnelClient.unix(socketURL: Constants.socketURL)
let configuration = try await Array(client.tunnelConfiguration(.init()).prefix(1)).first let configuration = try await Array(client.tunnelConfiguration(.init()).prefix(1)).first
guard let settings = configuration?.settings else { guard let settings = configuration?.settings else {
throw Error.missingTunnelConfiguration throw Error.missingTunnelConfiguration
} }
try await setTunnelNetworkSettings(settings) try await setTunnelNetworkSettings(settings)
_ = try await client.tunnelStart(.init()) _ = try await client.tunnelStart(.init())
Self.logger.log("Started tunnel with network settings: \(settings)") logger.log("Started tunnel with network settings: \(settings)")
} catch { } catch {
Self.logger.error("Failed to start tunnel: \(error)") logger.error("Failed to start tunnel: \(error)")
throw error throw error
} }
} }
nonisolated override func stopTunnel(with reason: NEProviderStopReason) async { override func stopTunnel(with reason: NEProviderStopReason) async {
do { do {
let client = try TunnelClient.unix(socketURL: Constants.socketURL)
_ = try await client.tunnelStop(.init()) _ = try await client.tunnelStop(.init())
Self.logger.log("Stopped client") logger.log("Stopped client")
} catch { } catch {
Self.logger.error("Failed to stop tunnel: \(error)") logger.error("Failed to stop tunnel: \(error)")
} }
} }
} }

View file

@ -84,7 +84,6 @@ if [[ -n "${RUSTC_WRAPPER:-}" && "${RUSTC_WRAPPER}" != /* ]]; then
WRAPPER_PATH="$(command -v "${RUSTC_WRAPPER}" || true)" WRAPPER_PATH="$(command -v "${RUSTC_WRAPPER}" || true)"
if [[ -n "${WRAPPER_PATH}" ]]; then if [[ -n "${WRAPPER_PATH}" ]]; then
RUSTC_WRAPPER="${WRAPPER_PATH}" RUSTC_WRAPPER="${WRAPPER_PATH}"
CARGO_PATH="$(dirname "${WRAPPER_PATH}"):$CARGO_PATH"
fi fi
fi fi
@ -114,12 +113,23 @@ BUILD_ENV=(
if [[ -n "${RUSTUP_TOOLCHAIN}" ]]; then if [[ -n "${RUSTUP_TOOLCHAIN}" ]]; then
BUILD_ENV+=("RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN}") BUILD_ENV+=("RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN}")
fi fi
if [[ -n "${RUSTC_BIN:-}" ]]; then
BUILD_ENV+=("RUSTC=${RUSTC_BIN}")
fi
if [[ -n "${IPHONEOS_DEPLOYMENT_TARGET:-}" ]]; then if [[ -n "${IPHONEOS_DEPLOYMENT_TARGET:-}" ]]; then
BUILD_ENV+=("IPHONEOS_DEPLOYMENT_TARGET=${IPHONEOS_DEPLOYMENT_TARGET}") BUILD_ENV+=("IPHONEOS_DEPLOYMENT_TARGET=${IPHONEOS_DEPLOYMENT_TARGET}")
fi fi
if [[ -n "${MACOSX_DEPLOYMENT_TARGET:-}" ]]; then if [[ -n "${MACOSX_DEPLOYMENT_TARGET:-}" ]]; then
BUILD_ENV+=("MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}") BUILD_ENV+=("MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}")
fi fi
echo "Using Rust toolchain: ${RUSTUP_TOOLCHAIN:-system}"
echo "Using cargo: ${CARGO_BIN}"
if [[ -n "${RUSTC_BIN:-}" ]]; then
echo "Using rustc: ${RUSTC_BIN}"
fi
if [[ -n "${RUSTC_WRAPPER:-}" ]]; then
echo "Using rustc wrapper: ${RUSTC_WRAPPER}"
fi
env -i "${BUILD_ENV[@]}" "${CARGO_BIN}" build "${CARGO_ARGS[@]}" env -i "${BUILD_ENV[@]}" "${CARGO_BIN}" build "${CARGO_ARGS[@]}"
mkdir -p "${BUILT_PRODUCTS_DIR}" mkdir -p "${BUILT_PRODUCTS_DIR}"

View file

@ -1,4 +1,4 @@
[toolchain] [toolchain]
channel = "1.85.0" channel = "1.93.1"
components = ["rustfmt"] components = ["rustfmt"]
profile = "minimal" profile = "minimal"