Repository navigation
Fix self-hosted CI compatibility failures #6289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...CmuxSocketControl/Sources/CmuxSocketControl/SocketControlSettings+DefaultSocketPath.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| public import Darwin | ||
| public import Foundation | ||
|
|
||
| extension SocketControlSettings { | ||
| /// The default socket path for the current build variant (before override handling). | ||
| public static func defaultSocketPath( | ||
| bundleIdentifier: String?, | ||
| environment: [String: String] = ProcessInfo.processInfo.environment, | ||
| isDebugBuild: Bool, | ||
| currentUserID: uid_t = getuid(), | ||
| probeStableDefaultPathEntry: (String) -> StableDefaultSocketPathEntry = inspectStableDefaultSocketPathEntry | ||
| ) -> String { | ||
| if isDebugBuild, | ||
| isBareDebugBundleIdentifier( | ||
| bundleIdentifier, | ||
| baseDebugBundleIdentifier: baseDebugBundleIdentifier | ||
| ), | ||
| launchTag(environment: environment) == nil, | ||
| environment["CMUX_SOCKET_PATH"]?.isEmpty != false, | ||
| let xctestPath = xctestDebugSocketPath(environment: environment) { | ||
| return xctestPath | ||
| } | ||
|
|
||
| return SocketPathMarkerFiles.defaultSocketPath( | ||
| bundleIdentifier: bundleIdentifier, | ||
| environment: environment, | ||
| isDebugBuild: isDebugBuild, | ||
| stableSocketPath: resolvedStableDefaultSocketPath( | ||
| currentUserID: currentUserID, | ||
| probeStableDefaultPathEntry: probeStableDefaultPathEntry | ||
| ), | ||
| baseDebugBundleIdentifier: baseDebugBundleIdentifier | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| private func isBareDebugBundleIdentifier( | ||
| _ bundleIdentifier: String?, | ||
| baseDebugBundleIdentifier: String | ||
| ) -> Bool { | ||
| bundleIdentifier?.trimmingCharacters(in: .whitespacesAndNewlines) == baseDebugBundleIdentifier | ||
| } | ||
|
|
||
| private func xctestDebugSocketPath(environment: [String: String]) -> String? { | ||
| let indicators = [ | ||
| "XCTestSessionIdentifier", | ||
| "XCTestConfigurationFilePath", | ||
| "XCTestBundlePath", | ||
| "XCInjectBundle", | ||
| "XCInjectBundleInto", | ||
| "DYLD_INSERT_LIBRARIES", | ||
| ] | ||
| guard let source = indicators.compactMap({ key -> String? in | ||
| guard let value = environment[key]?.trimmingCharacters(in: .whitespacesAndNewlines), | ||
| !value.isEmpty else { | ||
| return nil | ||
| } | ||
| if key == "DYLD_INSERT_LIBRARIES", | ||
| !value.contains("libXCTest") { | ||
| return nil | ||
| } | ||
| return value | ||
| }).first else { | ||
| return nil | ||
| } | ||
|
|
||
| let hash = source.utf8.reduce(UInt64(0xcbf29ce484222325)) { partial, byte in | ||
| (partial ^ UInt64(byte)) &* 0x100000001b3 | ||
| } | ||
| return "/tmp/cmux-xctest-\(String(hash, radix: 16)).sock" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [ "$#" -eq 0 ]; then | ||
| echo "usage: $0 <xcodebuild args...>" >&2 | ||
| exit 2 | ||
| fi | ||
| log_dir="${RUNNER_TEMP:-/tmp}" | ||
| log_stem="${log_dir%/}/cmux-app-host-xcodebuild-${CMUX_TAG:-untagged}" | ||
| max_attempts="${CMUX_APP_HOST_XCODEBUILD_ATTEMPTS:-2}" | ||
|
|
||
| attempt=1 | ||
| while [ "$attempt" -le "$max_attempts" ]; do | ||
| log_path="${log_stem}-attempt-${attempt}.log" | ||
| set +e | ||
| scripts/ci/xcodebuild_noninteractive.py xcodebuild "$@" 2>&1 | tee "$log_path" | ||
| status=${PIPESTATUS[0]} | ||
| set -e | ||
|
|
||
| if grep -Fq 'path = "/tmp/cmux-debug.sock"' "$log_path"; then | ||
| echo "FAIL: app-host used default debug socket instead of an XCTest-scoped socket" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if grep -Fq 'SocketControlServer: Listening on /tmp/cmux-debug.sock' "$log_path"; then | ||
| echo "FAIL: app-host listener used default debug socket instead of an XCTest-scoped socket" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$status" -ne 0 ]; then | ||
| if [ "$attempt" -lt "$max_attempts" ] && grep -Fq 'The test runner hung before establishing connection.' "$log_path"; then | ||
| echo "Retrying app-host xcodebuild after XCTest startup hang (attempt $attempt/$max_attempts)" >&2 | ||
| pkill -x "cmux DEV" || true | ||
| attempt=$((attempt + 1)) | ||
| continue | ||
| fi | ||
| exit "$status" | ||
| fi | ||
|
|
||
| if ! grep -Eq 'SocketControlServer: Listening on |message = "socket.listener.start"' "$log_path"; then | ||
| echo "FAIL: app-host xcodebuild output did not include socket listener evidence" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| exit 0 | ||
| done | ||
|
|
||
| exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import json | ||
| import subprocess | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" | ||
| SCRIPT="$ROOT_DIR/scripts/prune_nightly_release_assets.py" | ||
| PYTHON_BIN="${PYTHON_BIN:-python3}" | ||
|
|
||
| "$PYTHON_BIN" -m py_compile "$SCRIPT" | ||
| "$PYTHON_BIN" - "$SCRIPT" <<'PY' | ||
| import importlib.util | ||
| import pathlib | ||
| import sys | ||
|
|
||
| script = pathlib.Path(sys.argv[1]) | ||
| spec = importlib.util.spec_from_file_location("nightly_prune_compat", script) | ||
| module = importlib.util.module_from_spec(spec) | ||
| assert spec.loader is not None | ||
| sys.modules[spec.name] = module | ||
| spec.loader.exec_module(module) | ||
| assert callable(module.load_release) | ||
| PY | ||
|
|
||
| echo "PASS: nightly prune script is compatible with older macOS runner Python" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mid-job Python downgrades later steps
Low Severity
Adding
actions/setup-pythonwith 3.9 in the middle ofworkflow-guard-testsmakespython3point at 3.9 for every later step in that job, not only the nightly prune check. Steps that used to run on the runner’s default interpreter now run on 3.9 instead.Reviewed by Cursor Bugbot for commit ce14d5d. Configure here.