diff --git a/.github/setup-swift/action.yml b/.github/setup-swift/action.yml new file mode 100644 index 0000000000..eb4f72f68d --- /dev/null +++ b/.github/setup-swift/action.yml @@ -0,0 +1,32 @@ +name: "Set up Swift" +description: Performs necessary steps to set up appropriate Swift version. +inputs: + codeql-path: + required: true +runs: + using: "composite" + steps: + - name: Get Swift version + id: get_swift_version + # We don't support Swift on Windows or prior versions of CLI. + if: "(runner.os != 'Windows') && (matrix.version == 'cached' || matrix.version == 'latest' || matrix.version == 'nightly-latest')" + shell: bash + env: + CODEQL_PATH: ${{inputs.codeql-path}} + 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]')" + VERSION="$("$SWIFT_EXTRACTOR_DIR/tools/$PLATFORM/extractor" --version | awk '/version/ { print $3 }')" + # Specify 5.7.0, otherwise setup Action will default to latest minor version. + if [ $VERSION = "5.7" ]; then + VERSION="5.7.0" + fi + echo "version=$VERSION" | tee -a $GITHUB_OUTPUT + - uses: swift-actions/setup-swift@194625b58a582570f61cc707c3b558086c26b723 + if: "(runner.os != 'Windows') && (matrix.version == 'cached' || matrix.version == 'latest' || matrix.version == 'nightly-latest')" + with: + swift-version: "${{steps.get_swift_version.outputs.version}}" diff --git a/.github/workflows/__export-file-baseline-information.yml b/.github/workflows/__export-file-baseline-information.yml index 9be43389a2..e8bb8ad7c0 100644 --- a/.github/workflows/__export-file-baseline-information.yml +++ b/.github/workflows/__export-file-baseline-information.yml @@ -42,18 +42,16 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} - - uses: swift-actions/setup-swift@194625b58a582570f61cc707c3b558086c26b723 - # Windows doesn't support Swift, and only macOS latest and nightly-latest support Swift 5.7.1. - if: runner.os == 'Linux' || (runner.os == 'macOS' && matrix.version == 'cached') - with: - swift-version: 5.7.0 - uses: ./../action/init + id: init with: languages: javascript tools: ${{ steps.prepare-test.outputs.tools-url }} env: CODEQL_FILE_BASELINE_INFORMATION: true - CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true + - uses: ./../action/.github/setup-swift + with: + codeql-path: ${{steps.init.outputs.codeql-path}} - name: Build code shell: bash run: ./build.sh @@ -62,7 +60,6 @@ jobs: output: ${{ runner.temp }}/results env: CODEQL_FILE_BASELINE_INFORMATION: true - CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true - name: Upload SARIF uses: actions/upload-artifact@v3 with: @@ -87,4 +84,5 @@ jobs: fi done env: + CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true # Remove when Swift is GA. CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__multi-language-autodetect.yml b/.github/workflows/__multi-language-autodetect.yml index 3525d5d38e..9a7adcb7d9 100644 --- a/.github/workflows/__multi-language-autodetect.yml +++ b/.github/workflows/__multi-language-autodetect.yml @@ -45,6 +45,10 @@ jobs: version: latest - os: macos-latest version: latest + - os: ubuntu-latest + version: nightly-latest + - os: macos-latest + version: nightly-latest name: Multi-language repository timeout-minutes: 45 runs-on: ${{ matrix.os }} @@ -61,17 +65,16 @@ jobs: uses: actions/setup-go@v3 with: go-version: ^1.13.1 - - uses: swift-actions/setup-swift@194625b58a582570f61cc707c3b558086c26b723 - # Only macOS latest and nightly-latest support Swift 5.7.1 - if: runner.os == 'Linux' || matrix.version == 'cached' - with: - swift-version: 5.7.0 - - uses: ./../action/init + id: init with: db-location: ${{ runner.temp }}/customDbLocation tools: ${{ steps.prepare-test.outputs.tools-url }} + - uses: ./../action/.github/setup-swift + with: + codeql-path: ${{steps.init.outputs.codeql-path}} + - name: Build code shell: bash run: ./build.sh @@ -125,8 +128,8 @@ jobs: fi - name: Check language autodetect for Swift - if: "!startsWith(matrix.os, 'windows') && (matrix.version == 'cached' || matrix.version\ - \ == 'latest' || matrix.version == 'nightly-latest')" + if: (matrix.version == 'cached' || matrix.version == 'latest' || matrix.version + == 'nightly-latest') shell: bash run: | SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }} diff --git a/.github/workflows/__swift-autobuild.yml b/.github/workflows/__swift-autobuild.yml index f641dd4265..678a1498a4 100644 --- a/.github/workflows/__swift-autobuild.yml +++ b/.github/workflows/__swift-autobuild.yml @@ -42,15 +42,17 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} - - uses: swift-actions/setup-swift@194625b58a582570f61cc707c3b558086c26b723 - # Only macOS latest and nightly-latest support Swift 5.7.1 - if: runner.os == 'Linux' || matrix.version == 'cached' - with: - swift-version: 5.7.0 - uses: ./../action/init + id: init with: languages: swift tools: ${{ steps.prepare-test.outputs.tools-url }} + - uses: ./../action/.github/setup-swift + with: + codeql-path: ${{steps.init.outputs.codeql-path}} + - name: Check working directory + shell: bash + run: pwd - uses: ./../action/autobuild - uses: ./../action/analyze id: analysis @@ -63,5 +65,5 @@ jobs: exit 1 fi env: - CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' + CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' # Remove when Swift is GA. CODEQL_ACTION_TEST_MODE: true diff --git a/.github/workflows/__swift-custom-build.yml b/.github/workflows/__swift-custom-build.yml index 7d7c151868..d5ebde1be1 100644 --- a/.github/workflows/__swift-custom-build.yml +++ b/.github/workflows/__swift-custom-build.yml @@ -33,6 +33,10 @@ jobs: version: cached - os: macos-latest version: cached + - os: ubuntu-latest + version: nightly-latest + - os: macos-latest + version: nightly-latest name: Swift analysis using a custom build command timeout-minutes: 45 runs-on: ${{ matrix.os }} @@ -44,15 +48,17 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} - - uses: swift-actions/setup-swift@194625b58a582570f61cc707c3b558086c26b723 - # Only macOS latest and nightly-latest support Swift 5.7.1 - if: runner.os == 'Linux' || matrix.version == 'cached' - with: - swift-version: 5.7.0 - uses: ./../action/init + id: init with: languages: swift tools: ${{ steps.prepare-test.outputs.tools-url }} + - uses: ./../action/.github/setup-swift + with: + codeql-path: ${{steps.init.outputs.codeql-path}} + - name: Check working directory + shell: bash + run: pwd - name: Build code shell: bash run: ./build.sh @@ -67,6 +73,6 @@ jobs: exit 1 fi env: - CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' + CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' # Remove when Swift is GA. DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' CODEQL_ACTION_TEST_MODE: true diff --git a/pr-checks/checks/export-file-baseline-information.yml b/pr-checks/checks/export-file-baseline-information.yml index c66e8dd142..e3008a1567 100644 --- a/pr-checks/checks/export-file-baseline-information.yml +++ b/pr-checks/checks/export-file-baseline-information.yml @@ -1,19 +1,19 @@ name: "Export file baseline information" description: "Tests that file baseline information is exported when the feature is enabled" versions: ["nightly-latest"] +env: + CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true # Remove when Swift is GA. steps: - - uses: swift-actions/setup-swift@194625b58a582570f61cc707c3b558086c26b723 - # Windows doesn't support Swift, and only macOS latest and nightly-latest support Swift 5.7.1. - if: runner.os == 'Linux' || (runner.os == 'macOS' && matrix.version == 'cached') - with: - swift-version: "5.7.0" - uses: ./../action/init + id: init with: languages: javascript tools: ${{ steps.prepare-test.outputs.tools-url }} env: CODEQL_FILE_BASELINE_INFORMATION: true - CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true + - uses: ./../action/.github/setup-swift + with: + codeql-path: ${{steps.init.outputs.codeql-path}} - name: Build code shell: bash run: ./build.sh @@ -22,7 +22,6 @@ steps: output: "${{ runner.temp }}/results" env: CODEQL_FILE_BASELINE_INFORMATION: true - CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true - name: Upload SARIF uses: actions/upload-artifact@v3 with: diff --git a/pr-checks/checks/multi-language-autodetect.yml b/pr-checks/checks/multi-language-autodetect.yml index 3832278aab..9b9b5336c5 100644 --- a/pr-checks/checks/multi-language-autodetect.yml +++ b/pr-checks/checks/multi-language-autodetect.yml @@ -1,21 +1,18 @@ name: "Multi-language repository" description: "An end-to-end integration test of a multi-language repository using automatic language detection" -# Temporarily exclude nightly-latest to unblock release -versions: ["stable-20211005", "stable-20220120", "stable-20220401", "cached", "latest"] operatingSystems: ["ubuntu", "macos"] env: CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: "true" # Remove when Swift is GA. steps: - - uses: swift-actions/setup-swift@194625b58a582570f61cc707c3b558086c26b723 - # Only macOS latest and nightly-latest support Swift 5.7.1 - if: runner.os == 'Linux' || matrix.version == 'cached' - with: - swift-version: "5.7.0" - - uses: ./../action/init + id: init with: db-location: "${{ runner.temp }}/customDbLocation" tools: ${{ steps.prepare-test.outputs.tools-url }} + + - uses: ./../action/.github/setup-swift + with: + codeql-path: ${{steps.init.outputs.codeql-path}} - name: Build code shell: bash @@ -69,7 +66,7 @@ steps: fi - name: Check language autodetect for Swift - if: "!startsWith(matrix.os, 'windows') && (matrix.version == 'cached' || matrix.version == 'latest' || matrix.version == 'nightly-latest')" + if: "(matrix.version == 'cached' || matrix.version == 'latest' || matrix.version == 'nightly-latest')" shell: bash run: | SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }} diff --git a/pr-checks/checks/swift-autobuild.yml b/pr-checks/checks/swift-autobuild.yml index b79edd5b34..2d57e634f7 100644 --- a/pr-checks/checks/swift-autobuild.yml +++ b/pr-checks/checks/swift-autobuild.yml @@ -4,17 +4,19 @@ versions: ["latest", "cached", "nightly-latest"] # Swift autobuilder is only supported on MacOS for private beta operatingSystems: ["macos"] env: - CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: "true" + CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: "true" # Remove when Swift is GA. steps: - - uses: swift-actions/setup-swift@194625b58a582570f61cc707c3b558086c26b723 - # Only macOS latest and nightly-latest support Swift 5.7.1 - if: runner.os == 'Linux' || matrix.version == 'cached' - with: - swift-version: "5.7.0" - uses: ./../action/init + id: init with: languages: swift tools: ${{ steps.prepare-test.outputs.tools-url }} + - uses: ./../action/.github/setup-swift + with: + codeql-path: ${{steps.init.outputs.codeql-path}} + - name: Check working directory + shell: bash + run: pwd - uses: ./../action/autobuild - uses: ./../action/analyze id: analysis diff --git a/pr-checks/checks/swift-custom-build.yml b/pr-checks/checks/swift-custom-build.yml index 733d9ad26a..b704e33584 100644 --- a/pr-checks/checks/swift-custom-build.yml +++ b/pr-checks/checks/swift-custom-build.yml @@ -1,21 +1,22 @@ name: "Swift analysis using a custom build command" description: "Tests creation of a Swift database using custom build" -# Temporarily exclude nightly-latest to unblock release -versions: ["latest", "cached"] +versions: ["latest", "cached", "nightly-latest"] operatingSystems: ["ubuntu", "macos"] env: - CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: "true" + CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: "true" # Remove when Swift is GA. DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" steps: - - uses: swift-actions/setup-swift@194625b58a582570f61cc707c3b558086c26b723 - # Only macOS latest and nightly-latest support Swift 5.7.1 - if: runner.os == 'Linux' || matrix.version == 'cached' - with: - swift-version: "5.7.0" - uses: ./../action/init + id: init with: languages: swift tools: ${{ steps.prepare-test.outputs.tools-url }} + - uses: ./../action/.github/setup-swift + with: + codeql-path: ${{steps.init.outputs.codeql-path}} + - name: Check working directory + shell: bash + run: pwd - name: Build code shell: bash run: ./build.sh