From 346d5c4b07cc4c12623714ee29f8e285903be4e5 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Thu, 12 Oct 2023 11:41:54 +0100 Subject: [PATCH] Test sub-language file coverage in file baseline information check We can do this now that the nightly has a version number starting with 2.15.0. --- .../workflows/__export-file-baseline-information.yml | 9 +++------ pr-checks/checks/export-file-baseline-information.yml | 10 ++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/__export-file-baseline-information.yml b/.github/workflows/__export-file-baseline-information.yml index 6c4b637bff..502f06e8f4 100644 --- a/.github/workflows/__export-file-baseline-information.yml +++ b/.github/workflows/__export-file-baseline-information.yml @@ -59,8 +59,6 @@ jobs: with: languages: javascript tools: ${{ steps.prepare-test.outputs.tools-url }} - env: - CODEQL_FILE_BASELINE_INFORMATION: true - uses: ./../action/.github/actions/setup-swift with: codeql-path: ${{ steps.init.outputs.codeql-path }} @@ -70,8 +68,6 @@ jobs: - uses: ./../action/analyze with: output: ${{ runner.temp }}/results - env: - CODEQL_FILE_BASELINE_INFORMATION: true - name: Upload SARIF uses: actions/upload-artifact@v3 with: @@ -82,13 +78,13 @@ jobs: shell: bash run: | cd "$RUNNER_TEMP/results" - expected_baseline_languages="cpp cs go java js py rb" + expected_baseline_languages="c csharp go java kotlin javascript python ruby" if [[ $RUNNER_OS != "Windows" ]]; then expected_baseline_languages+=" swift" fi for lang in ${expected_baseline_languages}; do - rule_name="${lang}/baseline/expected-extracted-files" + rule_name="cli/expected-extracted-files/${lang}" found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications | select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif) if [[ "${found_notification}" != "true" ]]; then @@ -99,4 +95,5 @@ jobs: fi done env: + CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true 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 3c24f1a340..f0a8a5d853 100644 --- a/pr-checks/checks/export-file-baseline-information.yml +++ b/pr-checks/checks/export-file-baseline-information.yml @@ -1,14 +1,14 @@ name: "Export file baseline information" description: "Tests that file baseline information is exported when the feature is enabled" versions: ["nightly-latest"] +env: + CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true steps: - uses: ./../action/init id: init with: languages: javascript tools: ${{ steps.prepare-test.outputs.tools-url }} - env: - CODEQL_FILE_BASELINE_INFORMATION: true - uses: ./../action/.github/actions/setup-swift with: codeql-path: ${{ steps.init.outputs.codeql-path }} @@ -18,8 +18,6 @@ steps: - uses: ./../action/analyze with: output: "${{ runner.temp }}/results" - env: - CODEQL_FILE_BASELINE_INFORMATION: true - name: Upload SARIF uses: actions/upload-artifact@v3 with: @@ -30,13 +28,13 @@ steps: shell: bash run: | cd "$RUNNER_TEMP/results" - expected_baseline_languages="cpp cs go java js py rb" + expected_baseline_languages="c csharp go java kotlin javascript python ruby" if [[ $RUNNER_OS != "Windows" ]]; then expected_baseline_languages+=" swift" fi for lang in ${expected_baseline_languages}; do - rule_name="${lang}/baseline/expected-extracted-files" + rule_name="cli/expected-extracted-files/${lang}" found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications | select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif) if [[ "${found_notification}" != "true" ]]; then