Fix Apple runner toolchain alignment
This commit is contained in:
parent
9fcaf137ac
commit
e0fe21fad8
4 changed files with 41 additions and 19 deletions
|
|
@ -106,25 +106,32 @@ jobs:
|
|||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
export PATH="${CARGO_HOME}/bin:${PATH}"
|
||||
|
||||
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
|
||||
rustup set profile minimal
|
||||
rustup toolchain install 1.85.0
|
||||
rustup default 1.85.0
|
||||
rustup toolchain install 1.93.1
|
||||
rustup default 1.93.1
|
||||
fi
|
||||
|
||||
mkdir -p "${CARGO_HOME}/bin"
|
||||
echo "${CARGO_HOME}/bin" >> "${GITHUB_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 }}'
|
||||
for target in ${targets//,/ }; do
|
||||
rustup target add "${target}"
|
||||
rustup target add --toolchain "${toolchain}" "${target}"
|
||||
done
|
||||
|
||||
rustc --version
|
||||
cargo --version
|
||||
"${rustc_bin}" --version
|
||||
"${cargo_bin}" --version
|
||||
|
||||
- name: Install Protobuf
|
||||
shell: bash
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import AsyncAlgorithms
|
|||
import BurrowConfiguration
|
||||
import BurrowCore
|
||||
import libburrow
|
||||
import NetworkExtension
|
||||
@preconcurrency import NetworkExtension
|
||||
import os
|
||||
|
||||
class PacketTunnelProvider: NEPacketTunnelProvider {
|
||||
|
|
@ -10,7 +10,14 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
|||
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() {
|
||||
do {
|
||||
|
|
@ -19,33 +26,31 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
|||
databasePath: try Constants.databaseURL.path(percentEncoded: false)
|
||||
)
|
||||
} 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 {
|
||||
let client = try TunnelClient.unix(socketURL: Constants.socketURL)
|
||||
let configuration = try await Array(client.tunnelConfiguration(.init()).prefix(1)).first
|
||||
guard let settings = configuration?.settings else {
|
||||
throw Error.missingTunnelConfiguration
|
||||
}
|
||||
try await setTunnelNetworkSettings(settings)
|
||||
_ = try await client.tunnelStart(.init())
|
||||
Self.logger.log("Started tunnel with network settings: \(settings)")
|
||||
logger.log("Started tunnel with network settings: \(settings)")
|
||||
} catch {
|
||||
Self.logger.error("Failed to start tunnel: \(error)")
|
||||
logger.error("Failed to start tunnel: \(error)")
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated override func stopTunnel(with reason: NEProviderStopReason) async {
|
||||
override func stopTunnel(with reason: NEProviderStopReason) async {
|
||||
do {
|
||||
let client = try TunnelClient.unix(socketURL: Constants.socketURL)
|
||||
_ = try await client.tunnelStop(.init())
|
||||
Self.logger.log("Stopped client")
|
||||
logger.log("Stopped client")
|
||||
} catch {
|
||||
Self.logger.error("Failed to stop tunnel: \(error)")
|
||||
logger.error("Failed to stop tunnel: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ if [[ -n "${RUSTC_WRAPPER:-}" && "${RUSTC_WRAPPER}" != /* ]]; then
|
|||
WRAPPER_PATH="$(command -v "${RUSTC_WRAPPER}" || true)"
|
||||
if [[ -n "${WRAPPER_PATH}" ]]; then
|
||||
RUSTC_WRAPPER="${WRAPPER_PATH}"
|
||||
CARGO_PATH="$(dirname "${WRAPPER_PATH}"):$CARGO_PATH"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
@ -114,12 +113,23 @@ BUILD_ENV=(
|
|||
if [[ -n "${RUSTUP_TOOLCHAIN}" ]]; then
|
||||
BUILD_ENV+=("RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN}")
|
||||
fi
|
||||
if [[ -n "${RUSTC_BIN:-}" ]]; then
|
||||
BUILD_ENV+=("RUSTC=${RUSTC_BIN}")
|
||||
fi
|
||||
if [[ -n "${IPHONEOS_DEPLOYMENT_TARGET:-}" ]]; then
|
||||
BUILD_ENV+=("IPHONEOS_DEPLOYMENT_TARGET=${IPHONEOS_DEPLOYMENT_TARGET}")
|
||||
fi
|
||||
if [[ -n "${MACOSX_DEPLOYMENT_TARGET:-}" ]]; then
|
||||
BUILD_ENV+=("MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}")
|
||||
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[@]}"
|
||||
|
||||
mkdir -p "${BUILT_PRODUCTS_DIR}"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[toolchain]
|
||||
channel = "1.85.0"
|
||||
channel = "1.93.1"
|
||||
components = ["rustfmt"]
|
||||
profile = "minimal"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue