Skip to content

Commit 9c646c2

Browse files
Add warning and update PR checks for Swift on Linux (#2399)
* PR checks: Only run Swift build command on MacOS * PR checks: update to only test Swift on MacOS * Log warning if workflow is running Swift on Ubuntu --------- Co-authored-by: Andrew Eisenberg <[email protected]>
1 parent 8b7d739 commit 9c646c2

20 files changed

+66
-64
lines changed

.github/workflows/__all-platform-bundle.yml

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__build-mode-manual.yml

-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__export-file-baseline-information.yml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__multi-language-autodetect.yml

+16-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__swift-custom-build.yml

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__test-local-codeql.yml

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__unset-environment.yml

+12-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/debug-artifacts.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ jobs:
5252
debug: true
5353
debug-artifact-name: my-debug-artifacts
5454
debug-database-name: my-db
55-
- uses: ./../action/.github/actions/setup-swift
56-
with:
57-
codeql-path: ${{ steps.init.outputs.codeql-path }}
55+
# We manually exclude Swift from the languages list here, as it is not supported on Ubuntu
56+
languages: cpp,csharp,go,java,javascript,python,ruby
5857
- name: Build code
5958
shell: bash
6059
run: ./build.sh

.github/workflows/test-codeql-bundle-all.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ jobs:
4242
- id: init
4343
uses: ./../action/init
4444
with:
45+
# We manually exclude Swift from the languages list here, as it is not supported on Ubuntu
46+
languages: cpp,csharp,go,java,javascript,python,ruby
4547
tools: ${{ steps.prepare-test.outputs.tools-url }}
46-
- uses: ./../action/.github/actions/setup-swift
47-
with:
48-
codeql-path: ${{ steps.init.outputs.codeql-path }}
4948
- name: Build code
5049
shell: bash
5150
run: ./build.sh

lib/init-action.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/all-platform-bundle.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ steps:
77
- id: init
88
uses: ./../action/init
99
with:
10+
# Swift is not supported on Ubuntu so we manually exclude it from the list here
11+
languages: cpp,csharp,go,java,javascript,python,ruby
1012
tools: ${{ steps.prepare-test.outputs.tools-url }}
11-
- uses: ./../action/.github/actions/setup-swift
12-
with:
13-
codeql-path: ${{ steps.init.outputs.codeql-path }}
1413
- name: Build code
1514
shell: bash
1615
run: ./build.sh

pr-checks/checks/build-mode-manual.yml

-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ steps:
2020
exit 1
2121
fi
2222
23-
- uses: ./../action/.github/actions/setup-swift
24-
with:
25-
codeql-path: ${{ steps.init.outputs.codeql-path }}
26-
2723
- name: Build code
2824
shell: bash
2925
run: ./build.sh

pr-checks/checks/export-file-baseline-information.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ steps:
2929
run: |
3030
cd "$RUNNER_TEMP/results"
3131
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
32-
if [[ $RUNNER_OS != "Windows" ]]; then
32+
if [[ $RUNNER_OS == "macOS" ]]; then
3333
expected_baseline_languages+=" swift"
3434
fi
3535

pr-checks/checks/multi-language-autodetect.yml

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
name: "Multi-language repository"
2-
description: "An end-to-end integration test of a multi-language repository using automatic language detection"
2+
description: "An end-to-end integration test of a multi-language repository using automatic language detection for MacOS"
33
operatingSystems: ["macos", "ubuntu"]
4-
excludeOsAndVersionCombination: [
5-
# Known failure for Swift on Linux before CLI v2.17.4.
6-
[ "ubuntu", "stable-20230403" ],
7-
[ "ubuntu", "stable-v2.13.5" ],
8-
[ "ubuntu", "stable-v2.14.6" ],
9-
[ "ubuntu", "stable-v2.15.5" ],
10-
[ "ubuntu", "stable-v2.16.6" ],
11-
]
124
steps:
135
- uses: actions/setup-go@v5
146
with:
@@ -18,9 +10,12 @@ steps:
1810
id: init
1911
with:
2012
db-location: "${{ runner.temp }}/customDbLocation"
13+
# Swift is not supported on Ubuntu so we manually exclude it from the list here
14+
languages: ${{ runner.os == 'Linux' && 'cpp,csharp,go,java,javascript,python,ruby' || '' }}
2115
tools: ${{ steps.prepare-test.outputs.tools-url }}
2216

2317
- uses: ./../action/.github/actions/setup-swift
18+
if: runner.os == 'macOS'
2419
with:
2520
codeql-path: ${{ steps.init.outputs.codeql-path }}
2621

@@ -72,8 +67,8 @@ steps:
7267
exit 1
7368
fi
7469
75-
- name: Check language autodetect for Swift
76-
if: runner.os != 'Windows' && matrix.version != 'stable-20230403'
70+
- name: Check language autodetect for Swift on MacOS
71+
if: runner.os == 'macOS' && matrix.version != 'stable-20230403'
7772
shell: bash
7873
run: |
7974
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}

pr-checks/checks/swift-custom-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: "Swift analysis using a custom build command"
22
description: "Tests creation of a Swift database using custom build"
33
versions: ["linked", "default", "nightly-latest"]
4-
operatingSystems: ["macos", "ubuntu"]
4+
operatingSystems: ["macos"]
55
env:
66
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
77
steps:

pr-checks/checks/test-local-codeql.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ steps:
1212
- id: init
1313
uses: ./../action/init
1414
with:
15+
# Swift is not supported on Ubuntu so we manually exclude it from the list here
16+
languages: cpp,csharp,go,java,javascript,python,ruby
1517
tools: ./codeql-bundle-linux64.tar.gz
16-
- uses: ./../action/.github/actions/setup-swift
17-
with:
18-
codeql-path: ${{ steps.init.outputs.codeql-path }}
1918
- name: Build code
2019
shell: bash
2120
run: ./build.sh

pr-checks/checks/unset-environment.yml

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
name: "Test unsetting environment variables"
22
description: "An end-to-end integration test that unsets some environment variables"
33
operatingSystems: ["ubuntu"]
4-
excludeOsAndVersionCombination: [
5-
# Known failure for Swift on Linux before CLI v2.17.4.
6-
[ "ubuntu", "stable-20230403" ],
7-
[ "ubuntu", "stable-v2.13.5" ],
8-
[ "ubuntu", "stable-v2.14.6" ],
9-
[ "ubuntu", "stable-v2.15.5" ],
10-
[ "ubuntu", "stable-v2.16.6" ],
11-
]
124

135
steps:
146
- uses: ./../action/init
157
id: init
168
with:
179
db-location: ${{ runner.temp }}/customDbLocation
10+
# Swift is not supported on Ubuntu so we manually exclude it from the list here
11+
languages: cpp,csharp,go,java,javascript,python,ruby
1812
tools: ${{ steps.prepare-test.outputs.tools-url }}
19-
- uses: ./../action/.github/actions/setup-swift
20-
with:
21-
codeql-path: ${{ steps.init.outputs.codeql-path }}
2213
- uses: actions/setup-go@v5
2314
with:
2415
go-version: '>=1.21.0'

src/init-action.ts

+9
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,15 @@ async function run() {
333333
);
334334
}
335335

336+
if (
337+
config.languages.includes(Language.swift) &&
338+
process.platform === "linux"
339+
) {
340+
logger.warning(
341+
`Swift analysis on Ubuntu runner images is no longer supported. Please migrate to a macOS runner if this affects you.`,
342+
);
343+
}
344+
336345
if (
337346
config.languages.includes(Language.go) &&
338347
process.platform === "linux"

tests/multi-language-repo/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ javac Main.java
88

99
go build main.go
1010

11-
if [[ "$OSTYPE" == "darwin"* || "$OSTYPE" == "linux-gnu"* ]]; then
11+
if [[ "$OSTYPE" == "darwin"* ]]; then
1212
swift build
1313
fi
1414

0 commit comments

Comments
 (0)