Make Swift setup more consistent with default setup
This commit is contained in:
parent
a98b9bd46b
commit
f128379387
3 changed files with 7 additions and 12 deletions
15
.github/actions/setup-swift/action.yml
vendored
15
.github/actions/setup-swift/action.yml
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
name: "Set up Swift"
|
name: "Set up Swift on Linux"
|
||||||
description: Sets up an appropriate Swift version if supported on this platform.
|
description: Sets up an appropriate Swift version on Linux.
|
||||||
inputs:
|
inputs:
|
||||||
codeql-path:
|
codeql-path:
|
||||||
description: Path to the CodeQL CLI executable.
|
description: Path to the CodeQL CLI executable.
|
||||||
|
|
@ -9,21 +9,16 @@ runs:
|
||||||
steps:
|
steps:
|
||||||
- name: Get Swift version
|
- name: Get Swift version
|
||||||
id: get_swift_version
|
id: get_swift_version
|
||||||
if: runner.os != 'Windows'
|
if: runner.os == 'Linux'
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
CODEQL_PATH: ${{ inputs.codeql-path }}
|
CODEQL_PATH: ${{ inputs.codeql-path }}
|
||||||
run: |
|
run: |
|
||||||
if [[ $RUNNER_OS = "macOS" ]]; then
|
|
||||||
PLATFORM="osx64"
|
|
||||||
else # We do not run this step on Windows.
|
|
||||||
PLATFORM="linux64"
|
|
||||||
fi
|
|
||||||
SWIFT_EXTRACTOR_DIR="$("$CODEQL_PATH" resolve languages --format json | jq -r '.swift[0]')"
|
SWIFT_EXTRACTOR_DIR="$("$CODEQL_PATH" resolve languages --format json | jq -r '.swift[0]')"
|
||||||
if [ $SWIFT_EXTRACTOR_DIR = "null" ]; then
|
if [ $SWIFT_EXTRACTOR_DIR = "null" ]; then
|
||||||
VERSION="null"
|
VERSION="null"
|
||||||
else
|
else
|
||||||
VERSION="$("$SWIFT_EXTRACTOR_DIR/tools/$PLATFORM/extractor" --version | awk '/version/ { print $3 }')"
|
VERSION="$("$SWIFT_EXTRACTOR_DIR/tools/linux64/extractor" --version | awk '/version/ { print $3 }')"
|
||||||
# Specify 5.x.0, otherwise setup Action will default to latest minor version.
|
# Specify 5.x.0, otherwise setup Action will default to latest minor version.
|
||||||
if [ $VERSION = "5.7" ]; then
|
if [ $VERSION = "5.7" ]; then
|
||||||
VERSION="5.7.0"
|
VERSION="5.7.0"
|
||||||
|
|
@ -37,6 +32,6 @@ runs:
|
||||||
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
|
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
|
||||||
|
|
||||||
- uses: swift-actions/setup-swift@65540b95f51493d65f5e59e97dcef9629ddf11bf # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
|
- uses: swift-actions/setup-swift@65540b95f51493d65f5e59e97dcef9629ddf11bf # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
|
||||||
if: runner.os != 'Windows' && steps.get_swift_version.outputs.version != 'null'
|
if: runner.os == 'Linux' && steps.get_swift_version.outputs.version != 'null'
|
||||||
with:
|
with:
|
||||||
swift-version: "${{ steps.get_swift_version.outputs.version }}"
|
swift-version: "${{ steps.get_swift_version.outputs.version }}"
|
||||||
|
|
|
||||||
2
.github/workflows/__export-file-baseline-information.yml
generated
vendored
2
.github/workflows/__export-file-baseline-information.yml
generated
vendored
|
|
@ -62,7 +62,7 @@ jobs:
|
||||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
CODEQL_FILE_BASELINE_INFORMATION: true
|
||||||
- uses: ./../action/.github/actions/setup-swift
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
with:
|
with:
|
||||||
codeql-path: ${{steps.init.outputs.codeql-path}}
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ steps:
|
||||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
CODEQL_FILE_BASELINE_INFORMATION: true
|
||||||
- uses: ./../action/.github/actions/setup-swift
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
with:
|
with:
|
||||||
codeql-path: ${{steps.init.outputs.codeql-path}}
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue