Skip to content

Commit

Permalink
Add warning and update PR checks for Swift on Linux (#2399)
Browse files Browse the repository at this point in the history
* 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 <aeisenberg@github.com>
  • Loading branch information
angelapwen and aeisenberg authored Aug 2, 2024
1 parent 8b7d739 commit 9c646c2
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 64 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/__all-platform-bundle.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions .github/workflows/__build-mode-manual.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/__export-file-baseline-information.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions .github/workflows/__multi-language-autodetect.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .github/workflows/__swift-custom-build.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .github/workflows/__test-local-codeql.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions .github/workflows/__unset-environment.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .github/workflows/debug-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ jobs:
debug: true
debug-artifact-name: my-debug-artifacts
debug-database-name: my-db
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
# We manually exclude Swift from the languages list here, as it is not supported on Ubuntu
languages: cpp,csharp,go,java,javascript,python,ruby
- name: Build code
shell: bash
run: ./build.sh
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test-codeql-bundle-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ jobs:
- id: init
uses: ./../action/init
with:
# We manually exclude Swift from the languages list here, as it is not supported on Ubuntu
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
Expand Down
4 changes: 4 additions & 0 deletions lib/init-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/init-action.js.map

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pr-checks/checks/all-platform-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ steps:
- id: init
uses: ./../action/init
with:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
Expand Down
4 changes: 0 additions & 4 deletions pr-checks/checks/build-mode-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ steps:
exit 1
fi
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}

- name: Build code
shell: bash
run: ./build.sh
Expand Down
2 changes: 1 addition & 1 deletion pr-checks/checks/export-file-baseline-information.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ steps:
run: |
cd "$RUNNER_TEMP/results"
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
if [[ $RUNNER_OS != "Windows" ]]; then
if [[ $RUNNER_OS == "macOS" ]]; then
expected_baseline_languages+=" swift"
fi
Expand Down
17 changes: 6 additions & 11 deletions pr-checks/checks/multi-language-autodetect.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
name: "Multi-language repository"
description: "An end-to-end integration test of a multi-language repository using automatic language detection"
description: "An end-to-end integration test of a multi-language repository using automatic language detection for MacOS"
operatingSystems: ["macos", "ubuntu"]
excludeOsAndVersionCombination: [
# Known failure for Swift on Linux before CLI v2.17.4.
[ "ubuntu", "stable-20230403" ],
[ "ubuntu", "stable-v2.13.5" ],
[ "ubuntu", "stable-v2.14.6" ],
[ "ubuntu", "stable-v2.15.5" ],
[ "ubuntu", "stable-v2.16.6" ],
]
steps:
- uses: actions/setup-go@v5
with:
Expand All @@ -18,9 +10,12 @@ steps:
id: init
with:
db-location: "${{ runner.temp }}/customDbLocation"
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: ${{ runner.os == 'Linux' && 'cpp,csharp,go,java,javascript,python,ruby' || '' }}
tools: ${{ steps.prepare-test.outputs.tools-url }}

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

Expand Down Expand Up @@ -72,8 +67,8 @@ steps:
exit 1
fi
- name: Check language autodetect for Swift
if: runner.os != 'Windows' && matrix.version != 'stable-20230403'
- name: Check language autodetect for Swift on MacOS
if: runner.os == 'macOS' && matrix.version != 'stable-20230403'
shell: bash
run: |
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}
Expand Down
2 changes: 1 addition & 1 deletion pr-checks/checks/swift-custom-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "Swift analysis using a custom build command"
description: "Tests creation of a Swift database using custom build"
versions: ["linked", "default", "nightly-latest"]
operatingSystems: ["macos", "ubuntu"]
operatingSystems: ["macos"]
env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
steps:
Expand Down
5 changes: 2 additions & 3 deletions pr-checks/checks/test-local-codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ steps:
- id: init
uses: ./../action/init
with:
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ./codeql-bundle-linux64.tar.gz
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code
shell: bash
run: ./build.sh
Expand Down
13 changes: 2 additions & 11 deletions pr-checks/checks/unset-environment.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
name: "Test unsetting environment variables"
description: "An end-to-end integration test that unsets some environment variables"
operatingSystems: ["ubuntu"]
excludeOsAndVersionCombination: [
# Known failure for Swift on Linux before CLI v2.17.4.
[ "ubuntu", "stable-20230403" ],
[ "ubuntu", "stable-v2.13.5" ],
[ "ubuntu", "stable-v2.14.6" ],
[ "ubuntu", "stable-v2.15.5" ],
[ "ubuntu", "stable-v2.16.6" ],
]

steps:
- uses: ./../action/init
id: init
with:
db-location: ${{ runner.temp }}/customDbLocation
# Swift is not supported on Ubuntu so we manually exclude it from the list here
languages: cpp,csharp,go,java,javascript,python,ruby
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- uses: actions/setup-go@v5
with:
go-version: '>=1.21.0'
Expand Down
9 changes: 9 additions & 0 deletions src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,15 @@ async function run() {
);
}

if (
config.languages.includes(Language.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(Language.go) &&
process.platform === "linux"
Expand Down
2 changes: 1 addition & 1 deletion tests/multi-language-repo/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ javac Main.java

go build main.go

if [[ "$OSTYPE" == "darwin"* || "$OSTYPE" == "linux-gnu"* ]]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
swift build
fi

Expand Down

0 comments on commit 9c646c2

Please # to comment.