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 <aeisenberg@github.com>
This commit is contained in:
Angela P Wen 2024-08-02 16:27:45 +02:00 committed by GitHub
parent 8b7d7393fb
commit 9c646c24a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 66 additions and 64 deletions

View file

@ -60,10 +60,9 @@ jobs:
- id: init - id: init
uses: ./../action/init uses: ./../action/init
with: 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 }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh

View file

@ -74,10 +74,6 @@ jobs:
exit 1 exit 1
fi fi
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh

View file

@ -86,7 +86,7 @@ jobs:
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
expected_baseline_languages="c csharp go java kotlin javascript python ruby" 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" expected_baseline_languages+=" swift"
fi fi

View file

@ -29,14 +29,24 @@ jobs:
include: include:
- os: macos-12 - os: macos-12
version: stable-20230403 version: stable-20230403
- os: ubuntu-latest
version: stable-20230403
- os: macos-12 - os: macos-12
version: stable-v2.13.5 version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-12 - os: macos-12
version: stable-v2.14.6 version: stable-v2.14.6
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.15.5 version: stable-v2.15.5
- os: ubuntu-latest
version: stable-v2.15.5
- os: macos-latest - os: macos-latest
version: stable-v2.16.6 version: stable-v2.16.6
- os: ubuntu-latest
version: stable-v2.16.6
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
@ -85,9 +95,13 @@ jobs:
id: init id: init
with: with:
db-location: ${{ runner.temp }}/customDbLocation 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 }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift - uses: ./../action/.github/actions/setup-swift
if: runner.os == 'macOS'
with: with:
codeql-path: ${{ steps.init.outputs.codeql-path }} codeql-path: ${{ steps.init.outputs.codeql-path }}
@ -139,8 +153,8 @@ jobs:
exit 1 exit 1
fi fi
- name: Check language autodetect for Swift - name: Check language autodetect for Swift on MacOS
if: runner.os != 'Windows' && matrix.version != 'stable-20230403' if: runner.os == 'macOS' && matrix.version != 'stable-20230403'
shell: bash shell: bash
run: | run: |
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }} SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}

View file

@ -29,16 +29,10 @@ jobs:
include: include:
- os: macos-latest - os: macos-latest
version: linked version: linked
- os: ubuntu-latest
version: linked
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest
version: default
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: ubuntu-latest
version: nightly-latest
name: Swift analysis using a custom build command name: Swift analysis using a custom build command
permissions: permissions:
contents: read contents: read

View file

@ -66,10 +66,9 @@ jobs:
- id: init - id: init
uses: ./../action/init uses: ./../action/init
with: 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 tools: ./codeql-bundle-linux64.tar.gz
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh

View file

@ -27,6 +27,16 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20230403
- os: ubuntu-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: ubuntu-latest
version: stable-v2.15.5
- os: ubuntu-latest
version: stable-v2.16.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
@ -65,10 +75,9 @@ jobs:
id: init id: init
with: with:
db-location: ${{ runner.temp }}/customDbLocation 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 }} 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 - uses: actions/setup-go@v5
with: with:
go-version: '>=1.21.0' go-version: '>=1.21.0'

View file

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

View file

@ -42,10 +42,9 @@ jobs:
- id: init - id: init
uses: ./../action/init uses: ./../action/init
with: 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 }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh

4
lib/init-action.js generated
View file

@ -188,6 +188,10 @@ async function run() {
core.exportVariable("GOFLAGS", goFlags); core.exportVariable("GOFLAGS", goFlags);
core.warning("Passing the GOFLAGS env parameter to the init action is deprecated. Please move this to the analyze action."); core.warning("Passing the GOFLAGS env parameter to the init action is deprecated. Please move this to the analyze action.");
} }
if (config.languages.includes(languages_1.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(languages_1.Language.go) && if (config.languages.includes(languages_1.Language.go) &&
process.platform === "linux") { process.platform === "linux") {
try { try {

File diff suppressed because one or more lines are too long

View file

@ -7,10 +7,9 @@ steps:
- id: init - id: init
uses: ./../action/init uses: ./../action/init
with: 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 }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh

View file

@ -20,10 +20,6 @@ steps:
exit 1 exit 1
fi fi
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh

View file

@ -29,7 +29,7 @@ steps:
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
expected_baseline_languages="c csharp go java kotlin javascript python ruby" 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" expected_baseline_languages+=" swift"
fi fi

View file

@ -1,14 +1,6 @@
name: "Multi-language repository" 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"] 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: steps:
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
@ -18,9 +10,12 @@ steps:
id: init id: init
with: with:
db-location: "${{ runner.temp }}/customDbLocation" 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 }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/.github/actions/setup-swift - uses: ./../action/.github/actions/setup-swift
if: runner.os == 'macOS'
with: with:
codeql-path: ${{ steps.init.outputs.codeql-path }} codeql-path: ${{ steps.init.outputs.codeql-path }}
@ -72,8 +67,8 @@ steps:
exit 1 exit 1
fi fi
- name: Check language autodetect for Swift - name: Check language autodetect for Swift on MacOS
if: runner.os != 'Windows' && matrix.version != 'stable-20230403' if: runner.os == 'macOS' && matrix.version != 'stable-20230403'
shell: bash shell: bash
run: | run: |
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }} SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}

View file

@ -1,7 +1,7 @@
name: "Swift analysis using a custom build command" name: "Swift analysis using a custom build command"
description: "Tests creation of a Swift database using custom build" description: "Tests creation of a Swift database using custom build"
versions: ["linked", "default", "nightly-latest"] versions: ["linked", "default", "nightly-latest"]
operatingSystems: ["macos", "ubuntu"] operatingSystems: ["macos"]
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
steps: steps:

View file

@ -12,10 +12,9 @@ steps:
- id: init - id: init
uses: ./../action/init uses: ./../action/init
with: 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 tools: ./codeql-bundle-linux64.tar.gz
- uses: ./../action/.github/actions/setup-swift
with:
codeql-path: ${{ steps.init.outputs.codeql-path }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh

View file

@ -1,24 +1,15 @@
name: "Test unsetting environment variables" name: "Test unsetting environment variables"
description: "An end-to-end integration test that unsets some environment variables" description: "An end-to-end integration test that unsets some environment variables"
operatingSystems: ["ubuntu"] 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: steps:
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
db-location: ${{ runner.temp }}/customDbLocation 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 }} 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 - uses: actions/setup-go@v5
with: with:
go-version: '>=1.21.0' go-version: '>=1.21.0'

View file

@ -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 ( if (
config.languages.includes(Language.go) && config.languages.includes(Language.go) &&
process.platform === "linux" process.platform === "linux"

View file

@ -8,7 +8,7 @@ javac Main.java
go build main.go go build main.go
if [[ "$OSTYPE" == "darwin"* || "$OSTYPE" == "linux-gnu"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
swift build swift build
fi fi