mirror of
https://github.com/github/codeql-action.git
synced 2026-04-26 00:38:48 +00:00
Merge pull request #3801 from github/henrymercer/swift-incompatible-os
Mark Swift incompatible OS as configuration error
This commit is contained in:
Generated
+2
-2
@@ -60,12 +60,12 @@ jobs:
|
||||
setup-kotlin: 'true'
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: C#,java-kotlin,swift,typescript
|
||||
languages: C#,java-kotlin,typescript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- name: 'Check languages'
|
||||
run: |
|
||||
expected_languages="csharp,java,swift,javascript"
|
||||
expected_languages="csharp,java,javascript"
|
||||
actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config)
|
||||
|
||||
if [ "$expected_languages" != "$actual_languages" ]; then
|
||||
|
||||
@@ -66,6 +66,7 @@ jobs:
|
||||
uses: ./../action/.github/actions/verify-debug-artifact-scan-completed
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: cpp,csharp,go,java,javascript,python
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
debug: true
|
||||
debug-artifact-name: my-debug-artifacts
|
||||
|
||||
Generated
+6
@@ -161960,6 +161960,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
Generated
+6
@@ -107434,6 +107434,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
Generated
+6
@@ -104016,6 +104016,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
Generated
+6
@@ -165315,6 +165315,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
Generated
+11
-5
@@ -107837,6 +107837,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
@@ -110293,6 +110299,11 @@ async function run(startedAt) {
|
||||
enableFileCoverageInformation: fileCoverageResult.enabled,
|
||||
logger
|
||||
});
|
||||
if (config.languages.includes("swift" /* swift */) && process.platform !== "darwin") {
|
||||
throw new ConfigurationError(
|
||||
`Swift analysis is only supported on macOS runner images. Please migrate to a macOS runner.`
|
||||
);
|
||||
}
|
||||
if (repositoryPropertiesResult.isFailure()) {
|
||||
addNoLanguageDiagnostic(
|
||||
config,
|
||||
@@ -110377,11 +110388,6 @@ async function run(startedAt) {
|
||||
"Passing the GOFLAGS env parameter to the init action is deprecated. Please move this to the analyze action."
|
||||
);
|
||||
}
|
||||
if (config.languages.includes("swift" /* swift */) && process.platform === "linux") {
|
||||
logger.warning(
|
||||
`Swift analysis on Ubuntu runner images is no longer supported. Please migrate to a macOS runner if this affects you.`
|
||||
);
|
||||
}
|
||||
if (config.languages.includes("go" /* go */) && process.platform === "linux") {
|
||||
try {
|
||||
const goBinaryPath = await io6.which("go", true);
|
||||
|
||||
Generated
+6
@@ -104015,6 +104015,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
Generated
+6
@@ -105062,6 +105062,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
Generated
+6
@@ -162127,6 +162127,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
Generated
+6
@@ -107067,6 +107067,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
Generated
+6
@@ -161791,6 +161791,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
Generated
+6
@@ -108505,6 +108505,12 @@ var cliErrorsConfig = {
|
||||
)
|
||||
]
|
||||
},
|
||||
["SwiftIncompatibleOs" /* SwiftIncompatibleOs */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS")
|
||||
]
|
||||
},
|
||||
["UnsupportedBuildMode" /* UnsupportedBuildMode */]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
@@ -5,12 +5,12 @@ versions:
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: C#,java-kotlin,swift,typescript
|
||||
languages: C#,java-kotlin,typescript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- name: "Check languages"
|
||||
run: |
|
||||
expected_languages="csharp,java,swift,javascript"
|
||||
expected_languages="csharp,java,javascript"
|
||||
actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config)
|
||||
|
||||
if [ "$expected_languages" != "$actual_languages" ]; then
|
||||
|
||||
@@ -299,6 +299,20 @@ test("wrapCliConfigurationError - swift build failed", (t) => {
|
||||
t.true(wrappedError instanceof ConfigurationError);
|
||||
});
|
||||
|
||||
test("wrapCliConfigurationError - swift incompatible os", (t) => {
|
||||
const commandError = new CommandInvocationError(
|
||||
"codeql",
|
||||
["swift/tools/autobuild.sh"],
|
||||
1,
|
||||
"2026-04-01 18:35:00 EST ERRO [extractor/main] [incompatible-os] Currently, Swift analysis is only supported on macOS. (IncompatibleOs.cpp:26)",
|
||||
);
|
||||
const cliError = new CliError(commandError);
|
||||
|
||||
const wrappedError = wrapCliConfigurationError(cliError);
|
||||
|
||||
t.true(wrappedError instanceof ConfigurationError);
|
||||
});
|
||||
|
||||
test("wrapCliConfigurationError - pack cannot be found", (t) => {
|
||||
const commandError = new CommandInvocationError(
|
||||
"codeql",
|
||||
|
||||
@@ -144,6 +144,7 @@ export enum CliConfigErrorCategory {
|
||||
OutOfMemoryOrDisk = "OutOfMemoryOrDisk",
|
||||
PackCannotBeFound = "PackCannotBeFound",
|
||||
PackMissingAuth = "PackMissingAuth",
|
||||
SwiftIncompatibleOs = "SwiftIncompatibleOs",
|
||||
SwiftBuildFailed = "SwiftBuildFailed",
|
||||
UnsupportedBuildMode = "UnsupportedBuildMode",
|
||||
}
|
||||
@@ -281,6 +282,12 @@ const cliErrorsConfig: Record<CliConfigErrorCategory, CliErrorConfiguration> = {
|
||||
),
|
||||
],
|
||||
},
|
||||
[CliConfigErrorCategory.SwiftIncompatibleOs]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp("\\[incompatible-os\\]"),
|
||||
new RegExp("Swift analysis is only supported on macOS"),
|
||||
],
|
||||
},
|
||||
[CliConfigErrorCategory.UnsupportedBuildMode]: {
|
||||
cliErrorMessageCandidates: [
|
||||
new RegExp(
|
||||
|
||||
+9
-9
@@ -389,6 +389,15 @@ async function run(startedAt: Date) {
|
||||
logger,
|
||||
});
|
||||
|
||||
if (
|
||||
config.languages.includes(KnownLanguage.swift) &&
|
||||
process.platform !== "darwin"
|
||||
) {
|
||||
throw new ConfigurationError(
|
||||
`Swift analysis is only supported on macOS runner images. Please migrate to a macOS runner.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (repositoryPropertiesResult.isFailure()) {
|
||||
addNoLanguageDiagnostic(
|
||||
config,
|
||||
@@ -499,15 +508,6 @@ async function run(startedAt: Date) {
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
config.languages.includes(KnownLanguage.swift) &&
|
||||
process.platform === "linux"
|
||||
) {
|
||||
logger.warning(
|
||||
`Swift analysis on Ubuntu runner images is no longer supported. Please migrate to a macOS runner if this affects you.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
config.languages.includes(KnownLanguage.go) &&
|
||||
process.platform === "linux"
|
||||
|
||||
Reference in New Issue
Block a user