Compare commits

...

42 Commits

Author SHA1 Message Date
Henry Mercer
a12c274149 Bump version to 3.24.11 2024-05-15 11:21:45 +01:00
Henry Mercer
80e1b4d00c Update default bundle to codeql-bundle-v2.16.6 2024-05-14 18:06:38 +01:00
Chuan-kai Lin
4355270be1 Merge pull request #2226 from github/update-v3.24.10-7df281f2f
Merge main into releases/v3
2024-04-05 07:59:34 -07:00
github-actions[bot]
3f041c51a5 Update changelog for v3.24.10 2024-04-05 14:03:20 +00:00
Angela P Wen
7df281f2fe Gracefully continue if createStatusReportBase throws (#2225)
Previously, we weren't catching any possible exceptions in `createStatusReportBase` and runs would fail if any of the telemetry sub-items threw exceptions. As telemetry should not block the analysis, we continue here even if the status report throws.
2024-04-04 15:26:14 -07:00
Angela P Wen
f421cda8e7 Run integration test PR checks nightly (#2222)
* Run integration test PR checks nightly

Scheduled for 5AM UTC. This will assist in catching bugs introduced with new runner images.

* Specify generated YAML indentations

For consistency with our non-autogenerated files and GitHub documentation, we should further indent items in lists (`sequence`).
2024-04-04 10:30:18 -07:00
Nick Fyson
5f535debfe Merge pull request #2221 from github/nickfyson/upload-logging
improve logging coverage during sarif upload
2024-04-04 17:30:55 +01:00
Chuan-kai Lin
278465cdfb Merge pull request #2219 from github/update-bundle/codeql-bundle-v2.17.0
Update default bundle to 2.17.0
2024-04-04 08:20:40 -07:00
Chuan-kai Lin
65e69c8a4b Merge branch 'main' into update-bundle/codeql-bundle-v2.17.0 2024-04-04 07:23:39 -07:00
nickfyson
c037115ddf clarify logging in response to pr review comments 2024-04-03 21:19:06 +01:00
nickfyson
d3c32a84cb fix test to respect updated logging behaviour 2024-04-03 21:04:50 +01:00
Nick Fyson
26540626a5 Merge branch 'main' into nickfyson/upload-logging 2024-04-03 20:54:58 +01:00
nickfyson
d3257627d7 fix linting error 2024-04-03 20:50:03 +01:00
nickfyson
978bdd643f fix test that runs flakily locally 2024-04-03 20:43:26 +01:00
Nick Fyson
2cc8bbd0e0 Apply suggestions from code review
Co-authored-by: Henry Mercer <henrymercer@github.com>
2024-04-03 20:42:48 +01:00
Henry Mercer
3bd9c3e65c Merge pull request #2220 from github/update-supported-enterprise-server-versions
Update supported GitHub Enterprise Server versions
2024-04-03 18:06:05 +01:00
Henry Mercer
dcf00b3fd4 Account for varying major version number in error message 2024-04-03 15:50:23 +01:00
Henry Mercer
f8dd543c81 Add changelog note 2024-04-03 15:48:31 +01:00
nickfyson
6514cbb626 improve logging coverage when uploaing sarif files 2024-04-03 15:45:28 +01:00
Henry Mercer
f06c933b16 Update soon to be deprecated CodeQL version 2024-04-03 15:44:00 +01:00
Henry Mercer
eda4878a3d Only pass --new-analysis-summary if it is not default behavior 2024-04-03 15:39:22 +01:00
github-actions[bot]
eeaea14a62 Update supported GitHub Enterprise Server versions 2024-04-03 00:11:45 +00:00
github-actions[bot]
ec214df87a Add changelog note 2024-04-02 19:07:27 +00:00
github-actions[bot]
f4936c4c20 Update default bundle to codeql-bundle-v2.17.0 2024-04-02 19:07:23 +00:00
Angela P Wen
99c9897648 Merge pull request #2217 from github/dependabot/npm_and_yarn/npm-eb3e2c410b
Bump the npm group with 2 updates
2024-04-01 11:55:51 -07:00
github-actions[bot]
d7c4cc360c Update checked-in dependencies 2024-04-01 17:45:06 +00:00
dependabot[bot]
048b508a9d Bump the npm group with 2 updates
Bumps the npm group with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `@typescript-eslint/eslint-plugin` from 7.3.1 to 7.4.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.4.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 7.3.1 to 7.4.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.4.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 17:43:33 +00:00
Koen Vlaswinkel
84ba7fb56d Merge pull request #2199 from github/koesie10/cli-sarif-merge
Use `github merge-results` command for merging SARIF files
2024-03-27 14:39:20 +01:00
Koen Vlaswinkel
016720d81f Refactor areAllRunsProducedByCodeQL to use Array.every 2024-03-26 11:09:44 +01:00
Koen Vlaswinkel
f835435c19 Rename run to uploadArtifacts 2024-03-26 11:05:21 +01:00
Koen Vlaswinkel
58194bf81a Do not require debug mode for debugging uploads 2024-03-26 11:05:04 +01:00
Koen Vlaswinkel
82b82e58c0 Only upload combined SARIF files when env var is set 2024-03-25 10:15:42 +01:00
Koen Vlaswinkel
3c4b8bc120 Change log levels 2024-03-25 10:15:37 +01:00
Koen Vlaswinkel
a0a63a2dd4 Do not try merging a single SARIF file 2024-03-25 10:15:16 +01:00
Koen Vlaswinkel
3bd271cec3 Introduce areAllRunsProducedByCodeQL function 2024-03-25 10:14:59 +01:00
Koen Vlaswinkel
70aa50b057 Use runTool for mergeResults 2024-03-25 10:13:21 +01:00
Koen Vlaswinkel
6ac57535de Use options object instead of boolean for mergeResults 2024-03-25 10:13:15 +01:00
Koen Vlaswinkel
e20c273295 Use supportsFeature check for merging SARIF files 2024-03-22 14:15:42 +01:00
Koen Vlaswinkel
2bbafcdd7f Upload debug artifacts for upload-sarif 2024-03-22 14:15:17 +01:00
Koen Vlaswinkel
7e30c622b0 Use subdirectory for combined SARIF file 2024-03-22 14:15:16 +01:00
Koen Vlaswinkel
ccc609bf1a Use github merge-results command when feature flag is enabled 2024-03-22 14:15:00 +01:00
Koen Vlaswinkel
a12b868bbc Create feature flag for merging SARIF files using the CLI 2024-03-22 14:14:44 +01:00
178 changed files with 4804 additions and 4032 deletions

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
all-platform-bundle: all-platform-bundle:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: All-platform bundle name: All-platform bundle
permissions: permissions:
contents: read contents: read
@@ -34,44 +36,44 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'true' use-all-platform-bundle: 'true'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- id: init - id: init
uses: ./../action/init uses: ./../action/init
with: with:
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
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
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
analyze-ref-input: analyze-ref-input:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
name: "Analyze: 'ref' and 'sha' from inputs" name: "Analyze: 'ref' and 'sha' from inputs"
permissions: permissions:
contents: read contents: read
@@ -38,45 +40,45 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
languages: cpp,csharp,java,javascript,python languages: cpp,csharp,java,javascript,python
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
github.sha }} github.sha }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
ref: refs/heads/main ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2 sha: 5e235361806c361d4d3f8859e3c897658025a9a2
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
autobuild-action: autobuild-action:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
name: autobuild-action name: autobuild-action
permissions: permissions:
contents: read contents: read
@@ -38,55 +40,55 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: csharp languages: csharp
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild - uses: ./../action/autobuild
env: env:
# Explicitly disable the CLR tracer. # Explicitly disable the CLR tracer.
COR_ENABLE_PROFILING: '' COR_ENABLE_PROFILING: ''
COR_PROFILER: '' COR_PROFILER: ''
COR_PROFILER_PATH_64: '' COR_PROFILER_PATH_64: ''
CORECLR_ENABLE_PROFILING: '' CORECLR_ENABLE_PROFILING: ''
CORECLR_PROFILER: '' CORECLR_PROFILER: ''
CORECLR_PROFILER_PATH_64: '' CORECLR_PROFILER_PATH_64: ''
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d csharp ]]; then if [[ ! -d csharp ]]; then
echo "Did not find a C# database" echo "Did not find a C# database"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
build-mode-autobuild: build-mode-autobuild:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode autobuild name: Build mode autobuild
permissions: permissions:
contents: read contents: read
@@ -34,55 +36,55 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Set up Java test repo configuration - name: Set up Java test repo configuration
run: | run: |
mv * .github ../action/tests/multi-language-repo/ mv * .github ../action/tests/multi-language-repo/
mv ../action/tests/multi-language-repo/.github/workflows .github mv ../action/tests/multi-language-repo/.github/workflows .github
mv ../action/tests/java-repo/* . mv ../action/tests/java-repo/* .
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
build-mode: autobuild build-mode: autobuild
db-location: ${{ runner.temp }}/customDbLocation db-location: ${{ runner.temp }}/customDbLocation
languages: java languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode - name: Validate database build mode
run: | run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml" metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path") build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "autobuild" ]]; then if [[ "$build_mode" != "autobuild" ]]; then
echo "Expected build mode to be 'autobuild' but was $build_mode" echo "Expected build mode to be 'autobuild' but was $build_mode"
exit 1 exit 1
fi fi
- uses: ./../action/analyze - uses: ./../action/analyze
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
build-mode-manual: build-mode-manual:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode manual name: Build mode manual
permissions: permissions:
contents: read contents: read
@@ -34,57 +36,57 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
build-mode: manual build-mode: manual
db-location: ${{ runner.temp }}/customDbLocation db-location: ${{ runner.temp }}/customDbLocation
languages: java languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode - name: Validate database build mode
run: | run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml" metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path") build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "manual" ]]; then if [[ "$build_mode" != "manual" ]]; then
echo "Expected build mode to be 'manual' but was $build_mode" echo "Expected build mode to be 'manual' but was $build_mode"
exit 1 exit 1
fi fi
- 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
- uses: ./../action/analyze - uses: ./../action/analyze
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,24 +11,26 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
build-mode-none: build-mode-none:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode none name: Build mode none
permissions: permissions:
contents: read contents: read
@@ -36,53 +38,53 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
build-mode: none build-mode: none
db-location: ${{ runner.temp }}/customDbLocation db-location: ${{ runner.temp }}/customDbLocation
languages: java languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode - name: Validate database build mode
run: | run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml" metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path") build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "none" ]]; then if [[ "$build_mode" != "none" ]]; then
echo "Expected build mode to be 'none' but was $build_mode" echo "Expected build mode to be 'none' but was $build_mode"
exit 1 exit 1
fi fi
# The latest nightly supports omitting the autobuild Action when the build mode is specified. # The latest nightly supports omitting the autobuild Action when the build mode is specified.
- uses: ./../action/autobuild - uses: ./../action/autobuild
if: matrix.version != 'nightly-latest' if: matrix.version != 'nightly-latest'
- uses: ./../action/analyze - uses: ./../action/analyze
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
build-mode-rollback: build-mode-rollback:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Build mode rollback name: Build mode rollback
permissions: permissions:
contents: read contents: read
@@ -34,56 +36,56 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Set up Java test repo configuration - name: Set up Java test repo configuration
run: | run: |
mv * .github ../action/tests/multi-language-repo/ mv * .github ../action/tests/multi-language-repo/
mv ../action/tests/multi-language-repo/.github/workflows .github mv ../action/tests/multi-language-repo/.github/workflows .github
mv ../action/tests/java-repo/* . mv ../action/tests/java-repo/* .
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
build-mode: none build-mode: none
db-location: ${{ runner.temp }}/customDbLocation db-location: ${{ runner.temp }}/customDbLocation
languages: java languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Validate database build mode - name: Validate database build mode
run: | run: |
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml" metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
build_mode=$(yq eval '.buildMode' "$metadata_path") build_mode=$(yq eval '.buildMode' "$metadata_path")
if [[ "$build_mode" != "autobuild" ]]; then if [[ "$build_mode" != "autobuild" ]]; then
echo "Expected build mode to be 'autobuild' but was $build_mode" echo "Expected build mode to be 'autobuild' but was $build_mode"
exit 1 exit 1
fi fi
- uses: ./../action/analyze - uses: ./../action/analyze
env: env:
CODEQL_ACTION_DISABLE_JAVA_BUILDLESS: true CODEQL_ACTION_DISABLE_JAVA_BUILDLESS: true
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

160
.github/workflows/__config-export.yml generated vendored
View File

@@ -11,32 +11,34 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
config-export: config-export:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: Config export name: Config export
permissions: permissions:
contents: read contents: read
@@ -44,72 +46,72 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: javascript languages: javascript
queries: security-extended queries: security-extended
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: config-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json name: config-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7 retention-days: 7
- name: Check config properties appear in SARIF - name: Check config properties appear in SARIF
uses: actions/github-script@v7 uses: actions/github-script@v7
env: env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with: with:
script: | script: |
const fs = require('fs'); const fs = require('fs');
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8')); const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0]; const run = sarif.runs[0];
const configSummary = run.properties.codeqlConfigSummary; const configSummary = run.properties.codeqlConfigSummary;
if (configSummary === undefined) { if (configSummary === undefined) {
core.setFailed('`codeqlConfigSummary` property not found in the SARIF run property bag.'); core.setFailed('`codeqlConfigSummary` property not found in the SARIF run property bag.');
} }
if (configSummary.disableDefaultQueries !== false) { if (configSummary.disableDefaultQueries !== false) {
core.setFailed('`disableDefaultQueries` property incorrect: expected false, got ' + core.setFailed('`disableDefaultQueries` property incorrect: expected false, got ' +
`${JSON.stringify(configSummary.disableDefaultQueries)}.`); `${JSON.stringify(configSummary.disableDefaultQueries)}.`);
} }
const expectedQueries = [{ type: 'builtinSuite', uses: 'security-extended' }]; const expectedQueries = [{ type: 'builtinSuite', uses: 'security-extended' }];
// Use JSON.stringify to deep-equal the arrays. // Use JSON.stringify to deep-equal the arrays.
if (JSON.stringify(configSummary.queries) !== JSON.stringify(expectedQueries)) { if (JSON.stringify(configSummary.queries) !== JSON.stringify(expectedQueries)) {
core.setFailed(`\`queries\` property incorrect: expected ${JSON.stringify(expectedQueries)}, got ` + core.setFailed(`\`queries\` property incorrect: expected ${JSON.stringify(expectedQueries)}, got ` +
`${JSON.stringify(configSummary.queries)}.`); `${JSON.stringify(configSummary.queries)}.`);
} }
core.info('Finished config export tests.'); core.info('Finished config export tests.');
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

112
.github/workflows/__config-input.yml generated vendored
View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
config-input: config-input:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
name: Config input name: Config input
permissions: permissions:
contents: read contents: read
@@ -34,59 +36,59 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Copy queries into workspace - name: Copy queries into workspace
run: | run: |
cp -a ../action/queries . cp -a ../action/queries .
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
languages: javascript languages: javascript
build-mode: none build-mode: none
config: | config: |
disable-default-queries: true disable-default-queries: true
queries: queries:
- name: Run custom query - name: Run custom query
uses: ./queries/default-setup-environment-variables.ql uses: ./queries/default-setup-environment-variables.ql
paths-ignore: paths-ignore:
- tests - tests
- lib - lib
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
- name: Check SARIF - name: Check SARIF
uses: ./../action/.github/actions/check-sarif uses: ./../action/.github/actions/check-sarif
with: with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run: javascript/codeql-action/default-setup-env-vars queries-run: javascript/codeql-action/default-setup-env-vars
queries-not-run: javascript/codeql-action/default-setup-context-properties queries-not-run: javascript/codeql-action/default-setup-context-properties
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
cpp-deptrace-disabled: cpp-deptrace-disabled:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: 'C/C++: disabling autoinstalling dependencies (Linux)' name: 'C/C++: disabling autoinstalling dependencies (Linux)'
permissions: permissions:
contents: read contents: read
@@ -38,51 +40,51 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Test setup - name: Test setup
shell: bash shell: bash
run: | run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: cpp languages: cpp
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild - uses: ./../action/autobuild
with: with:
working-directory: autobuild-dir working-directory: autobuild-dir
env: env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false
- shell: bash - shell: bash
run: | run: |
if ls /usr/bin/errno; then if ls /usr/bin/errno; then
echo "C/C++ autobuild installed errno, but it should not have since auto-install dependencies is disabled." echo "C/C++ autobuild installed errno, but it should not have since auto-install dependencies is disabled."
exit 1 exit 1
fi fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
cpp-deptrace-enabled-on-macos: cpp-deptrace-enabled-on-macos:
strategy: strategy:
matrix: matrix:
include: include:
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: 'C/C++: autoinstalling dependencies is skipped (macOS)' name: 'C/C++: autoinstalling dependencies is skipped (macOS)'
permissions: permissions:
contents: read contents: read
@@ -34,53 +36,53 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Test setup - name: Test setup
shell: bash shell: bash
run: | run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: cpp languages: cpp
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild - uses: ./../action/autobuild
with: with:
working-directory: autobuild-dir working-directory: autobuild-dir
env: env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
- shell: bash - shell: bash
run: | run: |
if ! ls /usr/bin/errno; then if ! ls /usr/bin/errno; then
echo "As expected, CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES is a no-op on macOS" echo "As expected, CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES is a no-op on macOS"
else else
echo "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES should not have had any effect on macOS" echo "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES should not have had any effect on macOS"
exit 1 exit 1
fi fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
cpp-deptrace-enabled: cpp-deptrace-enabled:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: 'C/C++: autoinstalling dependencies (Linux)' name: 'C/C++: autoinstalling dependencies (Linux)'
permissions: permissions:
contents: read contents: read
@@ -38,51 +40,51 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Test setup - name: Test setup
shell: bash shell: bash
run: | run: |
cp -a ../action/tests/cpp-autobuild autobuild-dir cp -a ../action/tests/cpp-autobuild autobuild-dir
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: cpp languages: cpp
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild - uses: ./../action/autobuild
with: with:
working-directory: autobuild-dir working-directory: autobuild-dir
env: env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: true
- shell: bash - shell: bash
run: | run: |
if ! ls /usr/bin/errno; then if ! ls /usr/bin/errno; then
echo "Did not autoinstall errno" echo "Did not autoinstall errno"
exit 1 exit 1
fi fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,38 +11,40 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
diagnostics-export: diagnostics-export:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230317 version: stable-20230317
- os: macos-latest - os: macos-latest
version: stable-20230317 version: stable-20230317
- os: windows-latest - os: windows-latest
version: stable-20230317 version: stable-20230317
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: Diagnostic export name: Diagnostic export
permissions: permissions:
contents: read contents: read
@@ -50,113 +52,113 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Add test diagnostics - name: Add test diagnostics
shell: bash shell: bash
env: env:
CODEQL_PATH: ${{ steps.init.outputs.codeql-path }} CODEQL_PATH: ${{ steps.init.outputs.codeql-path }}
run: | run: |
for i in {1..2}; do for i in {1..2}; do
# Use the same location twice to test the workaround for the bug in CodeQL CLI 2.12.5 that # Use the same location twice to test the workaround for the bug in CodeQL CLI 2.12.5 that
# produces an invalid diagnostic with multiple identical location objects. # produces an invalid diagnostic with multiple identical location objects.
"$CODEQL_PATH" database add-diagnostic \ "$CODEQL_PATH" database add-diagnostic \
"$RUNNER_TEMP/codeql_databases/javascript" \ "$RUNNER_TEMP/codeql_databases/javascript" \
--file-path /path/to/file \ --file-path /path/to/file \
--plaintext-message "Plaintext message $i" \ --plaintext-message "Plaintext message $i" \
--source-id "lang/diagnostics/example" \ --source-id "lang/diagnostics/example" \
--source-name "Diagnostic name" \ --source-name "Diagnostic name" \
--ready-for-status-page --ready-for-status-page
done done
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7 retention-days: 7
- name: Check diagnostics appear in SARIF - name: Check diagnostics appear in SARIF
uses: actions/github-script@v7 uses: actions/github-script@v7
env: env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with: with:
script: | script: |
const fs = require('fs'); const fs = require('fs');
function checkStatusPageNotification(n) { function checkStatusPageNotification(n) {
const expectedMessage = 'Plaintext message 1\n\nCodeQL also found 1 other diagnostic like this. See the workflow log for details.'; const expectedMessage = 'Plaintext message 1\n\nCodeQL also found 1 other diagnostic like this. See the workflow log for details.';
if (n.message.text !== expectedMessage) { if (n.message.text !== expectedMessage) {
core.setFailed(`Expected the status page diagnostic to have the message '${expectedMessage}', but found '${n.message.text}'.`); core.setFailed(`Expected the status page diagnostic to have the message '${expectedMessage}', but found '${n.message.text}'.`);
}
if (n.locations.length !== 1) {
core.setFailed(`Expected the status page diagnostic to have exactly 1 location, but found ${n.locations.length}.`);
}
} }
if (n.locations.length !== 1) {
core.setFailed(`Expected the status page diagnostic to have exactly 1 location, but found ${n.locations.length}.`); const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0];
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const statusPageNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'lang/diagnostics/example' && n.properties?.visibility?.statusPage
);
if (statusPageNotifications.length !== 1) {
core.setFailed(
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
} }
} checkStatusPageNotification(statusPageNotifications[0]);
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8')); const notifications = run.tool.driver.notifications;
const run = sarif.runs[0]; const diagnosticNotification = notifications.filter(n =>
n.id === 'lang/diagnostics/example' && n.name === 'lang/diagnostics/example' &&
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications; n.fullDescription.text === 'Diagnostic name'
const statusPageNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'lang/diagnostics/example' && n.properties?.visibility?.statusPage
);
if (statusPageNotifications.length !== 1) {
core.setFailed(
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
); );
} if (diagnosticNotification.length !== 1) {
checkStatusPageNotification(statusPageNotifications[0]); core.setFailed(
'Expected exactly one notification for this diagnostic in the ' +
`'runs[].tool.driver.notifications[]' SARIF property, but found ` +
`${diagnosticNotification.length}. All notifications: ` +
`${JSON.stringify(notifications)}.`
);
}
const notifications = run.tool.driver.notifications; core.info('Finished diagnostic export test');
const diagnosticNotification = notifications.filter(n =>
n.id === 'lang/diagnostics/example' && n.name === 'lang/diagnostics/example' &&
n.fullDescription.text === 'Diagnostic name'
);
if (diagnosticNotification.length !== 1) {
core.setFailed(
'Expected exactly one notification for this diagnostic in the ' +
`'runs[].tool.driver.notifications[]' SARIF property, but found ` +
`${diagnosticNotification.length}. All notifications: ` +
`${JSON.stringify(notifications)}.`
);
}
core.info('Finished diagnostic export test');
env: env:
CODEQL_ACTION_EXPORT_DIAGNOSTICS: true CODEQL_ACTION_EXPORT_DIAGNOSTICS: true
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
export-file-baseline-information: export-file-baseline-information:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: Export file baseline information name: Export file baseline information
permissions: permissions:
contents: read contents: read
@@ -38,72 +40,72 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
languages: javascript languages: javascript
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
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
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7 retention-days: 7
- name: Check results - name: Check results
shell: bash shell: bash
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 != "Windows" ]]; then
expected_baseline_languages+=" swift" expected_baseline_languages+=" swift"
fi
for lang in ${expected_baseline_languages}; do
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
echo "Expected SARIF output to contain notification '${rule_name}', but found no such notification."
exit 1
else
echo "Found notification '${rule_name}'."
fi fi
done
for lang in ${expected_baseline_languages}; do
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
echo "Expected SARIF output to contain notification '${rule_name}', but found no such notification."
exit 1
else
echo "Found notification '${rule_name}'."
fi
done
env: env:
CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
extractor-ram-threads: extractor-ram-threads:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
name: Extractor ram and threads options test name: Extractor ram and threads options test
permissions: permissions:
contents: read contents: read
@@ -34,55 +36,55 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: java languages: java
ram: 230 ram: 230
threads: 1 threads: 1
- name: Assert Results - name: Assert Results
shell: bash shell: bash
run: | run: |
if [ "${CODEQL_RAM}" != "230" ]; then if [ "${CODEQL_RAM}" != "230" ]; then
echo "CODEQL_RAM is '${CODEQL_RAM}' instead of 230" echo "CODEQL_RAM is '${CODEQL_RAM}' instead of 230"
exit 1 exit 1
fi fi
if [ "${CODEQL_EXTRACTOR_JAVA_RAM}" != "230" ]; then if [ "${CODEQL_EXTRACTOR_JAVA_RAM}" != "230" ]; then
echo "CODEQL_EXTRACTOR_JAVA_RAM is '${CODEQL_EXTRACTOR_JAVA_RAM}' instead of 230" echo "CODEQL_EXTRACTOR_JAVA_RAM is '${CODEQL_EXTRACTOR_JAVA_RAM}' instead of 230"
exit 1 exit 1
fi fi
if [ "${CODEQL_THREADS}" != "1" ]; then if [ "${CODEQL_THREADS}" != "1" ]; then
echo "CODEQL_THREADS is '${CODEQL_THREADS}' instead of 1" echo "CODEQL_THREADS is '${CODEQL_THREADS}' instead of 1"
exit 1 exit 1
fi fi
if [ "${CODEQL_EXTRACTOR_JAVA_THREADS}" != "1" ]; then if [ "${CODEQL_EXTRACTOR_JAVA_THREADS}" != "1" ]; then
echo "CODEQL_EXTRACTOR_JAVA_THREADS is '${CODEQL_EXTRACTOR_JAVA_THREADS}' instead of 1" echo "CODEQL_EXTRACTOR_JAVA_THREADS is '${CODEQL_EXTRACTOR_JAVA_THREADS}' instead of 1"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,62 +11,64 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-custom-queries: go-custom-queries:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20221211
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20221211
- os: windows-latest - os: windows-latest
version: stable-20221211 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: windows-latest - os: windows-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: windows-latest - os: windows-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: windows-latest - os: windows-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: 'Go: Custom queries' name: 'Go: Custom queries'
permissions: permissions:
contents: read contents: read
@@ -74,43 +76,43 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
config-file: ./.github/codeql/custom-queries.yml config-file: ./.github/codeql/custom-queries.yml
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-indirect-tracing-workaround-diagnostic: go-indirect-tracing-workaround-diagnostic:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
name: 'Go: diagnostic when Go is changed after init step' name: 'Go: diagnostic when Go is changed after init step'
permissions: permissions:
contents: read contents: read
@@ -34,73 +36,73 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
# We need a Go version that ships with statically linked binaries on Linux # We need a Go version that ships with statically linked binaries on Linux
go-version: '>=1.21.0' go-version: '>=1.21.0'
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
# Deliberately change Go after the `init` step # Deliberately change Go after the `init` step
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: '1.20' go-version: '1.20'
- name: Build code - name: Build code
shell: bash shell: bash
run: go build main.go run: go build main.go
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Check diagnostic appears in SARIF - name: Check diagnostic appears in SARIF
uses: actions/github-script@v7 uses: actions/github-script@v7
env: env:
SARIF_PATH: ${{ runner.temp }}/results/go.sarif SARIF_PATH: ${{ runner.temp }}/results/go.sarif
with: with:
script: | script: |
const fs = require('fs'); const fs = require('fs');
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8')); const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0]; const run = sarif.runs[0];
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications; const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const statusPageNotifications = toolExecutionNotifications.filter(n => const statusPageNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'go/workflow/go-installed-after-codeql-init' && n.properties?.visibility?.statusPage n.descriptor.id === 'go/workflow/go-installed-after-codeql-init' && n.properties?.visibility?.statusPage
);
if (statusPageNotifications.length !== 1) {
core.setFailed(
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
); );
} if (statusPageNotifications.length !== 1) {
core.setFailed(
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-indirect-tracing-workaround: go-indirect-tracing-workaround:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
name: 'Go: workaround for indirect tracing' name: 'Go: workaround for indirect tracing'
permissions: permissions:
contents: read contents: read
@@ -34,71 +36,71 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
# We need a Go version that ships with statically linked binaries on Linux # We need a Go version that ships with statically linked binaries on Linux
go-version: '>=1.21.0' go-version: '>=1.21.0'
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash shell: bash
run: go build main.go run: go build main.go
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
- shell: bash - shell: bash
run: | run: |
if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then
echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \ echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \
"CODEQL_ACTION_GO_BINARY environment variable is not set." "CODEQL_ACTION_GO_BINARY environment variable is not set."
exit 1 exit 1
fi fi
if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then
echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist." echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist."
exit 1 exit 1
fi fi
# Once we start running Bash 4.2 in all environments, we can replace the # Once we start running Bash 4.2 in all environments, we can replace the
# `! -z` flag with the more elegant `-v` which confirms that the variable # `! -z` flag with the more elegant `-v` which confirms that the variable
# is actually unset and not potentially set to a blank value. # is actually unset and not potentially set to a blank value.
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then
echo "Expected the Go autobuilder not to be run, but the" \ echo "Expected the Go autobuilder not to be run, but the" \
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set." "CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set."
exit 1 exit 1
fi fi
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d go ]]; then if [[ ! -d go ]]; then
echo "Did not find a Go database" echo "Did not find a Go database"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,48 +11,50 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-tracing-autobuilder: go-tracing-autobuilder:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20221211
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: 'Go: tracing with autobuilder step' name: 'Go: tracing with autobuilder step'
permissions: permissions:
contents: read contents: read
@@ -60,58 +62,58 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: ~1.22.0 go-version: ~1.22.0
# to avoid potentially misleading autobuilder results where we expect it to download # to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache # dependencies successfully, but they actually come from a warm cache
cache: false cache: false
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild - uses: ./../action/autobuild
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
- shell: bash - shell: bash
run: | run: |
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then
echo "Expected the Go autobuilder to be run, but the" \ echo "Expected the Go autobuilder to be run, but the" \
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was not true." "CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was not true."
exit 1 exit 1
fi fi
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d go ]]; then if [[ ! -d go ]]; then
echo "Did not find a Go database" echo "Did not find a Go database"
exit 1 exit 1
fi fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,48 +11,50 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-tracing-custom-build-steps: go-tracing-custom-build-steps:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20221211
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: 'Go: tracing with custom build steps' name: 'Go: tracing with custom build steps'
permissions: permissions:
contents: read contents: read
@@ -60,62 +62,62 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: ~1.22.0 go-version: ~1.22.0
# to avoid potentially misleading autobuilder results where we expect it to download # to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache # dependencies successfully, but they actually come from a warm cache
cache: false cache: false
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash shell: bash
run: go build main.go run: go build main.go
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
- shell: bash - shell: bash
run: | run: |
# Once we start running Bash 4.2 in all environments, we can replace the # Once we start running Bash 4.2 in all environments, we can replace the
# `! -z` flag with the more elegant `-v` which confirms that the variable # `! -z` flag with the more elegant `-v` which confirms that the variable
# is actually unset and not potentially set to a blank value. # is actually unset and not potentially set to a blank value.
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then
echo "Expected the Go autobuilder not to be run, but the" \ echo "Expected the Go autobuilder not to be run, but the" \
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set." "CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set."
exit 1 exit 1
fi fi
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d go ]]; then if [[ ! -d go ]]; then
echo "Did not find a Go database" echo "Did not find a Go database"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,48 +11,50 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
go-tracing-legacy-workflow: go-tracing-legacy-workflow:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20221211
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: 'Go: tracing with legacy workflow' name: 'Go: tracing with legacy workflow'
permissions: permissions:
contents: read contents: read
@@ -60,52 +62,52 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: ~1.22.0 go-version: ~1.22.0
# to avoid potentially misleading autobuilder results where we expect it to download # to avoid potentially misleading autobuilder results where we expect it to download
# dependencies successfully, but they actually come from a warm cache # dependencies successfully, but they actually come from a warm cache
cache: false cache: false
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
- shell: bash - shell: bash
run: | run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d go ]]; then if [[ ! -d go ]]; then
echo "Did not find a Go database" echo "Did not find a Go database"
exit 1 exit 1
fi fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,38 +11,40 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
init-with-registries: init-with-registries:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: 'Packaging: Download using registries' name: 'Packaging: Download using registries'
permissions: permissions:
contents: read contents: read
@@ -51,94 +53,94 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Init with registries - name: Init with registries
uses: ./../action/init uses: ./../action/init
with: with:
db-location: ${{ runner.temp }}/customDbLocation db-location: ${{ runner.temp }}/customDbLocation
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
config-file: ./.github/codeql/codeql-config-registries.yml config-file: ./.github/codeql/codeql-config-registries.yml
languages: javascript languages: javascript
registries: | registries: |
- url: "https://ghcr.io/v2/" - url: "https://ghcr.io/v2/"
packages: "*/*" packages: "*/*"
token: "${{ secrets.GITHUB_TOKEN }}" token: "${{ secrets.GITHUB_TOKEN }}"
- name: Verify packages installed - name: Verify packages installed
shell: bash shell: bash
run: | run: |
PRIVATE_PACK="$HOME/.codeql/packages/codeql-testing/private-pack" PRIVATE_PACK="$HOME/.codeql/packages/codeql-testing/private-pack"
CODEQL_PACK1="$HOME/.codeql/packages/codeql-testing/codeql-pack1" CODEQL_PACK1="$HOME/.codeql/packages/codeql-testing/codeql-pack1"
if [[ -d $PRIVATE_PACK ]] if [[ -d $PRIVATE_PACK ]]
then then
echo "$PRIVATE_PACK was installed." echo "$PRIVATE_PACK was installed."
else else
echo "::error $PRIVATE_PACK pack was not installed." echo "::error $PRIVATE_PACK pack was not installed."
exit 1 exit 1
fi fi
if [[ -d $CODEQL_PACK1 ]] if [[ -d $CODEQL_PACK1 ]]
then then
echo "$CODEQL_PACK1 was installed." echo "$CODEQL_PACK1 was installed."
else else
echo "::error $CODEQL_PACK1 pack was not installed." echo "::error $CODEQL_PACK1 pack was not installed."
exit 1 exit 1
fi fi
- name: Verify qlconfig.yml file was created - name: Verify qlconfig.yml file was created
shell: bash shell: bash
run: | run: |
QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml
echo "Expected qlconfig.yml file to be created at $QLCONFIG_PATH" echo "Expected qlconfig.yml file to be created at $QLCONFIG_PATH"
if [[ -f $QLCONFIG_PATH ]] if [[ -f $QLCONFIG_PATH ]]
then then
echo "qlconfig.yml file was created." echo "qlconfig.yml file was created."
else else
echo "::error qlconfig.yml file was not created." echo "::error qlconfig.yml file was not created."
exit 1 exit 1
fi fi
- name: Verify contents of qlconfig.yml - name: Verify contents of qlconfig.yml
# yq is not available on windows # yq is not available on windows
if: runner.os != 'Windows' if: runner.os != 'Windows'
shell: bash shell: bash
run: | run: |
QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml QLCONFIG_PATH=$RUNNER_TEMP/qlconfig.yml
cat $QLCONFIG_PATH | yq -e '.registries[] | select(.url == "https://ghcr.io/v2/") | select(.packages == "*/*")' cat $QLCONFIG_PATH | yq -e '.registries[] | select(.url == "https://ghcr.io/v2/") | select(.packages == "*/*")'
if [[ $? -eq 0 ]] if [[ $? -eq 0 ]]
then then
echo "Registry was added to qlconfig.yml file." echo "Registry was added to qlconfig.yml file."
else else
echo "::error Registry was not added to qlconfig.yml file." echo "::error Registry was not added to qlconfig.yml file."
echo "Contents of qlconfig.yml file:" echo "Contents of qlconfig.yml file:"
cat $QLCONFIG_PATH cat $QLCONFIG_PATH
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
javascript-source-root: javascript-source-root:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Custom source root name: Custom source root
permissions: permissions:
contents: read contents: read
@@ -38,54 +40,54 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Move codeql-action - name: Move codeql-action
shell: bash shell: bash
run: | run: |
mkdir ../new-source-root mkdir ../new-source-root
mv * ../new-source-root mv * ../new-source-root
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: javascript languages: javascript
source-root: ../new-source-root source-root: ../new-source-root
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
skip-queries: true skip-queries: true
upload: never upload: never
- name: Assert database exists - name: Assert database exists
shell: bash shell: bash
run: | run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d javascript ]]; then if [[ ! -d javascript ]]; then
echo "Did not find a JavaScript database" echo "Did not find a JavaScript database"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
language-aliases: language-aliases:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
name: Language aliases name: Language aliases
permissions: permissions:
contents: read contents: read
@@ -34,46 +36,46 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: C#,java-kotlin,swift,typescript languages: C#,java-kotlin,swift,typescript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check languages - name: Check languages
run: | run: |
expected_languages="csharp,java,swift,javascript" expected_languages="csharp,java,swift,javascript"
actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config) actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config)
if [ "$expected_languages" != "$actual_languages" ]; then if [ "$expected_languages" != "$actual_languages" ]; then
echo "Resolved languages did not match expected list. " \ echo "Resolved languages did not match expected list. " \
"Expected languages: $expected_languages. Actual languages: $actual_languages." "Expected languages: $expected_languages. Actual languages: $actual_languages."
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,48 +11,50 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
multi-language-autodetect: multi-language-autodetect:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20221211
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: Multi-language repository name: Multi-language repository
permissions: permissions:
contents: read contents: read
@@ -60,100 +62,100 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
db-location: ${{ runner.temp }}/customDbLocation db-location: ${{ runner.temp }}/customDbLocation
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
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
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
with: with:
upload-database: false upload-database: false
- name: Check language autodetect for all languages excluding Swift - name: Check language autodetect for all languages excluding Swift
shell: bash shell: bash
run: | run: |
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for CPP, or created it in the wrong location." echo "Did not create a database for CPP, or created it in the wrong location."
exit 1 exit 1
fi fi
CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }} CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }}
if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for C Sharp, or created it in the wrong location." echo "Did not create a database for C Sharp, or created it in the wrong location."
exit 1 exit 1
fi fi
GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }} GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }}
if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Go, or created it in the wrong location." echo "Did not create a database for Go, or created it in the wrong location."
exit 1 exit 1
fi fi
JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }} JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }}
if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Java, or created it in the wrong location." echo "Did not create a database for Java, or created it in the wrong location."
exit 1 exit 1
fi fi
JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }} JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }}
if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Javascript, or created it in the wrong location." echo "Did not create a database for Javascript, or created it in the wrong location."
exit 1 exit 1
fi fi
PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }} PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }}
if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Python, or created it in the wrong location." echo "Did not create a database for Python, or created it in the wrong location."
exit 1 exit 1
fi fi
RUBY_DB=${{ fromJson(steps.analysis.outputs.db-locations).ruby }} RUBY_DB=${{ fromJson(steps.analysis.outputs.db-locations).ruby }}
if [[ ! -d $RUBY_DB ]] || [[ ! $RUBY_DB == ${{ runner.temp }}/customDbLocation/* ]]; then if [[ ! -d $RUBY_DB ]] || [[ ! $RUBY_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Ruby, or created it in the wrong location." echo "Did not create a database for Ruby, or created it in the wrong location."
exit 1 exit 1
fi fi
- name: Check language autodetect for Swift - name: Check language autodetect for Swift
if: >- if: >-
env.CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT == 'true' || env.CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT == 'true' ||
(runner.os != 'Windows' && matrix.version == 'nightly-latest') (runner.os != 'Windows' && matrix.version == 'nightly-latest')
shell: bash shell: bash
run: | run: |
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }} SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}
if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
echo "Did not create a database for Swift, or created it in the wrong location." echo "Did not create a database for Swift, or created it in the wrong location."
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,38 +11,40 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
packaging-codescanning-config-inputs-js: packaging-codescanning-config-inputs-js:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: 'Packaging: Config and input passed to the CLI' name: 'Packaging: Config and input passed to the CLI'
permissions: permissions:
contents: read contents: read
@@ -50,67 +52,67 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: .github/codeql/codeql-config-packaging3.yml config-file: .github/codeql/codeql-config-packaging3.yml
packs: +codeql-testing/codeql-pack1@1.0.0 packs: +codeql-testing/codeql-pack1@1.0.0
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Check results - name: Check results
uses: ./../action/.github/actions/check-sarif uses: ./../action/.github/actions/check-sarif
with: with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run: queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar queries-not-run: foo,bar
- name: Assert Results - name: Assert Results
shell: bash shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules # We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block" EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace # use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)" RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'" echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'." echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,38 +11,40 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
packaging-config-inputs-js: packaging-config-inputs-js:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: 'Packaging: Config and input' name: 'Packaging: Config and input'
permissions: permissions:
contents: read contents: read
@@ -50,67 +52,67 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: .github/codeql/codeql-config-packaging3.yml config-file: .github/codeql/codeql-config-packaging3.yml
packs: +codeql-testing/codeql-pack1@1.0.0 packs: +codeql-testing/codeql-pack1@1.0.0
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Check results - name: Check results
uses: ./../action/.github/actions/check-sarif uses: ./../action/.github/actions/check-sarif
with: with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run: queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar queries-not-run: foo,bar
- name: Assert Results - name: Assert Results
shell: bash shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules # We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block" EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace # use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)" RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'" echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'." echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,38 +11,40 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
packaging-config-js: packaging-config-js:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: 'Packaging: Config file' name: 'Packaging: Config file'
permissions: permissions:
contents: read contents: read
@@ -50,66 +52,66 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: .github/codeql/codeql-config-packaging.yml config-file: .github/codeql/codeql-config-packaging.yml
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Check results - name: Check results
uses: ./../action/.github/actions/check-sarif uses: ./../action/.github/actions/check-sarif
with: with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run: queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar queries-not-run: foo,bar
- name: Assert Results - name: Assert Results
shell: bash shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules # We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block" EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace # use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)" RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'" echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'." echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,38 +11,40 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
packaging-inputs-js: packaging-inputs-js:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: 'Packaging: Action input' name: 'Packaging: Action input'
permissions: permissions:
contents: read contents: read
@@ -50,66 +52,66 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: .github/codeql/codeql-config-packaging2.yml config-file: .github/codeql/codeql-config-packaging2.yml
languages: javascript languages: javascript
packs: codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2, codeql-testing/codeql-pack3:other-query.ql packs: codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2, codeql-testing/codeql-pack3:other-query.ql
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
- name: Check results - name: Check results
uses: ./../action/.github/actions/check-sarif uses: ./../action/.github/actions/check-sarif
with: with:
sarif-file: ${{ runner.temp }}/results/javascript.sarif sarif-file: ${{ runner.temp }}/results/javascript.sarif
queries-run: queries-run:
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
queries-not-run: foo,bar queries-not-run: foo,bar
- name: Assert Results - name: Assert Results
shell: bash shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules # We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block" EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace # use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)" RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'" echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'." echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

162
.github/workflows/__remote-config.yml generated vendored
View File

@@ -11,62 +11,64 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
remote-config: remote-config:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20221211
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20221211
- os: windows-latest - os: windows-latest
version: stable-20221211 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: windows-latest - os: windows-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: windows-latest - os: windows-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: windows-latest - os: windows-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: Remote config file name: Remote config file
permissions: permissions:
contents: read contents: read
@@ -74,41 +76,41 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
languages: cpp,csharp,java,javascript,python languages: cpp,csharp,java,javascript,python
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
github.sha }} github.sha }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,44 +11,46 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
resolve-environment-action: resolve-environment-action:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.4 version: stable-v2.13.4
- os: macos-latest - os: macos-latest
version: stable-v2.13.4 version: stable-v2.13.4
- os: windows-latest - os: windows-latest
version: stable-v2.13.4 version: stable-v2.13.4
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
- os: windows-latest - os: windows-latest
version: nightly-latest version: nightly-latest
name: Resolve environment name: Resolve environment
permissions: permissions:
contents: read contents: read
@@ -56,58 +58,58 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: ${{ matrix.version == 'stable-v2.13.4' && 'go' || 'go,javascript-typescript' languages: ${{ matrix.version == 'stable-v2.13.4' && 'go' || 'go,javascript-typescript'
}} }}
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Resolve environment for Go - name: Resolve environment for Go
uses: ./../action/resolve-environment uses: ./../action/resolve-environment
id: resolve-environment-go id: resolve-environment-go
with: with:
language: go language: go
- name: Fail if Go configuration missing - name: Fail if Go configuration missing
if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go) if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go)
run: exit 1 run: exit 1
- name: Resolve environment for JavaScript/TypeScript - name: Resolve environment for JavaScript/TypeScript
if: matrix.version != 'stable-v2.13.4' if: matrix.version != 'stable-v2.13.4'
uses: ./../action/resolve-environment uses: ./../action/resolve-environment
id: resolve-environment-js id: resolve-environment-js
with: with:
language: javascript-typescript language: javascript-typescript
- name: Fail if JavaScript/TypeScript configuration present - name: Fail if JavaScript/TypeScript configuration present
if: matrix.version != 'stable-v2.13.4' && if: matrix.version != 'stable-v2.13.4' &&
fromJSON(steps.resolve-environment-js.outputs.environment).configuration.javascript fromJSON(steps.resolve-environment-js.outputs.environment).configuration.javascript
run: exit 1 run: exit 1
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
rubocop-multi-language: rubocop-multi-language:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
name: RuboCop multi-language name: RuboCop multi-language
permissions: permissions:
contents: read contents: read
@@ -34,51 +36,51 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Set up Ruby - name: Set up Ruby
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: 2.6 ruby-version: 2.6
- name: Install Code Scanning integration - name: Install Code Scanning integration
shell: bash shell: bash
run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install
- name: Install dependencies - name: Install dependencies
shell: bash shell: bash
run: bundle install run: bundle install
- name: RuboCop run - name: RuboCop run
shell: bash shell: bash
run: | run: |
bash -c " bash -c "
bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
[[ $? -ne 2 ]] [[ $? -ne 2 ]]
" "
- uses: ./../action/upload-sarif - uses: ./../action/upload-sarif
with: with:
sarif_file: rubocop.sarif sarif_file: rubocop.sarif
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

114
.github/workflows/__ruby.yml generated vendored
View File

@@ -11,32 +11,34 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
ruby: ruby:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: Ruby analysis name: Ruby analysis
permissions: permissions:
contents: read contents: read
@@ -44,47 +46,47 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: ruby languages: ruby
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
with: with:
upload-database: false upload-database: false
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}" RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}"
if [[ ! -d "$RUBY_DB" ]]; then if [[ ! -d "$RUBY_DB" ]]; then
echo "Did not create a database for Ruby." echo "Did not create a database for Ruby."
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,48 +11,50 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
scaling-reserved-ram: scaling-reserved-ram:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20221211
- os: macos-latest - os: macos-latest
version: stable-20221211 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: macos-latest - os: macos-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: macos-latest - os: macos-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: Scaling reserved RAM name: Scaling reserved RAM
permissions: permissions:
contents: read contents: read
@@ -60,50 +62,50 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
db-location: ${{ runner.temp }}/customDbLocation db-location: ${{ runner.temp }}/customDbLocation
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
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
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
with: with:
upload-database: false upload-database: false
env: env:
CODEQL_ACTION_SCALING_RESERVED_RAM: true CODEQL_ACTION_SCALING_RESERVED_RAM: true
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,32 +11,34 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
split-workflow: split-workflow:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: Split workflow name: Split workflow
permissions: permissions:
contents: read contents: read
@@ -44,71 +46,71 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
config-file: .github/codeql/codeql-config-packaging3.yml config-file: .github/codeql/codeql-config-packaging3.yml
packs: +codeql-testing/codeql-pack1@1.0.0 packs: +codeql-testing/codeql-pack1@1.0.0
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
skip-queries: true skip-queries: true
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Assert No Results - name: Assert No Results
shell: bash shell: bash
run: | run: |
if [ "$(ls -A $RUNNER_TEMP/results)" ]; then if [ "$(ls -A $RUNNER_TEMP/results)" ]; then
echo "Expected results directory to be empty after skipping query execution!" echo "Expected results directory to be empty after skipping query execution!"
exit 1 exit 1
fi fi
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
- name: Assert Results - name: Assert Results
shell: bash shell: bash
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/results"
# We should have 4 hits from these rules # We should have 4 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block" EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/other-query-block javascript/example/two-block"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace # use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)" RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n\r" " " | xargs)"
echo "Found matching rules '$RULES'" echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'." echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
submit-sarif-failure: submit-sarif-failure:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Submit SARIF after failure name: Submit SARIF after failure
permissions: permissions:
contents: read contents: read
@@ -38,49 +40,49 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./init - uses: ./init
with: with:
languages: javascript languages: javascript
- name: Fail - name: Fail
# We want this job to pass if the Action correctly uploads the SARIF file for # We want this job to pass if the Action correctly uploads the SARIF file for
# the failed run. # the failed run.
# Setting this step to continue on error means that it is marked as completing # Setting this step to continue on error means that it is marked as completing
# successfully, so will not fail the job. # successfully, so will not fail the job.
continue-on-error: true continue-on-error: true
run: exit 1 run: exit 1
- uses: ./analyze - uses: ./analyze
# In a real workflow, this step wouldn't run. Since we used `continue-on-error` # In a real workflow, this step wouldn't run. Since we used `continue-on-error`
# above, we manually disable it with an `if` condition. # above, we manually disable it with an `if` condition.
if: false if: false
with: with:
category: /test-codeql-version:${{ matrix.version }} category: /test-codeql-version:${{ matrix.version }}
env: env:
# Internal-only environment variable used to indicate that the post-init Action # Internal-only environment variable used to indicate that the post-init Action
# should expect to upload a SARIF file for the failed run. # should expect to upload a SARIF file for the failed run.

View File

@@ -11,32 +11,34 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
swift-custom-build: swift-custom-build:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
- os: macos-latest - os: macos-latest
version: nightly-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
@@ -44,58 +46,58 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
languages: swift languages: swift
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
with: with:
codeql-path: ${{steps.init.outputs.codeql-path}} codeql-path: ${{steps.init.outputs.codeql-path}}
- name: Check working directory - name: Check working directory
shell: bash shell: bash
run: pwd run: pwd
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
with: with:
upload-database: false upload-database: false
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}" SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}"
if [[ ! -d "$SWIFT_DB" ]]; then if [[ ! -d "$SWIFT_DB" ]]; then
echo "Did not create a database for Swift." echo "Did not create a database for Swift."
exit 1 exit 1
fi fi
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
test-autobuild-working-dir: test-autobuild-working-dir:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
name: Autobuild working directory name: Autobuild working directory
permissions: permissions:
contents: read contents: read
@@ -34,56 +36,56 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Test setup - name: Test setup
shell: bash shell: bash
run: | run: |
# Make sure that Gradle build succeeds in autobuild-dir ... # Make sure that Gradle build succeeds in autobuild-dir ...
cp -a ../action/tests/java-repo autobuild-dir cp -a ../action/tests/java-repo autobuild-dir
# ... and fails if attempted in the current directory # ... and fails if attempted in the current directory
echo > build.gradle echo > build.gradle
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: java languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/autobuild - uses: ./../action/autobuild
with: with:
working-directory: autobuild-dir working-directory: autobuild-dir
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
if [[ ! -d java ]]; then if [[ ! -d java ]]; then
echo "Did not find a Java database" echo "Did not find a Java database"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
test-local-codeql: test-local-codeql:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Local CodeQL bundle name: Local CodeQL bundle
permissions: permissions:
contents: read contents: read
@@ -34,50 +36,50 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Fetch a CodeQL bundle - name: Fetch a CodeQL bundle
shell: bash shell: bash
env: env:
CODEQL_URL: ${{ steps.prepare-test.outputs.tools-url }} CODEQL_URL: ${{ steps.prepare-test.outputs.tools-url }}
run: | run: |
wget "$CODEQL_URL" wget "$CODEQL_URL"
- id: init - id: init
uses: ./../action/init uses: ./../action/init
with: with:
tools: ./codeql-bundle-linux64.tar.gz tools: ./codeql-bundle-linux64.tar.gz
- 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
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

78
.github/workflows/__test-proxy.yml generated vendored
View File

@@ -11,22 +11,24 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
test-proxy: test-proxy:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
name: Proxy test name: Proxy test
permissions: permissions:
contents: read contents: read
@@ -34,39 +36,39 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
env: env:
https_proxy: http://squid-proxy:3128 https_proxy: http://squid-proxy:3128
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true
@@ -77,4 +79,4 @@ jobs:
squid-proxy: squid-proxy:
image: ubuntu/squid:latest image: ubuntu/squid:latest
ports: ports:
- 3128:3128 - 3128:3128

View File

@@ -11,34 +11,36 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
unset-environment: unset-environment:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.13.5 version: stable-v2.13.5
- os: ubuntu-latest - os: ubuntu-latest
version: stable-v2.14.6 version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: ubuntu-latest - os: ubuntu-latest
version: nightly-latest version: nightly-latest
name: Test unsetting environment variables name: Test unsetting environment variables
permissions: permissions:
contents: read contents: read
@@ -46,87 +48,87 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
id: init id: init
with: with:
db-location: ${{ runner.temp }}/customDbLocation db-location: ${{ runner.temp }}/customDbLocation
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
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
# Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a # Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a
# workaround for our PR checks. # workaround for our PR checks.
run: env -i CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN=true PATH="$PATH" HOME="$HOME" run: env -i CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN=true PATH="$PATH" HOME="$HOME"
./build.sh ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
with: with:
upload-database: false upload-database: false
- shell: bash - shell: bash
run: | run: |
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then
echo "::error::Did not create a database for CPP, or created it in the wrong location." \ echo "::error::Did not create a database for CPP, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'"
exit 1 exit 1
fi fi
CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}"
if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then
echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \ echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/csharp' but actual was '${CSHARP_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/csharp' but actual was '${CSHARP_DB}'"
exit 1 exit 1
fi fi
GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}"
if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then
echo "::error::Did not create a database for Go, or created it in the wrong location." \ echo "::error::Did not create a database for Go, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/go' but actual was '${GO_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/go' but actual was '${GO_DB}'"
exit 1 exit 1
fi fi
JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}" JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}"
if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/java" ]]; then if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/java" ]]; then
echo "::error::Did not create a database for Java, or created it in the wrong location." \ echo "::error::Did not create a database for Java, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/java' but actual was '${JAVA_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/java' but actual was '${JAVA_DB}'"
exit 1 exit 1
fi fi
JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}"
if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/javascript" ]]; then if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/javascript" ]]; then
echo "::error::Did not create a database for Javascript, or created it in the wrong location." \ echo "::error::Did not create a database for Javascript, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'"
exit 1 exit 1
fi fi
PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}"
if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/python" ]]; then if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/python" ]]; then
echo "::error::Did not create a database for Python, or created it in the wrong location." \ echo "::error::Did not create a database for Python, or created it in the wrong location." \
"Expected location was '${RUNNER_TEMP}/customDbLocation/python' but actual was '${PYTHON_DB}'" "Expected location was '${RUNNER_TEMP}/customDbLocation/python' but actual was '${PYTHON_DB}'"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
upload-ref-sha-input: upload-ref-sha-input:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest
version: default version: default
- os: windows-latest - os: windows-latest
version: default version: default
name: "Upload-sarif: 'ref' and 'sha' from inputs" name: "Upload-sarif: 'ref' and 'sha' from inputs"
permissions: permissions:
contents: read contents: read
@@ -38,50 +40,50 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
languages: cpp,csharp,java,javascript,python languages: cpp,csharp,java,javascript,python
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
github.sha }} github.sha }}
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
upload-database: false upload-database: false
ref: refs/heads/main ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2 sha: 5e235361806c361d4d3f8859e3c897658025a9a2
upload: never upload: never
- uses: ./../action/upload-sarif - uses: ./../action/upload-sarif
with: with:
ref: refs/heads/main ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2 sha: 5e235361806c361d4d3f8859e3c897658025a9a2
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -11,26 +11,28 @@ env:
on: on:
push: push:
branches: branches:
- main - main
- releases/v* - releases/v*
pull_request: pull_request:
types: types:
- opened - opened
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
with-checkout-path: with-checkout-path:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
version: latest version: latest
- os: macos-latest - os: macos-latest
version: latest version: latest
- os: windows-latest - os: windows-latest
version: latest version: latest
name: Use a custom `checkout_path` name: Use a custom `checkout_path`
permissions: permissions:
contents: read contents: read
@@ -38,100 +40,100 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Setup Python on MacOS - name: Setup Python on MacOS
uses: actions/setup-python@v5 uses: actions/setup-python@v5
if: >- if: >-
matrix.os == 'macos-latest' && ( matrix.os == 'macos-latest' && (
matrix.version == 'stable-20221211' || matrix.version == 'stable-20221211' ||
matrix.version == 'stable-20230418' || matrix.version == 'stable-20230418' ||
matrix.version == 'stable-v2.13.5' || matrix.version == 'stable-v2.13.5' ||
matrix.version == 'stable-v2.14.6') matrix.version == 'stable-v2.14.6')
with: with:
python-version: '3.11' python-version: '3.11'
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Prepare test - name: Prepare test
id: prepare-test id: prepare-test
uses: ./.github/actions/prepare-test uses: ./.github/actions/prepare-test
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
use-all-platform-bundle: 'false' use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement - name: Set environment variable for Swift enablement
if: runner.os != 'Windows' && matrix.version == '20221211' if: runner.os != 'Windows' && matrix.version == '20221211'
shell: bash shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- name: Delete original checkout - name: Delete original checkout
shell: bash shell: bash
run: | run: |
# delete the original checkout so we don't accidentally use it. # delete the original checkout so we don't accidentally use it.
# Actions does not support deleting the current working directory, so we # Actions does not support deleting the current working directory, so we
# delete the contents of the directory instead. # delete the contents of the directory instead.
rm -rf ./* .github .git rm -rf ./* .github .git
# Check out the actions repo again, but at a different location. # Check out the actions repo again, but at a different location.
# choose an arbitrary SHA so that we can later test that the commit_oid is not from main # choose an arbitrary SHA so that we can later test that the commit_oid is not from main
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
path: x/y/z/some-path path: x/y/z/some-path
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
# it's enough to test one compiled language and one interpreted language # it's enough to test one compiled language and one interpreted language
languages: csharp,javascript languages: csharp,javascript
source-root: x/y/z/some-path/tests/multi-language-repo source-root: x/y/z/some-path/tests/multi-language-repo
- name: Build code - name: Build code
shell: bash shell: bash
working-directory: x/y/z/some-path/tests/multi-language-repo working-directory: x/y/z/some-path/tests/multi-language-repo
run: | run: |
./build.sh ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
checkout_path: x/y/z/some-path/tests/multi-language-repo checkout_path: x/y/z/some-path/tests/multi-language-repo
ref: v1.1.0 ref: v1.1.0
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
upload: never upload: never
upload-database: false upload-database: false
- uses: ./../action/upload-sarif - uses: ./../action/upload-sarif
with: with:
ref: v1.1.0 ref: v1.1.0
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
checkout_path: x/y/z/some-path/tests/multi-language-repo checkout_path: x/y/z/some-path/tests/multi-language-repo
- name: Verify SARIF after upload - name: Verify SARIF after upload
shell: bash shell: bash
run: | run: |
EXPECTED_COMMIT_OID="474bbf07f9247ffe1856c6a0f94aeeb10e7afee6" EXPECTED_COMMIT_OID="474bbf07f9247ffe1856c6a0f94aeeb10e7afee6"
EXPECTED_REF="v1.1.0" EXPECTED_REF="v1.1.0"
EXPECTED_CHECKOUT_URI_SUFFIX="/x/y/z/some-path/tests/multi-language-repo" EXPECTED_CHECKOUT_URI_SUFFIX="/x/y/z/some-path/tests/multi-language-repo"
ACTUAL_COMMIT_OID="$(cat "$RUNNER_TEMP/payload.json" | jq -r .commit_oid)" ACTUAL_COMMIT_OID="$(cat "$RUNNER_TEMP/payload.json" | jq -r .commit_oid)"
ACTUAL_REF="$(cat "$RUNNER_TEMP/payload.json" | jq -r .ref)" ACTUAL_REF="$(cat "$RUNNER_TEMP/payload.json" | jq -r .ref)"
ACTUAL_CHECKOUT_URI="$(cat "$RUNNER_TEMP/payload.json" | jq -r .checkout_uri)" ACTUAL_CHECKOUT_URI="$(cat "$RUNNER_TEMP/payload.json" | jq -r .checkout_uri)"
if [[ "$EXPECTED_COMMIT_OID" != "$ACTUAL_COMMIT_OID" ]]; then if [[ "$EXPECTED_COMMIT_OID" != "$ACTUAL_COMMIT_OID" ]]; then
echo "::error Invalid commit oid. Expected: $EXPECTED_COMMIT_OID Actual: $ACTUAL_COMMIT_OID" echo "::error Invalid commit oid. Expected: $EXPECTED_COMMIT_OID Actual: $ACTUAL_COMMIT_OID"
echo "$RUNNER_TEMP/payload.json" echo "$RUNNER_TEMP/payload.json"
exit 1 exit 1
fi fi
if [[ "$EXPECTED_REF" != "$ACTUAL_REF" ]]; then if [[ "$EXPECTED_REF" != "$ACTUAL_REF" ]]; then
echo "::error Invalid ref. Expected: '$EXPECTED_REF' Actual: '$ACTUAL_REF'" echo "::error Invalid ref. Expected: '$EXPECTED_REF' Actual: '$ACTUAL_REF'"
echo "$RUNNER_TEMP/payload.json" echo "$RUNNER_TEMP/payload.json"
exit 1 exit 1
fi fi
if [[ "$ACTUAL_CHECKOUT_URI" != *$EXPECTED_CHECKOUT_URI_SUFFIX ]]; then if [[ "$ACTUAL_CHECKOUT_URI" != *$EXPECTED_CHECKOUT_URI_SUFFIX ]]; then
echo "::error Invalid checkout URI suffix. Expected suffix: $EXPECTED_CHECKOUT_URI_SUFFIX Actual uri: $ACTUAL_CHECKOUT_URI" echo "::error Invalid checkout URI suffix. Expected suffix: $EXPECTED_CHECKOUT_URI_SUFFIX Actual uri: $ACTUAL_CHECKOUT_URI"
echo "$RUNNER_TEMP/payload.json" echo "$RUNNER_TEMP/payload.json"
exit 1 exit 1
fi fi
env: env:
CODEQL_ACTION_TEST_MODE: true CODEQL_ACTION_TEST_MODE: true

View File

@@ -15,6 +15,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:

View File

@@ -17,6 +17,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
upload-artifacts: upload-artifacts:

View File

@@ -16,6 +16,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
upload-artifacts: upload-artifacts:

View File

@@ -11,6 +11,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:

View File

@@ -11,6 +11,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:

View File

@@ -16,6 +16,8 @@ on:
- synchronize - synchronize
- reopened - reopened
- ready_for_review - ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {} workflow_dispatch: {}
jobs: jobs:
test-codeql-bundle-all: test-codeql-bundle-all:

View File

@@ -4,9 +4,12 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
Note that the only difference between `v2` and `v3` of the CodeQL Action is the node version they support, with `v3` running on node 20 while we continue to release `v2` to support running on node 16. For example `3.22.11` was the first `v3` release and is functionally identical to `2.22.11`. This approach ensures an easy way to track exactly which features are included in different versions, indicated by the minor and patch version numbers. Note that the only difference between `v2` and `v3` of the CodeQL Action is the node version they support, with `v3` running on node 20 while we continue to release `v2` to support running on node 16. For example `3.22.11` was the first `v3` release and is functionally identical to `2.22.11`. This approach ensures an easy way to track exactly which features are included in different versions, indicated by the minor and patch version numbers.
## [UNRELEASED] ## 3.24.10 - 05 Apr 2024
No user facing changes. - Update default CodeQL bundle version to 2.17.0. [#2219](https://github.com/github/codeql-action/pull/2219)
- Add a deprecation warning for customers using CodeQL version 2.12.5 and earlier. These versions of CodeQL were discontinued on 26 March 2024 alongside GitHub Enterprise Server 3.8, and will be unsupported by CodeQL Action versions 3.25.0 and later and versions 2.25.0 and later. [#2220](https://github.com/github/codeql-action/pull/2220)
- If you are using one of these versions, please update to CodeQL CLI version 2.12.6 or later. For instance, if you have specified a custom version of the CLI using the 'tools' input to the 'init' Action, you can remove this input to use the default version.
- Alternatively, if you want to continue using a version of the CodeQL CLI between 2.11.6 and 2.12.5, you can replace `github/codeql-action/*@v3` by `github/codeql-action/*@v3.24.10` and `github/codeql-action/*@v2` by `github/codeql-action/*@v2.24.10` in your code scanning workflow to ensure you continue using this version of the CodeQL Action.
## 3.24.9 - 22 Mar 2024 ## 3.24.9 - 22 Mar 2024

View File

@@ -227,7 +227,9 @@ const util_1 = require("./util");
const infoStub = sinon.stub(core, "info"); const infoStub = sinon.stub(core, "info");
process.env["GITHUB_EVENT_NAME"] = "pull_request"; process.env["GITHUB_EVENT_NAME"] = "pull_request";
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a"; process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
await actionsUtil.determineMergeBaseCommitOid(path.join(__dirname, "../..")); await (0, util_1.withTmpDir)(async (tmpDir) => {
await actionsUtil.determineMergeBaseCommitOid(tmpDir);
});
t.deepEqual(1, infoStub.callCount); t.deepEqual(1, infoStub.callCount);
t.assert(infoStub.firstCall.args[0].startsWith("The checkout path provided to the action does not appear to be a git repository.")); t.assert(infoStub.firstCall.args[0].startsWith("The checkout path provided to the action does not appear to be a git repository."));
infoStub.restore(); infoStub.restore();

File diff suppressed because one or more lines are too long

View File

@@ -31,10 +31,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
const analyzeActionPostHelper = __importStar(require("./analyze-action-post-helper")); const analyzeActionPostHelper = __importStar(require("./analyze-action-post-helper"));
const debugArtifacts = __importStar(require("./debug-artifacts")); const debugArtifacts = __importStar(require("./debug-artifacts"));
const uploadSarifActionPostHelper = __importStar(require("./upload-sarif-action-post-helper"));
const util_1 = require("./util"); const util_1 = require("./util");
async function runWrapper() { async function runWrapper() {
try { try {
await analyzeActionPostHelper.run(debugArtifacts.uploadSarifDebugArtifact); await analyzeActionPostHelper.run(debugArtifacts.uploadSarifDebugArtifact);
// Also run the upload-sarif post action since we're potentially running
// the same steps in the analyze action.
await uploadSarifActionPostHelper.uploadArtifacts(debugArtifacts.uploadDebugArtifacts);
} }
catch (error) { catch (error) {
core.setFailed(`analyze post-action step failed: ${(0, util_1.wrapError)(error).message}`); core.setFailed(`analyze post-action step failed: ${(0, util_1.wrapError)(error).message}`);

View File

@@ -1 +1 @@
{"version":3,"file":"analyze-action-post.js","sourceRoot":"","sources":["../src/analyze-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,sFAAwE;AACxE,kEAAoD;AACpD,iCAAmC;AAEnC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,uBAAuB,CAAC,GAAG,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC;IAC7E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,oCAAoC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"} {"version":3,"file":"analyze-action-post.js","sourceRoot":"","sources":["../src/analyze-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,sFAAwE;AACxE,kEAAoD;AACpD,+FAAiF;AACjF,iCAAmC;AAEnC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,uBAAuB,CAAC,GAAG,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC;QAE3E,wEAAwE;QACxE,wCAAwC;QACxC,MAAM,2BAA2B,CAAC,eAAe,CAC/C,cAAc,CAAC,oBAAoB,CACpC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,oCAAoC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

35
lib/analyze-action.js generated
View File

@@ -51,21 +51,23 @@ const util = __importStar(require("./util"));
async function sendStatusReport(startedAt, config, stats, error, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, logger) { async function sendStatusReport(startedAt, config, stats, error, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, logger) {
const status = (0, status_report_1.getActionsStatus)(error, stats?.analyze_failure_language); const status = (0, status_report_1.getActionsStatus)(error, stats?.analyze_failure_language);
const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Analyze, status, startedAt, config, await util.checkDiskUsage(), logger, error?.message, error?.stack); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Analyze, status, startedAt, config, await util.checkDiskUsage(), logger, error?.message, error?.stack);
const report = { if (statusReportBase !== undefined) {
...statusReportBase, const report = {
...(stats || {}), ...statusReportBase,
...(dbCreationTimings || {}), ...(stats || {}),
}; ...(dbCreationTimings || {}),
if (config && didUploadTrapCaches) {
const trapCacheUploadStatusReport = {
...report,
trap_cache_upload_duration_ms: Math.round(trapCacheUploadTime || 0),
trap_cache_upload_size_bytes: Math.round(await (0, trap_caching_1.getTotalCacheSize)(config.trapCaches, logger)),
}; };
await statusReport.sendStatusReport(trapCacheUploadStatusReport); if (config && didUploadTrapCaches) {
} const trapCacheUploadStatusReport = {
else { ...report,
await statusReport.sendStatusReport(report); trap_cache_upload_duration_ms: Math.round(trapCacheUploadTime || 0),
trap_cache_upload_size_bytes: Math.round(await (0, trap_caching_1.getTotalCacheSize)(config.trapCaches, logger)),
};
await statusReport.sendStatusReport(trapCacheUploadStatusReport);
}
else {
await statusReport.sendStatusReport(report);
}
} }
} }
// `expect-error` should only be set to a non-false value by the CodeQL Action PR checks. // `expect-error` should only be set to a non-false value by the CodeQL Action PR checks.
@@ -145,7 +147,10 @@ async function run() {
util.initializeEnvironment(actionsUtil.getActionVersion()); util.initializeEnvironment(actionsUtil.getActionVersion());
const logger = (0, logging_1.getActionsLogger)(); const logger = (0, logging_1.getActionsLogger)();
try { try {
await statusReport.sendStatusReport(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Analyze, "starting", startedAt, config, await util.checkDiskUsage(logger), logger)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Analyze, "starting", startedAt, config, await util.checkDiskUsage(logger), logger);
if (statusReportBase !== undefined) {
await statusReport.sendStatusReport(statusReportBase);
}
config = await (0, config_utils_1.getConfig)(actionsUtil.getTemporaryDirectory(), logger); config = await (0, config_utils_1.getConfig)(actionsUtil.getTemporaryDirectory(), logger);
if (config === undefined) { if (config === undefined) {
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?"); throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{ "maximumVersion": "3.13", "minimumVersion": "3.8" } { "maximumVersion": "3.13", "minimumVersion": "3.9" }

View File

@@ -37,12 +37,14 @@ async function sendCompletedStatusReport(config, logger, startedAt, allLanguages
(0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)()); (0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)());
const status = (0, status_report_1.getActionsStatus)(cause, failingLanguage); const status = (0, status_report_1.getActionsStatus)(cause, failingLanguage);
const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Autobuild, status, startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger, cause?.message, cause?.stack); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Autobuild, status, startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger, cause?.message, cause?.stack);
const statusReport = { if (statusReportBase !== undefined) {
...statusReportBase, const statusReport = {
autobuild_languages: allLanguages.join(","), ...statusReportBase,
autobuild_failure: failingLanguage, autobuild_languages: allLanguages.join(","),
}; autobuild_failure: failingLanguage,
await (0, status_report_1.sendStatusReport)(statusReport); };
await (0, status_report_1.sendStatusReport)(statusReport);
}
} }
async function run() { async function run() {
const startedAt = new Date(); const startedAt = new Date();
@@ -51,7 +53,10 @@ async function run() {
let currentLanguage; let currentLanguage;
let languages; let languages;
try { try {
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Autobuild, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Autobuild, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
const gitHubVersion = await (0, api_client_1.getGitHubVersion)(); const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger); (0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
(0, util_1.checkActionVersion)((0, actions_util_1.getActionVersion)(), gitHubVersion); (0, util_1.checkActionVersion)((0, actions_util_1.getActionVersion)(), gitHubVersion);

View File

@@ -1 +1 @@
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,qCAAqC;AACrC,iDAAmD;AACnD,+CAAuC;AAEvC,uCAAqD;AACrD,mDAMyB;AACzB,iCAMgB;AAShB,KAAK,UAAU,yBAA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AAC;gBACrB,MAAM,CAAC,IAAI,CACT,6CAA6C,gBAAgB,EAAE,CAChE,CAAC;gBACF,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAClC,CAAC;YACD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBACjC,eAAe,GAAG,QAAQ,CAAC;gBAC3B,MAAM,IAAA,wBAAY,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,cAAc,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,IAAA,gBAAS,EAAC,cAAc,CAAC,CAAC;QACxC,IAAI,CAAC,SAAS,CACZ,kIAAkI,KAAK,CAAC,OAAO,EAAE,CAClJ,CAAC;QACF,MAAM,yBAAyB,CAC7B,MAAM,EACN,MAAM,EACN,SAAS,EACT,SAAS,IAAI,EAAE,EACf,eAAe,EACf,KAAK,CACN,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,CAAC,cAAc,CAAC,oBAAM,CAAC,mCAAmC,EAAE,MAAM,CAAC,CAAC;IAExE,MAAM,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CAAC,4BAA4B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

37
lib/codeql.js generated
View File

@@ -56,15 +56,15 @@ const CODEQL_MINIMUM_VERSION = "2.11.6";
/** /**
* This version will shortly become the oldest version of CodeQL that the Action will run with. * This version will shortly become the oldest version of CodeQL that the Action will run with.
*/ */
const CODEQL_NEXT_MINIMUM_VERSION = "2.11.6"; const CODEQL_NEXT_MINIMUM_VERSION = "2.12.6";
/** /**
* This is the version of GHES that was most recently deprecated. * This is the version of GHES that was most recently deprecated.
*/ */
const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.7"; const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.8";
/** /**
* This is the deprecation date for the version of GHES that was most recently deprecated. * This is the deprecation date for the version of GHES that was most recently deprecated.
*/ */
const GHES_MOST_RECENT_DEPRECATION_DATE = "2023-11-08"; const GHES_MOST_RECENT_DEPRECATION_DATE = "2024-03-26";
/** The CLI verbosity level to use for extraction in debug mode. */ /** The CLI verbosity level to use for extraction in debug mode. */
const EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++"; const EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
/* /*
@@ -207,6 +207,7 @@ function setCodeQL(partialCodeql) {
databaseExportDiagnostics: resolveFunction(partialCodeql, "databaseExportDiagnostics"), databaseExportDiagnostics: resolveFunction(partialCodeql, "databaseExportDiagnostics"),
diagnosticsExport: resolveFunction(partialCodeql, "diagnosticsExport"), diagnosticsExport: resolveFunction(partialCodeql, "diagnosticsExport"),
resolveExtractor: resolveFunction(partialCodeql, "resolveExtractor"), resolveExtractor: resolveFunction(partialCodeql, "resolveExtractor"),
mergeResults: resolveFunction(partialCodeql, "mergeResults"),
}; };
return cachedCodeQL; return cachedCodeQL;
} }
@@ -502,17 +503,10 @@ async function getCodeQLForCmd(cmd, checkVersion) {
else if (await util.codeQlVersionAbove(this, "2.12.4")) { else if (await util.codeQlVersionAbove(this, "2.12.4")) {
codeqlArgs.push("--no-sarif-include-diagnostics"); codeqlArgs.push("--no-sarif-include-diagnostics");
} }
if ( if ((await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2)) &&
// Analysis summary v2 links to the status page, so check the GHES version we're running on !(0, tools_features_1.isSupportedToolsFeature)(await this.getVersion(), tools_features_1.ToolsFeature.AnalysisSummaryV2IsDefault)) {
// supports the status page.
(config.gitHubVersion.type !== util.GitHubVariant.GHES ||
semver.gte(config.gitHubVersion.version, "3.9.0")) &&
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2))) {
codeqlArgs.push("--new-analysis-summary"); codeqlArgs.push("--new-analysis-summary");
} }
else if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2)) {
codeqlArgs.push("--no-new-analysis-summary");
}
codeqlArgs.push(databasePath); codeqlArgs.push(databasePath);
if (querySuitePaths) { if (querySuitePaths) {
codeqlArgs.push(...querySuitePaths); codeqlArgs.push(...querySuitePaths);
@@ -664,6 +658,22 @@ async function getCodeQLForCmd(cmd, checkVersion) {
}).exec(); }).exec();
return JSON.parse(extractorPath); return JSON.parse(extractorPath);
}, },
async mergeResults(sarifFiles, outputFile, { mergeRunsFromEqualCategory = false, }) {
const args = [
"github",
"merge-results",
"--output",
outputFile,
...getExtraOptionsFromEnv(["github", "merge-results"]),
];
for (const sarifFile of sarifFiles) {
args.push("--sarif", sarifFile);
}
if (mergeRunsFromEqualCategory) {
args.push("--sarif-merge-runs-from-equal-category");
}
await runTool(cmd, args);
},
}; };
// To ensure that status reports include the CodeQL CLI version wherever // To ensure that status reports include the CodeQL CLI version wherever
// possible, we want to call getVersion(), which populates the version value // possible, we want to call getVersion(), which populates the version value
@@ -689,8 +699,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
"version of the CLI using the 'tools' input to the 'init' Action, you can remove this " + "version of the CLI using the 'tools' input to the 'init' Action, you can remove this " +
"input to use the default version.\n\n" + "input to use the default version.\n\n" +
"Alternatively, if you want to continue using CodeQL CLI version " + "Alternatively, if you want to continue using CodeQL CLI version " +
`${result.version}, you can replace 'github/codeql-action/*@v3' by ` + `${result.version}, you can replace 'github/codeql-action/*@v${(0, actions_util_1.getActionVersion)().split(".")[0]}' by 'github/codeql-action/*@v${(0, actions_util_1.getActionVersion)()}' in your code scanning workflow to ` +
`'github/codeql-action/*@v${(0, actions_util_1.getActionVersion)()}' in your code scanning workflow to ` +
"continue using this version of the CodeQL Action."); "continue using this version of the CodeQL Action.");
core.exportVariable(environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING, "true"); core.exportVariable(environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING, "true");
} }

File diff suppressed because one or more lines are too long

32
lib/codeql.test.js generated
View File

@@ -44,6 +44,7 @@ const languages_1 = require("./languages");
const logging_1 = require("./logging"); const logging_1 = require("./logging");
const setup_codeql_1 = require("./setup-codeql"); const setup_codeql_1 = require("./setup-codeql");
const testing_utils_1 = require("./testing-utils"); const testing_utils_1 = require("./testing-utils");
const tools_features_1 = require("./tools-features");
const util = __importStar(require("./util")); const util = __importStar(require("./util"));
const util_1 = require("./util"); const util_1 = require("./util");
(0, testing_utils_1.setupTests)(ava_1.default); (0, testing_utils_1.setupTests)(ava_1.default);
@@ -493,7 +494,17 @@ const injectedConfigMacro = ava_1.default.macro({
}); });
const NEW_ANALYSIS_SUMMARY_TEST_CASES = [ const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
{ {
codeqlVersion: "2.15.0", codeqlVersion: (0, testing_utils_1.makeVersionInfo)("2.15.0", {
[tools_features_1.ToolsFeature.AnalysisSummaryV2IsDefault]: true,
}),
githubVersion: {
type: util.GitHubVariant.DOTCOM,
},
flagPassed: false,
negativeFlagPassed: false,
},
{
codeqlVersion: (0, testing_utils_1.makeVersionInfo)("2.15.0"),
githubVersion: { githubVersion: {
type: util.GitHubVariant.DOTCOM, type: util.GitHubVariant.DOTCOM,
}, },
@@ -501,7 +512,7 @@ const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
negativeFlagPassed: false, negativeFlagPassed: false,
}, },
{ {
codeqlVersion: "2.15.0", codeqlVersion: (0, testing_utils_1.makeVersionInfo)("2.15.0"),
githubVersion: { githubVersion: {
type: util.GitHubVariant.GHES, type: util.GitHubVariant.GHES,
version: "3.9.0", version: "3.9.0",
@@ -510,16 +521,7 @@ const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
negativeFlagPassed: false, negativeFlagPassed: false,
}, },
{ {
codeqlVersion: "2.15.0", codeqlVersion: (0, testing_utils_1.makeVersionInfo)("2.14.6"),
githubVersion: {
type: util.GitHubVariant.GHES,
version: "3.8.6",
},
flagPassed: false,
negativeFlagPassed: true,
},
{
codeqlVersion: "2.14.6",
githubVersion: { githubVersion: {
type: util.GitHubVariant.DOTCOM, type: util.GitHubVariant.DOTCOM,
}, },
@@ -532,12 +534,10 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
? "--new-analysis-summary" ? "--new-analysis-summary"
: negativeFlagPassed : negativeFlagPassed
? "--no-new-analysis-summary" ? "--no-new-analysis-summary"
: "nothing"} for CodeQL CLI v${codeqlVersion} and ${util.GitHubVariant[githubVersion.type]} ${githubVersion.version ? ` ${githubVersion.version}` : ""}`, async (t) => { : "nothing"} for CodeQL version ${JSON.stringify(codeqlVersion)} and ${util.GitHubVariant[githubVersion.type]} ${githubVersion.version ? ` ${githubVersion.version}` : ""}`, async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor(); const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon sinon.stub(codeqlObject, "getVersion").resolves(codeqlVersion);
.stub(codeqlObject, "getVersion")
.resolves((0, testing_utils_1.makeVersionInfo)(codeqlVersion));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", Object.assign({}, stubConfig, { gitHubVersion: githubVersion }), (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true)); await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", Object.assign({}, stubConfig, { gitHubVersion: githubVersion }), (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"bundleVersion": "codeql-bundle-v2.16.5", "bundleVersion": "codeql-bundle-v2.16.6",
"cliVersion": "2.16.5", "cliVersion": "2.16.6",
"priorBundleVersion": "codeql-bundle-v2.16.4", "priorBundleVersion": "codeql-bundle-v2.16.5",
"priorCliVersion": "2.16.4" "priorCliVersion": "2.16.5"
} }

7
lib/feature-flags.js generated
View File

@@ -48,6 +48,7 @@ exports.CODEQL_VERSION_FINE_GRAINED_PARALLELISM = "2.15.1";
*/ */
var Feature; var Feature;
(function (Feature) { (function (Feature) {
Feature["CliSarifMerge"] = "cli_sarif_merge_enabled";
Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled"; Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled";
Feature["CppTrapCachingEnabled"] = "cpp_trap_caching_enabled"; Feature["CppTrapCachingEnabled"] = "cpp_trap_caching_enabled";
Feature["DisableJavaBuildlessEnabled"] = "disable_java_buildless_enabled"; Feature["DisableJavaBuildlessEnabled"] = "disable_java_buildless_enabled";
@@ -58,6 +59,12 @@ var Feature;
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled"; Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
})(Feature || (exports.Feature = Feature = {})); })(Feature || (exports.Feature = Feature = {}));
exports.featureConfig = { exports.featureConfig = {
[Feature.CliSarifMerge]: {
envVar: "CODEQL_ACTION_CLI_SARIF_MERGE",
// This is guarded by a `supportsFeature` check rather than by a version check.
minimumVersion: undefined,
defaultValue: false,
},
[Feature.CppDependencyInstallation]: { [Feature.CppDependencyInstallation]: {
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES", envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
minimumVersion: "2.15.0", minimumVersion: "2.15.0",

File diff suppressed because one or more lines are too long

1
lib/fingerprints.js generated
View File

@@ -238,6 +238,7 @@ exports.resolveUriToFile = resolveUriToFile;
// Compute fingerprints for results in the given sarif file // Compute fingerprints for results in the given sarif file
// and return an updated sarif file contents. // and return an updated sarif file contents.
async function addFingerprints(sarif, sourceRoot, logger) { async function addFingerprints(sarif, sourceRoot, logger) {
logger.info("Adding fingerprints to SARIF file. For more information, see https://docs.github.com/en/enterprise-cloud@latest/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning#providing-data-to-track-code-scanning-alerts-across-runs");
// Gather together results for the same file and construct // Gather together results for the same file and construct
// callbacks to accept hashes for that file and update the location // callbacks to accept hashes for that file and update the location
const callbacksByFile = {}; const callbacksByFile = {};

File diff suppressed because one or more lines are too long

View File

@@ -59,18 +59,23 @@ async function runWrapper() {
catch (unwrappedError) { catch (unwrappedError) {
const error = (0, util_1.wrapError)(unwrappedError); const error = (0, util_1.wrapError)(unwrappedError);
core.setFailed(error.message); core.setFailed(error.message);
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.InitPost, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.InitPost, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
return; return;
} }
const jobStatus = initActionPostHelper.getFinalJobStatus(); const jobStatus = initActionPostHelper.getFinalJobStatus();
logger.info(`CodeQL job status was ${(0, status_report_1.getJobStatusDisplayName)(jobStatus)}.`); logger.info(`CodeQL job status was ${(0, status_report_1.getJobStatusDisplayName)(jobStatus)}.`);
const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.InitPost, "success", startedAt, config, await (0, util_1.checkDiskUsage)(), logger); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.InitPost, "success", startedAt, config, await (0, util_1.checkDiskUsage)(), logger);
const statusReport = { if (statusReportBase !== undefined) {
...statusReportBase, const statusReport = {
...uploadFailedSarifResult, ...statusReportBase,
job_status: initActionPostHelper.getFinalJobStatus(), ...uploadFailedSarifResult,
}; job_status: initActionPostHelper.getFinalJobStatus(),
await (0, status_report_1.sendStatusReport)(statusReport); };
await (0, status_report_1.sendStatusReport)(statusReport);
}
} }
void runWrapper(); void runWrapper();
//# sourceMappingURL=init-action-post.js.map //# sourceMappingURL=init-action-post.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"init-action-post.js","sourceRoot":"","sources":["../src/init-action-post.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AAEtC,iDAAuE;AACvE,6CAAgD;AAChD,iDAAmD;AACnD,kEAAoD;AACpD,mDAA2C;AAC3C,gFAAkE;AAClE,uCAA6C;AAC7C,6CAAkD;AAClD,mDAOyB;AACzB,iCAKgB;AAOhB,KAAK,UAAU,UAAU;IACvB,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAClC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,MAA0B,CAAC;IAC/B,IAAI,uBAES,CAAC;IACd,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAEjD,MAAM,aAAa,GAAG,IAAA,+BAAkB,EACtC,IAAA,0BAAmB,EAAC,mBAAmB,CAAC,CACzC,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,wBAAQ,CAC3B,aAAa,EACb,aAAa,EACb,IAAA,oCAAqB,GAAE,EACvB,MAAM,CACP,CAAC;QAEF,MAAM,GAAG,MAAM,IAAA,wBAAS,EAAC,IAAA,oCAAqB,GAAE,EAAE,MAAM,CA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GAAG,IAAA,gBAAS,EAAC,cAAc,CAAC,CAAC;QACxC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE9B,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,0BAAU,CAAC,QAAQ,EACnB,IAAA,gCAAgB,EAAC,KAAK,CAAC,EACvB,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,GAAE,EACtB,MAAM,EACN,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CACZ,CAAC;QACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACnC,MAAM,IAAA,gCAAgB,EAAC,gBAAgB,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO;IACT,CAAC;IACD,MAAM,SAAS,GAAG,oBAAoB,CAAC,iBAAiB,EAAE,CAAC;IAC3D,MAAM,CAAC,IAAI,CAAC,yBAAyB,IAAA,uCAAuB,EAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAE5E,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,0BAAU,CAAC,QAAQ,EACnB,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,GAAE,EACtB,MAAM,CACP,CAAC;IACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,YAAY,GAAyB;YACzC,GAAG,gBAAgB;YACnB,GAAG,uBAAuB;YAC1B,UAAU,EAAE,oBAAoB,CAAC,iBAAiB,EAAE;SACrD,CAAC;QACF,MAAM,IAAA,gCAAgB,EAAC,YAAY,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

13
lib/init-action.js generated
View File

@@ -44,6 +44,9 @@ const util_1 = require("./util");
const workflow_1 = require("./workflow"); const workflow_1 = require("./workflow");
async function sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger, error) { async function sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger, error) {
const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger, error?.message, error?.stack); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger, error?.message, error?.stack);
if (statusReportBase === undefined) {
return;
}
const workflowLanguages = (0, actions_util_1.getOptionalInput)("languages"); const workflowLanguages = (0, actions_util_1.getOptionalInput)("languages");
const initStatusReport = { const initStatusReport = {
...statusReportBase, ...statusReportBase,
@@ -122,7 +125,10 @@ async function run() {
core.exportVariable(environment_1.EnvVar.JOB_RUN_UUID, (0, uuid_1.v4)()); core.exportVariable(environment_1.EnvVar.JOB_RUN_UUID, (0, uuid_1.v4)());
core.exportVariable(environment_1.EnvVar.INIT_ACTION_HAS_RUN, "true"); core.exportVariable(environment_1.EnvVar.INIT_ACTION_HAS_RUN, "true");
try { try {
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(logger), logger);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type); const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
toolsFeatureFlagsValid = codeQLDefaultVersionInfo.toolsFeatureFlagsValid; toolsFeatureFlagsValid = codeQLDefaultVersionInfo.toolsFeatureFlagsValid;
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, codeQLDefaultVersionInfo, logger); const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, codeQLDefaultVersionInfo, logger);
@@ -182,7 +188,10 @@ async function run() {
catch (unwrappedError) { catch (unwrappedError) {
const error = (0, util_1.wrapError)(unwrappedError); const error = (0, util_1.wrapError)(unwrappedError);
core.setFailed(error.message); core.setFailed(error.message);
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, error instanceof util_1.ConfigurationError ? "user-error" : "aborted", startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, error instanceof util_1.ConfigurationError ? "user-error" : "aborted", startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
return; return;
} }
try { try {

File diff suppressed because one or more lines are too long

View File

@@ -38,7 +38,10 @@ async function run() {
const logger = (0, logging_1.getActionsLogger)(); const logger = (0, logging_1.getActionsLogger)();
let config; let config;
try { try {
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(), logger)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, "starting", startedAt, config, await (0, util_1.checkDiskUsage)(), logger);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
const gitHubVersion = await (0, api_client_1.getGitHubVersion)(); const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger); (0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
(0, util_1.checkActionVersion)((0, actions_util_1.getActionVersion)(), gitHubVersion); (0, util_1.checkActionVersion)((0, actions_util_1.getActionVersion)(), gitHubVersion);
@@ -61,11 +64,17 @@ async function run() {
else { else {
// For any other error types, something has more seriously gone wrong and we fail. // For any other error types, something has more seriously gone wrong and we fail.
core.setFailed(`Failed to resolve a build environment suitable for automatically building your code. ${error.message}`); core.setFailed(`Failed to resolve a build environment suitable for automatically building your code. ${error.message}`);
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, (0, status_report_1.getActionsStatus)(error), startedAt, config, await (0, util_1.checkDiskUsage)(), logger, error.message, error.stack);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
} }
return; return;
} }
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, "success", startedAt, config, await (0, util_1.checkDiskUsage)(), logger)); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.ResolveEnvironment, "success", startedAt, config, await (0, util_1.checkDiskUsage)(), logger);
if (statusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(statusReportBase);
}
} }
async function runWrapper() { async function runWrapper() {
try { try {

View File

@@ -1 +1 @@
{"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAKwB;AACxB,6CAAgD;AAChD,6CAAsD;AACtD,iDAAmD;AACnD,uCAA6C;AAC7C,+DAAmE;AACnE,mDAKyB;AACzB,iCAMgB;AAEhB,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,KAAK,UAAU,GAAG;IAChB,MAAM,SAA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FAAwF,KAAK,CAAC,OAAO,EAAE,CACxG,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,kFAAkF;YAClF,IAAI,CAAC,SAAS,CACZ,wFAAwF,KAAK,CAAC,OAAO,EAAE,CACxG,CAAC;YAEF,MAAM,IAAA,gCAAgB,EACpB,MAAM,IAAA,sCAAsB,EAC1B,0BAAU,CAAC,kBAAkB,EAC7B,IAAA,gCAAgB,EAAC,KAAK,CAAC,EACvB,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,GAAE,EACtB,MAAM,EACN,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CACZ,CACF,CAAC;QACJ,CAAC;QAED,OAAO;IACT,CAAC;IAED,MAAM,IAAA,gCAAgB,EACpB,MAAM,IAAA,sCAAsB,EAC1B,0BAAU,CAAC,kBAAkB,EAC7B,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,GAAE,EACtB,MAAM,CACP,CACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,GAAG,0BAAU,CAAC,kBAAkB,mBAC9B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OACnB,EAAE,CACH,CAAC;IACJ,CAAC;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"} {"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAKwB;AACxB,6CAAgD;AAChD,6CAAsD;AACtD,iDAAmD;AACnD,uCAA6C;AAC7C,+DAAmE;AACnE,mDAKyB;AACzB,iCAMgB;AAEhB,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,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AC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

178
lib/status-report.js generated
View File

@@ -107,97 +107,105 @@ function setJobStatusIfUnsuccessful(actionStatus) {
* @param startedAt The time this action started executing. * @param startedAt The time this action started executing.
* @param cause Cause of failure (only supply if status is 'failure') * @param cause Cause of failure (only supply if status is 'failure')
* @param exception Exception (only supply if status is 'failure') * @param exception Exception (only supply if status is 'failure')
* @returns undefined if an exception was thrown.
*/ */
async function createStatusReportBase(actionName, status, actionStartedAt, config, diskInfo, logger, cause, exception) { async function createStatusReportBase(actionName, status, actionStartedAt, config, diskInfo, logger, cause, exception) {
const commitOid = (0, actions_util_1.getOptionalInput)("sha") || process.env["GITHUB_SHA"] || "";
const ref = await (0, actions_util_1.getRef)();
const jobRunUUID = process.env[environment_1.EnvVar.JOB_RUN_UUID] || "";
const workflowRunID = (0, actions_util_1.getWorkflowRunID)();
const workflowRunAttempt = (0, actions_util_1.getWorkflowRunAttempt)();
const workflowName = process.env["GITHUB_WORKFLOW"] || "";
const jobName = process.env["GITHUB_JOB"] || "";
const analysis_key = await (0, api_client_1.getAnalysisKey)();
let workflowStartedAt = process.env[environment_1.EnvVar.WORKFLOW_STARTED_AT];
if (workflowStartedAt === undefined) {
workflowStartedAt = actionStartedAt.toISOString();
core.exportVariable(environment_1.EnvVar.WORKFLOW_STARTED_AT, workflowStartedAt);
}
const runnerOs = (0, util_1.getRequiredEnvParam)("RUNNER_OS");
const codeQlCliVersion = (0, util_1.getCachedCodeQlVersion)();
const actionRef = process.env["GITHUB_ACTION_REF"];
const testingEnvironment = process.env[environment_1.EnvVar.TESTING_ENVIRONMENT] || "";
// re-export the testing environment variable so that it is available to subsequent steps,
// even if it was only set for this step
if (testingEnvironment !== "") {
core.exportVariable(environment_1.EnvVar.TESTING_ENVIRONMENT, testingEnvironment);
}
const statusReport = {
action_name: actionName,
action_oid: "unknown", // TODO decide if it's possible to fill this in
action_ref: actionRef,
action_started_at: actionStartedAt.toISOString(),
action_version: (0, actions_util_1.getActionVersion)(),
analysis_key,
build_mode: config?.buildMode,
commit_oid: commitOid,
first_party_analysis: isFirstPartyAnalysis(actionName),
job_name: jobName,
job_run_uuid: jobRunUUID,
ref,
runner_os: runnerOs,
started_at: workflowStartedAt,
status,
testing_environment: testingEnvironment,
workflow_name: workflowName,
workflow_run_attempt: workflowRunAttempt,
workflow_run_id: workflowRunID,
};
try { try {
statusReport.actions_event_name = (0, actions_util_1.getWorkflowEventName)(); const commitOid = (0, actions_util_1.getOptionalInput)("sha") || process.env["GITHUB_SHA"] || "";
const ref = await (0, actions_util_1.getRef)();
const jobRunUUID = process.env[environment_1.EnvVar.JOB_RUN_UUID] || "";
const workflowRunID = (0, actions_util_1.getWorkflowRunID)();
const workflowRunAttempt = (0, actions_util_1.getWorkflowRunAttempt)();
const workflowName = process.env["GITHUB_WORKFLOW"] || "";
const jobName = process.env["GITHUB_JOB"] || "";
const analysis_key = await (0, api_client_1.getAnalysisKey)();
let workflowStartedAt = process.env[environment_1.EnvVar.WORKFLOW_STARTED_AT];
if (workflowStartedAt === undefined) {
workflowStartedAt = actionStartedAt.toISOString();
core.exportVariable(environment_1.EnvVar.WORKFLOW_STARTED_AT, workflowStartedAt);
}
const runnerOs = (0, util_1.getRequiredEnvParam)("RUNNER_OS");
const codeQlCliVersion = (0, util_1.getCachedCodeQlVersion)();
const actionRef = process.env["GITHUB_ACTION_REF"] || "";
const testingEnvironment = process.env[environment_1.EnvVar.TESTING_ENVIRONMENT] || "";
// re-export the testing environment variable so that it is available to subsequent steps,
// even if it was only set for this step
if (testingEnvironment !== "") {
core.exportVariable(environment_1.EnvVar.TESTING_ENVIRONMENT, testingEnvironment);
}
const statusReport = {
action_name: actionName,
action_oid: "unknown", // TODO decide if it's possible to fill this in
action_ref: actionRef,
action_started_at: actionStartedAt.toISOString(),
action_version: (0, actions_util_1.getActionVersion)(),
analysis_key,
build_mode: config?.buildMode,
commit_oid: commitOid,
first_party_analysis: isFirstPartyAnalysis(actionName),
job_name: jobName,
job_run_uuid: jobRunUUID,
ref,
runner_os: runnerOs,
started_at: workflowStartedAt,
status,
testing_environment: testingEnvironment,
workflow_name: workflowName,
workflow_run_attempt: workflowRunAttempt,
workflow_run_id: workflowRunID,
};
try {
statusReport.actions_event_name = (0, actions_util_1.getWorkflowEventName)();
}
catch (e) {
logger.warning(`Could not determine the workflow event name: ${e}.`);
}
if (config) {
statusReport.languages = config.languages.join(",");
}
if (diskInfo) {
statusReport.runner_available_disk_space_bytes =
diskInfo.numAvailableBytes;
statusReport.runner_total_disk_space_bytes = diskInfo.numTotalBytes;
}
// Add optional parameters
if (cause) {
statusReport.cause = cause;
}
if (exception) {
statusReport.exception = exception;
}
if (status === "success" ||
status === "failure" ||
status === "aborted" ||
status === "user-error") {
statusReport.completed_at = new Date().toISOString();
}
const matrix = (0, actions_util_1.getRequiredInput)("matrix");
if (matrix) {
statusReport.matrix_vars = matrix;
}
if ("RUNNER_ARCH" in process.env) {
// RUNNER_ARCH is available only in GHES 3.4 and later
// Values other than X86, X64, ARM, or ARM64 are discarded server side
statusReport.runner_arch = process.env["RUNNER_ARCH"];
}
if (runnerOs === "Windows" || runnerOs === "macOS") {
statusReport.runner_os_release = os.release();
}
if (codeQlCliVersion !== undefined) {
statusReport.codeql_version = codeQlCliVersion.version;
}
const imageVersion = process.env["ImageVersion"];
if (imageVersion) {
statusReport.runner_image_version = imageVersion;
}
return statusReport;
} }
catch (e) { catch (e) {
logger.warning(`Could not determine the workflow event name: ${e}.`); logger.warning(`Caught an exception while gathering information for telemetry: ${e}. Will skip sending status report.`);
return undefined;
} }
if (config) {
statusReport.languages = config.languages.join(",");
}
if (diskInfo) {
statusReport.runner_available_disk_space_bytes = diskInfo.numAvailableBytes;
statusReport.runner_total_disk_space_bytes = diskInfo.numTotalBytes;
}
// Add optional parameters
if (cause) {
statusReport.cause = cause;
}
if (exception) {
statusReport.exception = exception;
}
if (status === "success" ||
status === "failure" ||
status === "aborted" ||
status === "user-error") {
statusReport.completed_at = new Date().toISOString();
}
const matrix = (0, actions_util_1.getRequiredInput)("matrix");
if (matrix) {
statusReport.matrix_vars = matrix;
}
if ("RUNNER_ARCH" in process.env) {
// RUNNER_ARCH is available only in GHES 3.4 and later
// Values other than X86, X64, ARM, or ARM64 are discarded server side
statusReport.runner_arch = process.env["RUNNER_ARCH"];
}
if (runnerOs === "Windows" || runnerOs === "macOS") {
statusReport.runner_os_release = os.release();
}
if (codeQlCliVersion !== undefined) {
statusReport.codeql_version = codeQlCliVersion.version;
}
const imageVersion = process.env["ImageVersion"];
if (imageVersion) {
statusReport.runner_image_version = imageVersion;
}
return statusReport;
} }
exports.createStatusReportBase = createStatusReportBase; exports.createStatusReportBase = createStatusReportBase;
const OUT_OF_DATE_MSG = "CodeQL Action is out-of-date. Please upgrade to the latest version of codeql-action."; const OUT_OF_DATE_MSG = "CodeQL Action is out-of-date. Please upgrade to the latest version of codeql-action.";

File diff suppressed because one or more lines are too long

View File

@@ -59,41 +59,44 @@ function setupEnvironmentAndStub(tmpDir) {
buildMode: config_utils_1.BuildMode.None, buildMode: config_utils_1.BuildMode.None,
languages: [languages_1.Language.java, languages_1.Language.swift], languages: [languages_1.Language.java, languages_1.Language.swift],
}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace"); }), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace");
t.is(statusReport.action_name, status_report_1.ActionName.Init); t.truthy(statusReport);
t.is(statusReport.action_oid, "unknown"); if (statusReport !== undefined) {
t.is(typeof statusReport.action_version, "string"); t.is(statusReport.action_name, status_report_1.ActionName.Init);
t.is(statusReport.action_started_at, new Date("May 19, 2023 05:19:00").toISOString()); t.is(statusReport.action_oid, "unknown");
t.is(statusReport.actions_event_name, "dynamic"); t.is(typeof statusReport.action_version, "string");
t.is(statusReport.analysis_key, "analysis-key"); t.is(statusReport.action_started_at, new Date("May 19, 2023 05:19:00").toISOString());
t.is(statusReport.build_mode, config_utils_1.BuildMode.None); t.is(statusReport.actions_event_name, "dynamic");
t.is(statusReport.cause, "failure cause"); t.is(statusReport.analysis_key, "analysis-key");
t.is(statusReport.commit_oid, process.env["GITHUB_SHA"]); t.is(statusReport.build_mode, config_utils_1.BuildMode.None);
t.is(statusReport.exception, "exception stack trace"); t.is(statusReport.cause, "failure cause");
t.is(statusReport.job_name, process.env["GITHUB_JOB"] || ""); t.is(statusReport.commit_oid, process.env["GITHUB_SHA"]);
t.is(typeof statusReport.job_run_uuid, "string"); t.is(statusReport.exception, "exception stack trace");
t.is(statusReport.languages, "java,swift"); t.is(statusReport.job_name, process.env["GITHUB_JOB"] || "");
t.is(statusReport.ref, process.env["GITHUB_REF"]); t.is(typeof statusReport.job_run_uuid, "string");
t.is(statusReport.runner_available_disk_space_bytes, 100); t.is(statusReport.languages, "java,swift");
t.is(statusReport.runner_image_version, process.env["ImageVersion"]); t.is(statusReport.ref, process.env["GITHUB_REF"]);
t.is(statusReport.runner_os, process.env["RUNNER_OS"]); t.is(statusReport.runner_available_disk_space_bytes, 100);
t.is(statusReport.started_at, process.env[environment_1.EnvVar.WORKFLOW_STARTED_AT]); t.is(statusReport.runner_image_version, process.env["ImageVersion"]);
t.is(statusReport.status, "failure"); t.is(statusReport.runner_os, process.env["RUNNER_OS"]);
t.is(statusReport.workflow_name, process.env["GITHUB_WORKFLOW"] || ""); t.is(statusReport.started_at, process.env[environment_1.EnvVar.WORKFLOW_STARTED_AT]);
t.is(statusReport.workflow_run_attempt, 2); t.is(statusReport.status, "failure");
t.is(statusReport.workflow_run_id, 100); t.is(statusReport.workflow_name, process.env["GITHUB_WORKFLOW"] || "");
t.is(statusReport.workflow_run_attempt, 2);
t.is(statusReport.workflow_run_id, 100);
}
}); });
}); });
(0, ava_1.default)("createStatusReportBase_firstParty", async (t) => { (0, ava_1.default)("createStatusReportBase_firstParty", async (t) => {
await (0, util_1.withTmpDir)(async (tmpDir) => { await (0, util_1.withTmpDir)(async (tmpDir) => {
setupEnvironmentAndStub(tmpDir); setupEnvironmentAndStub(tmpDir);
t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace")).first_party_analysis, false); t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace"))?.first_party_analysis, false);
t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Autobuild, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace")).first_party_analysis, true); t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Autobuild, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace"))?.first_party_analysis, true);
process.env["CODEQL_ACTION_INIT_HAS_RUN"] = "foobar"; process.env["CODEQL_ACTION_INIT_HAS_RUN"] = "foobar";
t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace")).first_party_analysis, false); t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace"))?.first_party_analysis, false);
t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace")).first_party_analysis, true); t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Init, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace"))?.first_party_analysis, true);
process.env["CODEQL_ACTION_INIT_HAS_RUN"] = "true"; process.env["CODEQL_ACTION_INIT_HAS_RUN"] = "true";
t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace")).first_party_analysis, true); t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace"))?.first_party_analysis, true);
t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Analyze, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace")).first_party_analysis, true); t.is((await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.Analyze, "failure", new Date("May 19, 2023 05:19:00"), (0, testing_utils_1.createTestConfig)({}), { numAvailableBytes: 100, numTotalBytes: 500 }, (0, logging_1.getRunnerLogger)(false), "failure cause", "exception stack trace"))?.first_party_analysis, true);
}); });
}); });
//# sourceMappingURL=status-report.test.js.map //# sourceMappingURL=status-report.test.js.map

File diff suppressed because one or more lines are too long

2
lib/tools-features.js generated
View File

@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.isSupportedToolsFeature = exports.ToolsFeature = void 0; exports.isSupportedToolsFeature = exports.ToolsFeature = void 0;
var ToolsFeature; var ToolsFeature;
(function (ToolsFeature) { (function (ToolsFeature) {
ToolsFeature["AnalysisSummaryV2IsDefault"] = "analysisSummaryV2Default";
ToolsFeature["BuildModeOption"] = "buildModeOption"; ToolsFeature["BuildModeOption"] = "buildModeOption";
ToolsFeature["IndirectTracingSupportsStaticBinaries"] = "indirectTracingSupportsStaticBinaries"; ToolsFeature["IndirectTracingSupportsStaticBinaries"] = "indirectTracingSupportsStaticBinaries";
ToolsFeature["InformsAboutUnsupportedPathFilters"] = "informsAboutUnsupportedPathFilters"; ToolsFeature["InformsAboutUnsupportedPathFilters"] = "informsAboutUnsupportedPathFilters";
ToolsFeature["SetsCodeqlRunnerEnvVar"] = "setsCodeqlRunnerEnvVar"; ToolsFeature["SetsCodeqlRunnerEnvVar"] = "setsCodeqlRunnerEnvVar";
ToolsFeature["TraceCommandUseBuildMode"] = "traceCommandUseBuildMode"; ToolsFeature["TraceCommandUseBuildMode"] = "traceCommandUseBuildMode";
ToolsFeature["SarifMergeRunsFromEqualCategory"] = "sarifMergeRunsFromEqualCategory";
})(ToolsFeature || (exports.ToolsFeature = ToolsFeature = {})); })(ToolsFeature || (exports.ToolsFeature = ToolsFeature = {}));
/** /**
* Determines if the given feature is supported by the CLI. * Determines if the given feature is supported by the CLI.

View File

@@ -1 +1 @@
{"version":3,"file":"tools-features.js","sourceRoot":"","sources":["../src/tools-features.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,mDAAmC,CAAA;IACnC,+FAA+E,CAAA;IAC/E,yFAAyE,CAAA;IACzE,iEAAiD,CAAA;IACjD,qEAAqD,CAAA;AACvD,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,WAAwB,EACxB,OAAqB;IAErB,OAAO,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AALD,0DAKC"} {"version":3,"file":"tools-features.js","sourceRoot":"","sources":["../src/tools-features.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAQX;AARD,WAAY,YAAY;IACtB,uEAAuD,CAAA;IACvD,mDAAmC,CAAA;IACnC,+FAA+E,CAAA;IAC/E,yFAAyE,CAAA;IACzE,iEAAiD,CAAA;IACjD,qEAAqD,CAAA;IACrD,mFAAmE,CAAA;AACrE,CAAC,EARW,YAAY,4BAAZ,YAAY,QAQvB;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,WAAwB,EACxB,OAAqB;IAErB,OAAO,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AALD,0DAKC"}

85
lib/upload-lib.js generated
View File

@@ -34,22 +34,31 @@ const core = __importStar(require("@actions/core"));
const file_url_1 = __importDefault(require("file-url")); const file_url_1 = __importDefault(require("file-url"));
const jsonschema = __importStar(require("jsonschema")); const jsonschema = __importStar(require("jsonschema"));
const actionsUtil = __importStar(require("./actions-util")); const actionsUtil = __importStar(require("./actions-util"));
const actions_util_1 = require("./actions-util");
const api = __importStar(require("./api-client")); const api = __importStar(require("./api-client"));
const api_client_1 = require("./api-client");
const codeql_1 = require("./codeql");
const config_utils_1 = require("./config-utils");
const environment_1 = require("./environment"); const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags");
const fingerprints = __importStar(require("./fingerprints")); const fingerprints = __importStar(require("./fingerprints"));
const init_1 = require("./init");
const repository_1 = require("./repository"); const repository_1 = require("./repository");
const tools_features_1 = require("./tools-features");
const util = __importStar(require("./util")); const util = __importStar(require("./util"));
const util_1 = require("./util"); const util_1 = require("./util");
const GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning."; const GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning.";
const GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository."; const GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository.";
// Takes a list of paths to sarif files and combines them together, // Takes a list of paths to sarif files and combines them together,
// returning the contents of the combined sarif file. // returning the contents of the combined sarif file.
function combineSarifFiles(sarifFiles) { function combineSarifFiles(sarifFiles, logger) {
logger.info(`Loading SARIF file(s)`);
const combinedSarif = { const combinedSarif = {
version: null, version: null,
runs: [], runs: [],
}; };
for (const sarifFile of sarifFiles) { for (const sarifFile of sarifFiles) {
logger.debug(`Loading SARIF file: ${sarifFile}`);
const sarifObject = JSON.parse(fs.readFileSync(sarifFile, "utf8")); const sarifObject = JSON.parse(fs.readFileSync(sarifFile, "utf8"));
// Check SARIF version // Check SARIF version
if (combinedSarif.version === null) { if (combinedSarif.version === null) {
@@ -62,6 +71,65 @@ function combineSarifFiles(sarifFiles) {
} }
return combinedSarif; return combinedSarif;
} }
/**
* Checks whether all the runs in the given SARIF files were produced by CodeQL.
* @param sarifFiles The list of SARIF files to check.
*/
function areAllRunsProducedByCodeQL(sarifFiles) {
return sarifFiles.every((sarifFile) => {
const sarifObject = JSON.parse(fs.readFileSync(sarifFile, "utf8"));
return sarifObject.runs?.every((run) => run.tool?.driver?.name === "CodeQL");
});
}
// Takes a list of paths to sarif files and combines them together using the
// CLI `github merge-results` command when all SARIF files are produced by
// CodeQL. Otherwise, it will fall back to combining the files in the action.
// Returns the contents of the combined sarif file.
async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, logger) {
logger.info("Combining SARIF files using the CodeQL CLI");
if (sarifFiles.length === 1) {
return JSON.parse(fs.readFileSync(sarifFiles[0], "utf8"));
}
if (!areAllRunsProducedByCodeQL(sarifFiles)) {
logger.debug("Not all SARIF files were produced by CodeQL. Merging files in the action.");
// If not, use the naive method of combining the files.
return combineSarifFiles(sarifFiles, logger);
}
// Initialize CodeQL, either by using the config file from the 'init' step,
// or by initializing it here.
let codeQL;
let tempDir = actionsUtil.getTemporaryDirectory();
const config = await (0, config_utils_1.getConfig)(tempDir, logger);
if (config !== undefined) {
codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
tempDir = config.tempDir;
}
else {
logger.info("Initializing CodeQL since the 'init' Action was not called before this step.");
const apiDetails = {
auth: (0, actions_util_1.getRequiredInput)("token"),
externalRepoAuth: (0, actions_util_1.getOptionalInput)("external-repository-token"),
url: (0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL"),
apiURL: (0, util_1.getRequiredEnvParam)("GITHUB_API_URL"),
};
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
const initCodeQLResult = await (0, init_1.initCodeQL)(undefined, // There is no tools input on the upload action
apiDetails, tempDir, gitHubVersion.type, codeQLDefaultVersionInfo, logger);
codeQL = initCodeQLResult.codeql;
}
if (!(await codeQL.supportsFeature(tools_features_1.ToolsFeature.SarifMergeRunsFromEqualCategory))) {
logger.warning("The CodeQL CLI does not support merging SARIF files. Merging files in the action.");
return combineSarifFiles(sarifFiles, logger);
}
const baseTempDir = path.resolve(tempDir, "combined-sarif");
fs.mkdirSync(baseTempDir, { recursive: true });
const outputDirectory = fs.mkdtempSync(path.resolve(baseTempDir, "output-"));
const outputFile = path.resolve(outputDirectory, "combined-sarif.sarif");
await codeQL.mergeResults(sarifFiles, outputFile, {
mergeRunsFromEqualCategory: true,
});
return JSON.parse(fs.readFileSync(outputFile, "utf8"));
}
// Populates the run.automationDetails.id field using the analysis_key and environment // Populates the run.automationDetails.id field using the analysis_key and environment
// and return an updated sarif file contents. // and return an updated sarif file contents.
function populateRunAutomationDetails(sarif, category, analysis_key, environment) { function populateRunAutomationDetails(sarif, category, analysis_key, environment) {
@@ -190,6 +258,7 @@ function countResultsInSarif(sarif) {
// Validates that the given file path refers to a valid SARIF file. // Validates that the given file path refers to a valid SARIF file.
// Throws an error if the file is invalid. // Throws an error if the file is invalid.
function validateSarifFileSchema(sarifFilePath, logger) { function validateSarifFileSchema(sarifFilePath, logger) {
logger.info(`Validating ${sarifFilePath}`);
let sarif; let sarif;
try { try {
sarif = JSON.parse(fs.readFileSync(sarifFilePath, "utf8")); sarif = JSON.parse(fs.readFileSync(sarifFilePath, "utf8"));
@@ -222,7 +291,8 @@ function validateSarifFileSchema(sarifFilePath, logger) {
exports.validateSarifFileSchema = validateSarifFileSchema; exports.validateSarifFileSchema = validateSarifFileSchema;
// buildPayload constructs a map ready to be uploaded to the API from the given // buildPayload constructs a map ready to be uploaded to the API from the given
// parameters, respecting the current mode and target GitHub instance version. // parameters, respecting the current mode and target GitHub instance version.
function buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, workflowRunID, workflowRunAttempt, checkoutURI, environment, toolNames, mergeBaseCommitOid) { function buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, workflowRunID, workflowRunAttempt, checkoutURI, environment, toolNames, mergeBaseCommitOid, logger) {
logger.info(`Combining SARIF files using CLI`);
const payloadObj = { const payloadObj = {
commit_oid: commitOid, commit_oid: commitOid,
ref, ref,
@@ -264,19 +334,26 @@ exports.buildPayload = buildPayload;
async function uploadFiles(sarifFiles, repositoryNwo, commitOid, ref, analysisKey, category, analysisName, workflowRunID, workflowRunAttempt, sourceRoot, environment, logger) { async function uploadFiles(sarifFiles, repositoryNwo, commitOid, ref, analysisKey, category, analysisName, workflowRunID, workflowRunAttempt, sourceRoot, environment, logger) {
logger.startGroup("Uploading results"); logger.startGroup("Uploading results");
logger.info(`Processing sarif files: ${JSON.stringify(sarifFiles)}`); logger.info(`Processing sarif files: ${JSON.stringify(sarifFiles)}`);
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
// Validate that the files we were asked to upload are all valid SARIF files // Validate that the files we were asked to upload are all valid SARIF files
for (const file of sarifFiles) { for (const file of sarifFiles) {
validateSarifFileSchema(file, logger); validateSarifFileSchema(file, logger);
} }
let sarif = combineSarifFiles(sarifFiles); let sarif = (await features.getValue(feature_flags_1.Feature.CliSarifMerge))
? await combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, logger)
: combineSarifFiles(sarifFiles, logger);
sarif = await fingerprints.addFingerprints(sarif, sourceRoot, logger); sarif = await fingerprints.addFingerprints(sarif, sourceRoot, logger);
sarif = populateRunAutomationDetails(sarif, category, analysisKey, environment); sarif = populateRunAutomationDetails(sarif, category, analysisKey, environment);
const toolNames = util.getToolNames(sarif); const toolNames = util.getToolNames(sarif);
logger.debug(`Validating that each SARIF run has a unique category`);
validateUniqueCategory(sarif); validateUniqueCategory(sarif);
logger.debug(`Serializing SARIF for upload`);
const sarifPayload = JSON.stringify(sarif); const sarifPayload = JSON.stringify(sarif);
logger.debug(`Compressing serialized SARIF`);
const zippedSarif = zlib_1.default.gzipSync(sarifPayload).toString("base64"); const zippedSarif = zlib_1.default.gzipSync(sarifPayload).toString("base64");
const checkoutURI = (0, file_url_1.default)(sourceRoot); const checkoutURI = (0, file_url_1.default)(sourceRoot);
const payload = buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, workflowRunID, workflowRunAttempt, checkoutURI, environment, toolNames, await actionsUtil.determineMergeBaseCommitOid()); const payload = buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, workflowRunID, workflowRunAttempt, checkoutURI, environment, toolNames, await actionsUtil.determineMergeBaseCommitOid(), logger);
// Log some useful debug info about the info // Log some useful debug info about the info
const rawUploadSizeBytes = sarifPayload.length; const rawUploadSizeBytes = sarifPayload.length;
logger.debug(`Raw upload size: ${rawUploadSizeBytes} bytes`); logger.debug(`Raw upload size: ${rawUploadSizeBytes} bytes`);

File diff suppressed because one or more lines are too long

10
lib/upload-lib.test.js generated
View File

@@ -47,7 +47,7 @@ ava_1.default.beforeEach(() => {
}); });
(0, ava_1.default)("validate correct payload used for push, PR merge commit, and PR head", async (t) => { (0, ava_1.default)("validate correct payload used for push, PR merge commit, and PR head", async (t) => {
process.env["GITHUB_EVENT_NAME"] = "push"; process.env["GITHUB_EVENT_NAME"] = "push";
const pushPayload = uploadLib.buildPayload("commit", "refs/heads/master", "key", undefined, "", 1234, 1, "/opt/src", undefined, ["CodeQL", "eslint"], "mergeBaseCommit"); const pushPayload = uploadLib.buildPayload("commit", "refs/heads/master", "key", undefined, "", 1234, 1, "/opt/src", undefined, ["CodeQL", "eslint"], "mergeBaseCommit", (0, logging_1.getRunnerLogger)(true));
// Not triggered by a pull request // Not triggered by a pull request
t.falsy(pushPayload.base_ref); t.falsy(pushPayload.base_ref);
t.falsy(pushPayload.base_sha); t.falsy(pushPayload.base_sha);
@@ -55,11 +55,11 @@ ava_1.default.beforeEach(() => {
process.env["GITHUB_SHA"] = "commit"; process.env["GITHUB_SHA"] = "commit";
process.env["GITHUB_BASE_REF"] = "master"; process.env["GITHUB_BASE_REF"] = "master";
process.env["GITHUB_EVENT_PATH"] = `${__dirname}/../src/testdata/pull_request.json`; process.env["GITHUB_EVENT_PATH"] = `${__dirname}/../src/testdata/pull_request.json`;
const prMergePayload = uploadLib.buildPayload("commit", "refs/pull/123/merge", "key", undefined, "", 1234, 1, "/opt/src", undefined, ["CodeQL", "eslint"], "mergeBaseCommit"); const prMergePayload = uploadLib.buildPayload("commit", "refs/pull/123/merge", "key", undefined, "", 1234, 1, "/opt/src", undefined, ["CodeQL", "eslint"], "mergeBaseCommit", (0, logging_1.getRunnerLogger)(true));
// Uploads for a merge commit use the merge base // Uploads for a merge commit use the merge base
t.deepEqual(prMergePayload.base_ref, "refs/heads/master"); t.deepEqual(prMergePayload.base_ref, "refs/heads/master");
t.deepEqual(prMergePayload.base_sha, "mergeBaseCommit"); t.deepEqual(prMergePayload.base_sha, "mergeBaseCommit");
const prHeadPayload = uploadLib.buildPayload("headCommit", "refs/pull/123/head", "key", undefined, "", 1234, 1, "/opt/src", undefined, ["CodeQL", "eslint"], "mergeBaseCommit"); const prHeadPayload = uploadLib.buildPayload("headCommit", "refs/pull/123/head", "key", undefined, "", 1234, 1, "/opt/src", undefined, ["CodeQL", "eslint"], "mergeBaseCommit", (0, logging_1.getRunnerLogger)(true));
// Uploads for the head use the PR base // Uploads for the head use the PR base
t.deepEqual(prHeadPayload.base_ref, "refs/heads/master"); t.deepEqual(prHeadPayload.base_ref, "refs/heads/master");
t.deepEqual(prHeadPayload.base_sha, "f95f852bd8fca8fcc58a9a2d6c842781e32a215e"); t.deepEqual(prHeadPayload.base_sha, "f95f852bd8fca8fcc58a9a2d6c842781e32a215e");
@@ -192,8 +192,8 @@ ava_1.default.beforeEach(() => {
}; };
const sarifFile = `${__dirname}/../src/testdata/with-invalid-uri.sarif`; const sarifFile = `${__dirname}/../src/testdata/with-invalid-uri.sarif`;
uploadLib.validateSarifFileSchema(sarifFile, mockLogger); uploadLib.validateSarifFileSchema(sarifFile, mockLogger);
t.deepEqual(loggedMessages.length, 1); t.deepEqual(loggedMessages.length, 2);
t.deepEqual(loggedMessages[0], "Warning: 'not a valid URI' is not a valid URI in 'instance.runs[0].results[0].locations[0].physicalLocation.artifactLocation.uri'."); t.deepEqual(loggedMessages[1], "Warning: 'not a valid URI' is not a valid URI in 'instance.runs[0].results[0].locations[0].physicalLocation.artifactLocation.uri'.");
}); });
function createMockSarif(id, tool) { function createMockSarif(id, tool) {
return { return {

File diff suppressed because one or more lines are too long

55
lib/upload-sarif-action-post-helper.js generated Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.uploadArtifacts = void 0;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const core = __importStar(require("@actions/core"));
const actionsUtil = __importStar(require("./actions-util"));
async function uploadArtifacts(uploadDebugArtifacts) {
const tempDir = actionsUtil.getTemporaryDirectory();
// Upload Actions SARIF artifacts for debugging when environment variable is set
if (process.env["CODEQL_ACTION_DEBUG_COMBINED_SARIF"] === "true") {
core.info("Uploading available combined SARIF files as Actions debugging artifact...");
const baseTempDir = path.resolve(tempDir, "combined-sarif");
const toUpload = [];
if (fs.existsSync(baseTempDir)) {
const outputDirs = fs.readdirSync(baseTempDir);
for (const outputDir of outputDirs) {
const sarifFiles = fs
.readdirSync(path.resolve(baseTempDir, outputDir))
.filter((f) => f.endsWith(".sarif"));
for (const sarifFile of sarifFiles) {
toUpload.push(path.resolve(baseTempDir, outputDir, sarifFile));
}
}
}
if (toUpload.length > 0) {
await uploadDebugArtifacts(toUpload, baseTempDir, "upload-debug-artifacts");
}
}
}
exports.uploadArtifacts = uploadArtifacts;
//# sourceMappingURL=upload-sarif-action-post-helper.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"upload-sarif-action-post-helper.js","sourceRoot":"","sources":["../src/upload-sarif-action-post-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,oDAAsC;AAEtC,4DAA8C;AAEvC,KAAK,UAAU,eAAe,CACnC,oBAIkB;IAElB,MAAM,OAAO,GAAG,WAAW,CAAC,qBAAqB,EAAE,CAAC;IAEpD,gFAAgF;IAChF,IAAI,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,KAAK,MAAM,EAAE,CAAC;QACjE,IAAI,CAAC,IAAI,CACP,2EAA2E,CAC5E,CAAC;QAEF,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAE5D,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/B,MAAM,UAAU,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YAE/C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;gBACnC,MAAM,UAAU,GAAG,EAAE;qBAClB,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;qBACjD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAEvC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;oBACnC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;gBACjE,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,oBAAoB,CACxB,QAAQ,EACR,WAAW,EACX,wBAAwB,CACzB,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAzCD,0CAyCC"}

44
lib/upload-sarif-action-post.js generated Normal file
View File

@@ -0,0 +1,44 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
* This file is the entry point for the `post:` hook of `upload-sarif-action.yml`.
* It will run after the all steps in this job, in reverse order in relation to
* other `post:` hooks.
*/
const core = __importStar(require("@actions/core"));
const debugArtifacts = __importStar(require("./debug-artifacts"));
const uploadSarifActionPostHelper = __importStar(require("./upload-sarif-action-post-helper"));
const util_1 = require("./util");
async function runWrapper() {
try {
await uploadSarifActionPostHelper.uploadArtifacts(debugArtifacts.uploadDebugArtifacts);
}
catch (error) {
core.setFailed(`upload-sarif post-action step failed: ${(0, util_1.wrapError)(error).message}`);
}
}
void runWrapper();
//# sourceMappingURL=upload-sarif-action-post.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"upload-sarif-action-post.js","sourceRoot":"","sources":["../src/upload-sarif-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,kEAAoD;AACpD,+FAAiF;AACjF,iCAAmC;AAEnC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,2BAA2B,CAAC,eAAe,CAC/C,cAAc,CAAC,oBAAoB,CACpC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,yCAAyC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CACpE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

View File

@@ -34,11 +34,13 @@ const upload_lib = __importStar(require("./upload-lib"));
const util_1 = require("./util"); const util_1 = require("./util");
async function sendSuccessStatusReport(startedAt, uploadStats, logger) { async function sendSuccessStatusReport(startedAt, uploadStats, logger) {
const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, "success", startedAt, undefined, await (0, util_1.checkDiskUsage)(), logger); const statusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, "success", startedAt, undefined, await (0, util_1.checkDiskUsage)(), logger);
const statusReport = { if (statusReportBase !== undefined) {
...statusReportBase, const statusReport = {
...uploadStats, ...statusReportBase,
}; ...uploadStats,
await (0, status_report_1.sendStatusReport)(statusReport); };
await (0, status_report_1.sendStatusReport)(statusReport);
}
} }
async function run() { async function run() {
const startedAt = new Date(); const startedAt = new Date();
@@ -46,7 +48,10 @@ async function run() {
(0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)()); (0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)());
const gitHubVersion = await (0, api_client_1.getGitHubVersion)(); const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
(0, util_1.checkActionVersion)((0, actions_util_1.getActionVersion)(), gitHubVersion); (0, util_1.checkActionVersion)((0, actions_util_1.getActionVersion)(), gitHubVersion);
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, "starting", startedAt, undefined, await (0, util_1.checkDiskUsage)(), logger)); const startingStatusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, "starting", startedAt, undefined, await (0, util_1.checkDiskUsage)(), logger);
if (startingStatusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(startingStatusReportBase);
}
try { try {
const uploadResult = await upload_lib.uploadFromActions(actionsUtil.getRequiredInput("sarif_file"), actionsUtil.getRequiredInput("checkout_path"), actionsUtil.getOptionalInput("category"), logger); const uploadResult = await upload_lib.uploadFromActions(actionsUtil.getRequiredInput("sarif_file"), actionsUtil.getRequiredInput("checkout_path"), actionsUtil.getOptionalInput("category"), logger);
core.setOutput("sarif-id", uploadResult.sarifID); core.setOutput("sarif-id", uploadResult.sarifID);
@@ -67,7 +72,10 @@ async function run() {
const message = error.message; const message = error.message;
core.setFailed(message); core.setFailed(message);
console.log(error); console.log(error);
await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, (0, status_report_1.getActionsStatus)(error), startedAt, undefined, await (0, util_1.checkDiskUsage)(), logger, message, error.stack)); const errorStatusReportBase = await (0, status_report_1.createStatusReportBase)(status_report_1.ActionName.UploadSarif, (0, status_report_1.getActionsStatus)(error), startedAt, undefined, await (0, util_1.checkDiskUsage)(), logger, message, error.stack);
if (errorStatusReportBase !== undefined) {
await (0, status_report_1.sendStatusReport)(errorStatusReportBase);
}
return; return;
} }
} }

View File

@@ -1 +1 @@
{"version":3,"file":"upload-sarif-action.js","sourceRoot":"","sources":["../src/upload-sarif-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,4DAA8C;AAC9C,iDAAkD;AAClD,6CAAgD;AAChD,uCAAqD;AACrD,6CAAkD;AAClD,mDAOyB;AACzB,yDAA2C;AAC3C,iCAQgB;AAMhB,KAAK,UAAU,uBAAuB,CACpC,SAAe,EACf,WAA0C,EAC1C,MAAc;IAEd,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,0BAAU,CAAC,WAAW,EACtB,SAAS,EACT,SAAS,EACT,SAAS,EACT,MAAM,IAAA,qBAAc,GAAE,EACtB,MAAM,CACP,CAAC;IACF,MAAM,YAAY,GAA4B;QAC5C,GA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;YACxC,MAAM,IAAA,gCAAgB,EAAC,qBAAqB,CAAC,CAAC;QAChD,CAAC;QACD,OAAO;IACT,CAAC;AACH,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,sCAAsC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CACjE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

86
node_modules/.package-lock.json generated vendored
View File

@@ -1,6 +1,6 @@
{ {
"name": "codeql", "name": "codeql",
"version": "3.24.10", "version": "3.24.11",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
@@ -960,16 +960,16 @@
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==" "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="
}, },
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "7.3.1", "version": "7.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.3.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.4.0.tgz",
"integrity": "sha512-STEDMVQGww5lhCuNXVSQfbfuNII5E08QWkvAw5Qwf+bj2WT+JkG1uc+5/vXA3AOYMDHVOSpL+9rcbEUiHIm2dw==", "integrity": "sha512-yHMQ/oFaM7HZdVrVm/M2WHaNPgyuJH4WelkSVEWSSsir34kxW2kDJCxlXRhhGWEsMN0WAW/vLpKfKVcm8k+MPw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/regexpp": "^4.5.1", "@eslint-community/regexpp": "^4.5.1",
"@typescript-eslint/scope-manager": "7.3.1", "@typescript-eslint/scope-manager": "7.4.0",
"@typescript-eslint/type-utils": "7.3.1", "@typescript-eslint/type-utils": "7.4.0",
"@typescript-eslint/utils": "7.3.1", "@typescript-eslint/utils": "7.4.0",
"@typescript-eslint/visitor-keys": "7.3.1", "@typescript-eslint/visitor-keys": "7.4.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"graphemer": "^1.4.0", "graphemer": "^1.4.0",
"ignore": "^5.2.4", "ignore": "^5.2.4",
@@ -995,15 +995,15 @@
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "7.3.1", "version": "7.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.3.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.4.0.tgz",
"integrity": "sha512-Rq49+pq7viTRCH48XAbTA+wdLRrB/3sRq4Lpk0oGDm0VmnjBrAOVXH/Laalmwsv2VpekiEfVFwJYVk6/e8uvQw==", "integrity": "sha512-ZvKHxHLusweEUVwrGRXXUVzFgnWhigo4JurEj0dGF1tbcGh6buL+ejDdjxOQxv6ytcY1uhun1p2sm8iWStlgLQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "7.3.1", "@typescript-eslint/scope-manager": "7.4.0",
"@typescript-eslint/types": "7.3.1", "@typescript-eslint/types": "7.4.0",
"@typescript-eslint/typescript-estree": "7.3.1", "@typescript-eslint/typescript-estree": "7.4.0",
"@typescript-eslint/visitor-keys": "7.3.1", "@typescript-eslint/visitor-keys": "7.4.0",
"debug": "^4.3.4" "debug": "^4.3.4"
}, },
"engines": { "engines": {
@@ -1023,13 +1023,13 @@
} }
}, },
"node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/scope-manager": {
"version": "7.3.1", "version": "7.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.3.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.4.0.tgz",
"integrity": "sha512-fVS6fPxldsKY2nFvyT7IP78UO1/I2huG+AYu5AMjCT9wtl6JFiDnsv4uad4jQ0GTFzcUV5HShVeN96/17bTBag==", "integrity": "sha512-68VqENG5HK27ypafqLVs8qO+RkNc7TezCduYrx8YJpXq2QGZ30vmNZGJJJC48+MVn4G2dCV8m5ZTVnzRexTVtw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "7.3.1", "@typescript-eslint/types": "7.4.0",
"@typescript-eslint/visitor-keys": "7.3.1" "@typescript-eslint/visitor-keys": "7.4.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || >=20.0.0" "node": "^18.18.0 || >=20.0.0"
@@ -1040,13 +1040,13 @@
} }
}, },
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "7.3.1", "version": "7.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.3.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.4.0.tgz",
"integrity": "sha512-iFhaysxFsMDQlzJn+vr3OrxN8NmdQkHks4WaqD4QBnt5hsq234wcYdyQ9uquzJJIDAj5W4wQne3yEsYA6OmXGw==", "integrity": "sha512-247ETeHgr9WTRMqHbbQdzwzhuyaJ8dPTuyuUEMANqzMRB1rj/9qFIuIXK7l0FX9i9FXbHeBQl/4uz6mYuCE7Aw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/typescript-estree": "7.3.1", "@typescript-eslint/typescript-estree": "7.4.0",
"@typescript-eslint/utils": "7.3.1", "@typescript-eslint/utils": "7.4.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"ts-api-utils": "^1.0.1" "ts-api-utils": "^1.0.1"
}, },
@@ -1067,9 +1067,9 @@
} }
}, },
"node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/types": {
"version": "7.3.1", "version": "7.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.3.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.4.0.tgz",
"integrity": "sha512-2tUf3uWggBDl4S4183nivWQ2HqceOZh1U4hhu4p1tPiIJoRRXrab7Y+Y0p+dozYwZVvLPRI6r5wKe9kToF9FIw==", "integrity": "sha512-mjQopsbffzJskos5B4HmbsadSJQWaRK0UxqQ7GuNA9Ga4bEKeiO6b2DnB6cM6bpc8lemaPseh0H9B/wyg+J7rw==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^18.18.0 || >=20.0.0" "node": "^18.18.0 || >=20.0.0"
@@ -1080,13 +1080,13 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree": { "node_modules/@typescript-eslint/typescript-estree": {
"version": "7.3.1", "version": "7.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.3.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.4.0.tgz",
"integrity": "sha512-tLpuqM46LVkduWP7JO7yVoWshpJuJzxDOPYIVWUUZbW+4dBpgGeUdl/fQkhuV0A8eGnphYw3pp8d2EnvPOfxmQ==", "integrity": "sha512-A99j5AYoME/UBQ1ucEbbMEmGkN7SE0BvZFreSnTd1luq7yulcHdyGamZKizU7canpGDWGJ+Q6ZA9SyQobipePg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "7.3.1", "@typescript-eslint/types": "7.4.0",
"@typescript-eslint/visitor-keys": "7.3.1", "@typescript-eslint/visitor-keys": "7.4.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"globby": "^11.1.0", "globby": "^11.1.0",
"is-glob": "^4.0.3", "is-glob": "^4.0.3",
@@ -1132,17 +1132,17 @@
} }
}, },
"node_modules/@typescript-eslint/utils": { "node_modules/@typescript-eslint/utils": {
"version": "7.3.1", "version": "7.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.3.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.4.0.tgz",
"integrity": "sha512-jIERm/6bYQ9HkynYlNZvXpzmXWZGhMbrOvq3jJzOSOlKXsVjrrolzWBjDW6/TvT5Q3WqaN4EkmcfdQwi9tDjBQ==", "integrity": "sha512-NQt9QLM4Tt8qrlBVY9lkMYzfYtNz8/6qwZg8pI3cMGlPnj6mOpRxxAm7BMJN9K0AiY+1BwJ5lVC650YJqYOuNg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.4.0", "@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12", "@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0", "@types/semver": "^7.5.0",
"@typescript-eslint/scope-manager": "7.3.1", "@typescript-eslint/scope-manager": "7.4.0",
"@typescript-eslint/types": "7.3.1", "@typescript-eslint/types": "7.4.0",
"@typescript-eslint/typescript-estree": "7.3.1", "@typescript-eslint/typescript-estree": "7.4.0",
"semver": "^7.5.4" "semver": "^7.5.4"
}, },
"engines": { "engines": {
@@ -1157,12 +1157,12 @@
} }
}, },
"node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/visitor-keys": {
"version": "7.3.1", "version": "7.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.3.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.4.0.tgz",
"integrity": "sha512-9RMXwQF8knsZvfv9tdi+4D/j7dMG28X/wMJ8Jj6eOHyHWwDW4ngQJcqEczSsqIKKjFiLFr40Mnr7a5ulDD3vmw==", "integrity": "sha512-0zkC7YM0iX5Y41homUUeW1CHtZR01K3ybjM1l6QczoMuay0XKtrb93kv95AxUGwdjGr64nNqnOCwmEl616N8CA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "7.3.1", "@typescript-eslint/types": "7.4.0",
"eslint-visitor-keys": "^3.4.1" "eslint-visitor-keys": "^3.4.1"
}, },
"engines": { "engines": {

View File

@@ -88,8 +88,6 @@ module.exports = {
'no-shadow': 'off', 'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error', '@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-this-alias': 'error', '@typescript-eslint/no-this-alias': 'error',
'no-throw-literal': 'off',
'@typescript-eslint/no-throw-literal': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error', '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error', '@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error', '@typescript-eslint/no-unnecessary-qualifier': 'error',
@@ -116,6 +114,8 @@ module.exports = {
'@typescript-eslint/no-useless-template-literals': 'error', '@typescript-eslint/no-useless-template-literals': 'error',
'@typescript-eslint/no-var-requires': 'error', '@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/non-nullable-type-assertion-style': 'error', '@typescript-eslint/non-nullable-type-assertion-style': 'error',
'no-throw-literal': 'off',
'@typescript-eslint/only-throw-error': 'error',
'@typescript-eslint/parameter-properties': 'error', '@typescript-eslint/parameter-properties': 'error',
'@typescript-eslint/prefer-as-const': 'error', '@typescript-eslint/prefer-as-const': 'error',
'prefer-destructuring': 'off', 'prefer-destructuring': 'off',

View File

@@ -1 +1 @@
{"version":3,"file":"all.js","sourceRoot":"","sources":["../../src/configs/all.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,K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EAAE,OAAO;QACtD,8CAA8C,EAAE,OAAO;QACvD,0CAA0C,EAAE,OAAO;QACnD,8BAA8B,EAAE,KAAK;QACrC,iDAAiD,EAAE,OAAO;QAC1D,oCAAoC,EAAE,OAAO;QAC7C,oDAAoD,EAAE,OAAO;QAC7D,iDAAiD,EAAE,OAAO;QAC1D,uCAAuC,EAAE,OAAO;QAChD,4CAA4C,EAAE,OAAO;QACrD,mDAAmD,EAAE,OAAO;QAC5D,2CAA2C,EAAE,OAAO;QACpD,2CAA2C,EAAE,OAAO;QACpD,+CAA+C,EAAE,OAAO;QACxD,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,2CAA2C,EAAE,OAAO;QACpD,kDAAkD,EAAE,OAAO;QAC3D,iBAAiB,EAAE,KAAK;QACxB,iCAAiC,EAAE,OAAO;QAC1C,2CAA2C,EAAE,OAAO;QACpD,+CAA+C,EAAE,OAAO;QACxD,gDAAgD,EAAE,OAAO;QACzD,2CAA2C,EAAE,OAAO;QACpD,4BAA4B,EAAE,OAAO;QACrC,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;QAChD,2DAA2D,EAAE,OAAO;KACrE;CAC6B,CAAC"}

View File

@@ -39,6 +39,7 @@ module.exports = {
'@typescript-eslint/no-unsafe-unary-minus': 'off', '@typescript-eslint/no-unsafe-unary-minus': 'off',
'@typescript-eslint/no-useless-template-literals': 'off', '@typescript-eslint/no-useless-template-literals': 'off',
'@typescript-eslint/non-nullable-type-assertion-style': 'off', '@typescript-eslint/non-nullable-type-assertion-style': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/prefer-destructuring': 'off', '@typescript-eslint/prefer-destructuring': 'off',
'@typescript-eslint/prefer-find': 'off', '@typescript-eslint/prefer-find': 'off',
'@typescript-eslint/prefer-includes': 'off', '@typescript-eslint/prefer-includes': 'off',

View File

@@ -1 +1 @@
{"version":3,"file":"disable-type-checked.js","sourceRoot":"","sources":["../../src/configs/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,KAAK;QAC3C,oDAAoD,EAAE,KAAK;QAC3D,iDAAiD,EAAE,KAAK;QACxD,uCAAuC,EAAE,KAAK;QAC9C,4CAA4C,EAAE,KAAK;QACnD,mDAAmD,EAAE,KAAK;QAC1D,2CAA2C,EAAE,KAAK;QAClD,+CAA+C,EAAE,KAAK;QACtD,kCAAkC,EAAE,KAAK;QACzC,2CAA2C,EAAE,KAAK;QAClD,kDAAkD,EAAE,KAAK;QACzD,iCAAiC,EAAE,KAAK;QACxC,+CAA+C,EAAE,KAAK;QACtD,gDAAgD,EAAE,KAAK;QACvD,mCAAmC,EAAE,KAAK;QAC1C,2DAA2D,EAAE,KAAK;KACnE;CAC6B,CAAC"} {"version":3,"file":"disable-type-checked.js","sourceRoot":"","sources":["../../src/configs/disable-type-checked.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,aAAa,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;IAChD,KAAK,EAAE;QACL,mCAAmC,EAAE,KAAK;QAC1C,sCAAsC,EAAE,KAAK;QAC7C,4CAA4C,EAAE,KAAK;QACnD,iCAAiC,EAAE,KAAK;QACxC,sCAAsC,EAAE,KAAK;QAC7C,oCAAoC,EAAE,KAAK;QAC3C,sCAAsC,EAAE,KAAK;QAC7C,iDAAiD,EAAE,KAAK;QACxD,mDAAmD,EAAE,KAAK;QAC1D,yCAAyC,EAAE,KAAK;QAChD,oCAAoC,EAAE,KAAK;QAC3C,oCAAoC,EAAE,KAAK;QAC3C,iDAAiD,EAAE,KAAK;QACxD,wCAAwC,EAAE,KAAK;QAC/C,mCAAmC,EAAE,KAAK;QAC1C,mDAAmD,EAAE,KAAK;QAC1D,qCAAqC,EAAE,KAAK;QAC5C,2DAA2D,EAAE,KAAK;QAClE,6CAA6C,EAAE,KAAK;QACpD,6CAA6C,EAAE,KAAK;QACpD,kDAAkD,EAAE,KAAK;QACzD,kDAAkD,EAAE,KAAK;QACzD,uCAAuC,EAAE,KAAK;QAC9C,yCAAyC,EAAE,KAAK;QAChD,mCAAmC,EAAE,KAAK;QAC1C,8CAA8C,EAAE,KAAK;QACrD,4CAA4C,EAAE,KAAK;QACnD,qCAAqC,EAAE,KAAK;QAC5C,0CAA0C,EAAE,KAAK;QACjD,iDAAiD,EAAE,KAAK;QACxD,sDAAsD,EAAE,KAAK;QAC7D,qCAAqC,EAAE,KAAK;QAC5C,yCAAyC,EAAE,KAAK;QAChD,gCAAgC,EAAE,KAAK;QACvC,oCAAoC,EAAE,KAAK;QAC3C,8CAA8C,EAAE,KAAK;QACrD,0CAA0C,EAAE,KAAK;QACjD,iDAAiD,EAAE,KAAK;QACxD,oCAAoC,EAAE,KAAK;QAC3C,oDAAoD,EAAE,KAAK;QAC3D,iDAAiD,EAAE,KAAK;QACxD,uCAAuC,EAAE,KAAK;QAC9C,4CAA4C,EAAE,KAAK;QACnD,mDAAmD,EAAE,KAAK;QAC1D,2CAA2C,EAAE,KAAK;QAClD,+CAA+C,EAAE,KAAK;QACtD,kCAAkC,EAAE,KAAK;QACzC,2CAA2C,EAAE,KAAK;QAClD,kDAAkD,EAAE,KAAK;QACzD,iCAAiC,EAAE,KAAK;QACxC,+CAA+C,EAAE,KAAK;QACtD,gDAAgD,EAAE,KAAK;QACvD,mCAAmC,EAAE,KAAK;QAC1C,2DAA2D,EAAE,KAAK;KACnE;CAC6B,CAAC"}

View File

@@ -21,8 +21,6 @@ module.exports = {
'@typescript-eslint/no-misused-promises': 'error', '@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-mixed-enums': 'error', '@typescript-eslint/no-mixed-enums': 'error',
'@typescript-eslint/no-redundant-type-constituents': 'error', '@typescript-eslint/no-redundant-type-constituents': 'error',
'no-throw-literal': 'off',
'@typescript-eslint/no-throw-literal': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error', '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error', '@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error', '@typescript-eslint/no-unnecessary-type-arguments': 'error',
@@ -34,6 +32,8 @@ module.exports = {
'@typescript-eslint/no-unsafe-member-access': 'error', '@typescript-eslint/no-unsafe-member-access': 'error',
'@typescript-eslint/no-unsafe-return': 'error', '@typescript-eslint/no-unsafe-return': 'error',
'@typescript-eslint/no-useless-template-literals': 'error', '@typescript-eslint/no-useless-template-literals': 'error',
'no-throw-literal': 'off',
'@typescript-eslint/only-throw-error': 'error',
'@typescript-eslint/prefer-includes': 'error', '@typescript-eslint/prefer-includes': 'error',
'prefer-promise-reject-errors': 'off', 'prefer-promise-reject-errors': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'error', '@typescript-eslint/prefer-promise-reject-errors': 'error',

View File

@@ -1 +1 @@
{"version":3,"file":"strict-type-checked-only.js","sourceRoot":"","sources":["../../src/configs/strict-type-checked-only.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,mCAAmC,EAAE,OAAO;QAC5C,oCAAoC,EAAE,OAAO;QAC7C,sCAAsC,EAAE,OAAO;QAC/C,iDAAiD,EAAE,OAAO;QAC1D,mDAAmD,EAAE,OAAO;QAC5D,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,iBAAiB,EAAE,KAAK;QACxB,oCAAoC,EAAE,OAAO;QAC7C,iDAAiD,EAAE,OAAO;QAC1D,wCAAwC,EAAE,OAAO;QACjD,mCAAmC,EAAE,OAAO;QAC5C,mDAAmD,EAAE,OAAO;QAC5D,kBAAkB,EAAE,KAAK;QACzB,qCAAqC,EAAE,OAAO;QAC9C,2DAA2D,EAAE,OAAO;QACpE,6CAA6C,EAAE,OAAO;QACtD,kDAAkD,EAAE,OAAO;QAC3D,kDAAkD,EAAE,OAAO;QAC3D,uCAAuC,EAAE,OAAO;QAChD,yCAAyC,EAAE,OAAO;QAClD,mCAAmC,EAAE,OAAO;QAC5C,8CAA8C,EAAE,OAAO;QACvD,4CAA4C,EAAE,OAAO;QACrD,qCAAqC,EAAE,OAAO;QAC9C,iDAAiD,EAAE,OAAO;QAC1D,oCAAoC,EAAE,OAAO;QAC7C,8BAA8B,EAAE,KAAK;QACrC,iDAAiD,EAAE,OAAO;QAC1D,iDAAiD,EAAE,OAAO;QAC1D,4CAA4C,EAAE,OAAO;QACrD,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,2CAA2C,EAAE;YAC3C,OAAO;YACP;gBACE,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;gBACnB,YAAY,EAAE,KAAK;gBACnB,oBAAoB,EAAE,KAAK;gBAC3B,WAAW,EAAE,KAAK;aACnB;SACF;QACD,kDAAkD,EAAE;YAClD,OAAO;YACP;gBACE,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;gBACnB,YAAY,EAAE,KAAK;gBACnB,WAAW,EAAE,KAAK;gBAClB,WAAW,EAAE,KAAK;gBAClB,UAAU,EAAE,KAAK;aAClB;SACF;QACD,mCAAmC,EAAE,OAAO;QAC5C,2DAA2D,EAAE,OAAO;KACrE;CAC6B,CAAC"} {"version":3,"file":"strict-type-checked-only.js","sourceRoot":"","sources":["../../src/configs/strict-type-checked-only.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,mCAAmC,EAAE,OAAO;QAC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ClB;SACF;QACD,mCAAmC,EAAE,OAAO;QAC5C,2DAA2D,EAAE,OAAO;KACrE;CAC6B,CAAC"}

View File

@@ -42,8 +42,6 @@ module.exports = {
'@typescript-eslint/no-non-null-assertion': 'error', '@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-redundant-type-constituents': 'error', '@typescript-eslint/no-redundant-type-constituents': 'error',
'@typescript-eslint/no-this-alias': 'error', '@typescript-eslint/no-this-alias': 'error',
'no-throw-literal': 'off',
'@typescript-eslint/no-throw-literal': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error', '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error', '@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error', '@typescript-eslint/no-unnecessary-type-arguments': 'error',
@@ -62,6 +60,8 @@ module.exports = {
'@typescript-eslint/no-useless-constructor': 'error', '@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-useless-template-literals': 'error', '@typescript-eslint/no-useless-template-literals': 'error',
'@typescript-eslint/no-var-requires': 'error', '@typescript-eslint/no-var-requires': 'error',
'no-throw-literal': 'off',
'@typescript-eslint/only-throw-error': 'error',
'@typescript-eslint/prefer-as-const': 'error', '@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-includes': 'error', '@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-literal-enum-member': 'error', '@typescript-eslint/prefer-literal-enum-member': 'error',

View File

@@ -1 +1 @@
{"version":3,"file":"strict-type-checked.js","sourceRoot":"","sources":["../../src/configs/strict-type-checked.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,mCAAmC,EAAE,O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,EAAE,OAAO;QAC9C,gBAAgB,EAAE,KAAK;QACvB,mCAAmC,EAAE,OAAO;QAC5C,wBAAwB,EAAE,KAAK;QAC/B,2CAA2C,EAAE,OAAO;QACpD,iDAAiD,EAAE,OAAO;QAC1D,oCAAoC,EAAE,OAAO;QAC7C,oCAAoC,EAAE,OAAO;QAC7C,oCAAoC,EAAE,OAAO;QAC7C,+CAA+C,EAAE,OAAO;QACxD,8BAA8B,EAAE,KAAK;QACrC,iDAAiD,EAAE,OAAO;QAC1D,iDAAiD,EAAE,OAAO;QAC1D,4CAA4C,EAAE,OAAO;QACrD,2CAA2C,EAAE,OAAO;QACpD,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,2CAA2C,EAAE;YAC3C,OAAO;YACP;gBACE,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;gBACnB,YAAY,EAAE,KAAK;gBACnB,oBAAoB,EAAE,KAAK;gBAC3B,WAAW,EAAE,KAAK;aACnB;SACF;QACD,kDAAkD,EAAE;YAClD,OAAO;YACP;gBACE,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;gBACnB,YAAY,EAAE,KAAK;gBACnB,WAAW,EAAE,KAAK;gBAClB,WAAW,EAAE,KAAK;gBAClB,UAAU,EAAE,KAAK;aAClB;SACF;QACD,2CAA2C,EAAE,OAAO;QACpD,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;QAChD,2DAA2D,EAAE,OAAO;KACrE;CAC6B,CAAC"} {"version":3,"file":"strict-type-checked.js","sourceRoot":"","sources":["../../src/configs/strict-type-checked.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,mCAAmC,EAAE,OAAO;QAC5C,mCAAmC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,wBAAwB,EAAE,KAAK;QAC/B,2CAA2C,EAAE,OAAO;QACpD,iDAAiD,EAAE,OAAO;QAC1D,oCAAoC,EAAE,OAAO;QAC7C,kBAAkB,EAAE,KAAK;QACzB,qCAAqC,EAAE,OAAO;QAC9C,oCAAoC,EAAE,OAAO;QAC7C,oCAAoC,EAAE,OAAO;QAC7C,+CAA+C,EAAE,OAAO;QACxD,8BAA8B,EAAE,KAAK;QACrC,iDAAiD,EAAE,OAAO;QAC1D,iDAAiD,EAAE,OAAO;QAC1D,4CAA4C,EAAE,OAAO;QACrD,2CAA2C,EAAE,OAAO;QACpD,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,2CAA2C,EAAE;YAC3C,OAAO;YACP;gBACE,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;gBACnB,YAAY,EAAE,KAAK;gBACnB,oBAAoB,EAAE,KAAK;gBAC3B,WAAW,EAAE,KAAK;aACnB;SACF;QACD,kDAAkD,EAAE;YAClD,OAAO;YACP;gBACE,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;gBACnB,YAAY,EAAE,KAAK;gBACnB,WAAW,EAAE,KAAK;gBAClB,WAAW,EAAE,KAAK;gBAClB,UAAU,EAAE,KAAK;aAClB;SACF;QACD,2CAA2C,EAAE,OAAO;QACpD,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;QAChD,2DAA2D,EAAE,OAAO;KACrE;CAC6B,CAAC"}

View File

@@ -11,11 +11,8 @@ exports.default = (0, util_1.createRule)({
}, },
messages: { messages: {
typeOverValue: 'All imports in the declaration are only used as types. Use `import type`.', typeOverValue: 'All imports in the declaration are only used as types. Use `import type`.',
someImportsAreOnlyTypes: 'Imports {{typeImports}} are only used as types.', someImportsAreOnlyTypes: 'Imports {{typeImports}} are only used as type.',
aImportIsOnlyTypes: 'Import {{typeImports}} is only used as types.', avoidImportType: 'Use an `import` instead of an `import type`.',
someImportsInDecoMeta: 'Type imports {{typeImports}} are used by decorator metadata.',
aImportInDecoMeta: 'Type import {{typeImports}} is used by decorator metadata.',
valueOverType: 'Use an `import` instead of an `import type`.',
noImportTypeAnnotations: '`import()` type annotations are forbidden.', noImportTypeAnnotations: '`import()` type annotations are forbidden.',
}, },
schema: [ schema: [
@@ -41,252 +38,273 @@ exports.default = (0, util_1.createRule)({
}, },
defaultOptions: [ defaultOptions: [
{ {
prefer: 'type-imports',
disallowTypeAnnotations: true, disallowTypeAnnotations: true,
fixStyle: 'separate-type-imports', fixStyle: 'separate-type-imports',
prefer: 'type-imports',
}, },
], ],
create(context, [option]) { create(context, [option]) {
const prefer = option.prefer ?? 'type-imports'; const prefer = option.prefer ?? 'type-imports';
const disallowTypeAnnotations = option.disallowTypeAnnotations !== false; const disallowTypeAnnotations = option.disallowTypeAnnotations !== false;
const selectors = {};
if (disallowTypeAnnotations) {
selectors.TSImportType = (node) => {
context.report({
node,
messageId: 'noImportTypeAnnotations',
});
};
}
if (prefer === 'no-type-imports') {
return {
...selectors,
'ImportDeclaration[importKind = "type"]'(node) {
context.report({
node,
messageId: 'avoidImportType',
fix(fixer) {
return fixRemoveTypeSpecifierFromImportDeclaration(fixer, node);
},
});
},
'ImportSpecifier[importKind = "type"]'(node) {
context.report({
node,
messageId: 'avoidImportType',
fix(fixer) {
return fixRemoveTypeSpecifierFromImportSpecifier(fixer, node);
},
});
},
};
}
// prefer type imports
const fixStyle = option.fixStyle ?? 'separate-type-imports'; const fixStyle = option.fixStyle ?? 'separate-type-imports';
let hasDecoratorMetadata = false;
const sourceImportsMap = {}; const sourceImportsMap = {};
const emitDecoratorMetadata = (0, util_1.getParserServices)(context, true).emitDecoratorMetadata ?? false;
const experimentalDecorators = (0, util_1.getParserServices)(context, true).experimentalDecorators ?? false;
if (experimentalDecorators && emitDecoratorMetadata) {
selectors.Decorator = () => {
hasDecoratorMetadata = true;
};
}
return { return {
...(prefer === 'type-imports' ...selectors,
? { ImportDeclaration(node) {
// prefer type imports const source = node.source.value;
ImportDeclaration(node) { // sourceImports is the object containing all the specifics for a particular import source, type or value
const source = node.source.value; sourceImportsMap[source] ??= {
// sourceImports is the object containing all the specifics for a particular import source, type or value source,
sourceImportsMap[source] ??= { reportValueImports: [], // if there is a mismatch where type importKind but value specifiers
source, typeOnlyNamedImport: null, // if only type imports
reportValueImports: [], // if there is a mismatch where type importKind but value specifiers valueOnlyNamedImport: null, // if only value imports with named specifiers
typeOnlyNamedImport: null, // if only type imports valueImport: null, // if only value imports
valueOnlyNamedImport: null, // if only value imports with named specifiers };
valueImport: null, // if only value imports const sourceImports = sourceImportsMap[source];
}; if (node.importKind === 'type') {
const sourceImports = sourceImportsMap[source]; if (!sourceImports.typeOnlyNamedImport &&
if (node.importKind === 'type') { node.specifiers.every(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier)) {
if (!sourceImports.typeOnlyNamedImport && // definitely import type { TypeX }
node.specifiers.every(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier)) { sourceImports.typeOnlyNamedImport = node;
// definitely import type { TypeX } }
sourceImports.typeOnlyNamedImport = node; }
else {
if (!sourceImports.valueOnlyNamedImport &&
node.specifiers.length &&
node.specifiers.every(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier)) {
sourceImports.valueOnlyNamedImport = node;
sourceImports.valueImport = node;
}
else if (!sourceImports.valueImport &&
node.specifiers.some(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportDefaultSpecifier)) {
sourceImports.valueImport = node;
}
}
const typeSpecifiers = [];
const inlineTypeSpecifiers = [];
const valueSpecifiers = [];
const unusedSpecifiers = [];
for (const specifier of node.specifiers) {
if (specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier &&
specifier.importKind === 'type') {
inlineTypeSpecifiers.push(specifier);
continue;
}
const [variable] = context.sourceCode.getDeclaredVariables(specifier);
if (variable.references.length === 0) {
unusedSpecifiers.push(specifier);
}
else {
const onlyHasTypeReferences = variable.references.every(ref => {
/**
* keep origin import kind when export
* export { Type }
* export default Type;
* export = Type;
*/
if (ref.identifier.parent.type === utils_1.AST_NODE_TYPES.ExportSpecifier ||
ref.identifier.parent.type ===
utils_1.AST_NODE_TYPES.ExportDefaultDeclaration ||
ref.identifier.parent.type === utils_1.AST_NODE_TYPES.TSExportAssignment) {
if (ref.isValueReference && ref.isTypeReference) {
return node.importKind === 'type';
}
}
if (ref.isValueReference) {
let parent = ref.identifier.parent;
let child = ref.identifier;
while (parent) {
switch (parent.type) {
// CASE 1:
// `type T = typeof foo` will create a value reference because "foo" must be a value type
// however this value reference is safe to use with type-only imports
case utils_1.AST_NODE_TYPES.TSTypeQuery:
return true;
case utils_1.AST_NODE_TYPES.TSQualifiedName:
// TSTypeQuery must have a TSESTree.EntityName as its child, so we can filter here and break early
if (parent.left !== child) {
return false;
}
child = parent;
parent = parent.parent;
continue;
// END CASE 1
//////////////
// CASE 2:
// `type T = { [foo]: string }` will create a value reference because "foo" must be a value type
// however this value reference is safe to use with type-only imports.
// Also this is represented as a non-type AST - hence it uses MemberExpression
case utils_1.AST_NODE_TYPES.TSPropertySignature:
return parent.key === child;
case utils_1.AST_NODE_TYPES.MemberExpression:
if (parent.object !== child) {
return false;
}
child = parent;
parent = parent.parent;
continue;
// END CASE 2
default:
return false;
}
}
}
return ref.isTypeReference;
});
if (onlyHasTypeReferences) {
typeSpecifiers.push(specifier);
}
else {
valueSpecifiers.push(specifier);
}
}
}
if (node.importKind === 'value' && typeSpecifiers.length) {
sourceImports.reportValueImports.push({
node,
typeSpecifiers,
valueSpecifiers,
unusedSpecifiers,
inlineTypeSpecifiers,
});
}
},
'Program:exit'() {
if (hasDecoratorMetadata) {
// Experimental decorator metadata is bowl of poop that cannot be
// supported based on pure syntactic analysis.
//
// So we can do one of two things:
// 1) add type-information to the rule in a breaking change and
// prevent users from using it so that we can fully support this
// case.
// 2) make the rule ignore all imports that are used in a file that
// might have decorator metadata.
//
// (1) is has huge impact and prevents the rule from being used by 99%
// of users Frankly - it's a straight-up bad option. So instead we
// choose with option (2) and just avoid reporting on any imports in a
// file with both emitDecoratorMetadata AND decorators
//
// For more context see the discussion in this issue and its linked
// issues:
// https://github.com/typescript-eslint/typescript-eslint/issues/5468
//
//
// NOTE - in TS 5.0 `experimentalDecorators` became the legacy option,
// replaced with un-flagged, stable decorators and thus the type-aware
// emitDecoratorMetadata implementation also became legacy. in TS 5.2
// support for the new, stable decorator metadata proposal was added -
// however this proposal does not include type information
//
//
// PHEW. So TL;DR what does all this mean?
// - if you use experimentalDecorators:true,
// emitDecoratorMetadata:true, and have a decorator in the file -
// the rule will do nothing in the file out of an abundance of
// caution.
// - else the rule will work as normal.
return;
}
for (const sourceImports of Object.values(sourceImportsMap)) {
if (sourceImports.reportValueImports.length === 0) {
// nothing to fix. value specifiers and type specifiers are correctly written
continue;
}
for (const report of sourceImports.reportValueImports) {
if (report.valueSpecifiers.length === 0 &&
report.unusedSpecifiers.length === 0 &&
report.node.importKind !== 'type') {
/**
* checks if import has type assertions
* ```
* import * as type from 'mod' assert { type: 'json' };
* ```
* https://github.com/typescript-eslint/typescript-eslint/issues/7527
*/
if (report.node.attributes.length === 0) {
context.report({
node: report.node,
messageId: 'typeOverValue',
*fix(fixer) {
yield* fixToTypeImportDeclaration(fixer, report, sourceImports);
},
});
} }
} }
else { else {
if (!sourceImports.valueOnlyNamedImport && // we have a mixed type/value import or just value imports, so we need to split them out into multiple imports if separate-type-imports is configured
node.specifiers.length && const importNames = report.typeSpecifiers.map(specifier => `"${specifier.local.name}"`);
node.specifiers.every(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier)) { const message = (() => {
sourceImports.valueOnlyNamedImport = node; const typeImports = (0, util_1.formatWordList)(importNames);
sourceImports.valueImport = node; if (importNames.length === 1) {
} return {
else if (!sourceImports.valueImport && messageId: 'someImportsAreOnlyTypes',
node.specifiers.some(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportDefaultSpecifier)) { data: {
sourceImports.valueImport = node; typeImports,
} },
} };
const typeSpecifiers = [];
const inlineTypeSpecifiers = [];
const valueSpecifiers = [];
const unusedSpecifiers = [];
for (const specifier of node.specifiers) {
if (specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier &&
specifier.importKind === 'type') {
inlineTypeSpecifiers.push(specifier);
continue;
}
const [variable] = context.sourceCode.getDeclaredVariables(specifier);
if (variable.references.length === 0) {
unusedSpecifiers.push(specifier);
}
else {
const onlyHasTypeReferences = variable.references.every(ref => {
/**
* keep origin import kind when export
* export { Type }
* export default Type;
* export = Type;
*/
if (ref.identifier.parent.type ===
utils_1.AST_NODE_TYPES.ExportSpecifier ||
ref.identifier.parent.type ===
utils_1.AST_NODE_TYPES.ExportDefaultDeclaration ||
ref.identifier.parent.type ===
utils_1.AST_NODE_TYPES.TSExportAssignment) {
if (ref.isValueReference && ref.isTypeReference) {
return node.importKind === 'type';
}
}
if (ref.isValueReference) {
let parent = ref.identifier.parent;
let child = ref.identifier;
while (parent) {
switch (parent.type) {
// CASE 1:
// `type T = typeof foo` will create a value reference because "foo" must be a value type
// however this value reference is safe to use with type-only imports
case utils_1.AST_NODE_TYPES.TSTypeQuery:
return true;
case utils_1.AST_NODE_TYPES.TSQualifiedName:
// TSTypeQuery must have a TSESTree.EntityName as its child, so we can filter here and break early
if (parent.left !== child) {
return false;
}
child = parent;
parent = parent.parent;
continue;
// END CASE 1
//////////////
// CASE 2:
// `type T = { [foo]: string }` will create a value reference because "foo" must be a value type
// however this value reference is safe to use with type-only imports.
// Also this is represented as a non-type AST - hence it uses MemberExpression
case utils_1.AST_NODE_TYPES.TSPropertySignature:
return parent.key === child;
case utils_1.AST_NODE_TYPES.MemberExpression:
if (parent.object !== child) {
return false;
}
child = parent;
parent = parent.parent;
continue;
// END CASE 2
default:
return false;
}
}
}
return ref.isTypeReference;
});
if (onlyHasTypeReferences) {
typeSpecifiers.push(specifier);
} }
else { return {
valueSpecifiers.push(specifier); messageId: 'someImportsAreOnlyTypes',
} data: {
} typeImports,
} },
if ((node.importKind === 'value' && typeSpecifiers.length) || };
(node.importKind === 'type' && valueSpecifiers.length)) { })();
sourceImports.reportValueImports.push({ context.report({
node, node: report.node,
typeSpecifiers, ...message,
valueSpecifiers, *fix(fixer) {
unusedSpecifiers, // take all the typeSpecifiers and put them on a new line
inlineTypeSpecifiers, yield* fixToTypeImportDeclaration(fixer, report, sourceImports);
},
}); });
} }
}, }
'Program:exit'() {
for (const sourceImports of Object.values(sourceImportsMap)) {
if (sourceImports.reportValueImports.length === 0) {
// nothing to fix. value specifiers and type specifiers are correctly written
continue;
}
for (const report of sourceImports.reportValueImports) {
if (report.valueSpecifiers.length === 0 &&
report.unusedSpecifiers.length === 0 &&
report.node.importKind !== 'type') {
/**
* checks if import has type assertions
* ```
* import * as type from 'mod' assert { type: 'json' };
* ```
* https://github.com/typescript-eslint/typescript-eslint/issues/7527
*/
if (report.node.attributes.length === 0) {
context.report({
node: report.node,
messageId: 'typeOverValue',
*fix(fixer) {
yield* fixToTypeImportDeclaration(fixer, report, sourceImports);
},
});
}
}
else {
const isTypeImport = report.node.importKind === 'type';
// we have a mixed type/value import or just value imports, so we need to split them out into multiple imports if separate-type-imports is configured
const importNames = (isTypeImport
? report.valueSpecifiers // import type { A } from 'roo'; // WHERE A is used in value position
: report.typeSpecifiers) // import { A, B } from 'roo'; // WHERE A is used in type position and B is in value position
.map(specifier => `"${specifier.local.name}"`);
const message = (() => {
const typeImports = (0, util_1.formatWordList)(importNames);
if (importNames.length === 1) {
if (isTypeImport) {
return {
messageId: 'aImportInDecoMeta',
data: { typeImports },
};
}
return {
messageId: 'aImportIsOnlyTypes',
data: { typeImports },
};
}
if (isTypeImport) {
return {
messageId: 'someImportsInDecoMeta',
data: { typeImports }, // typeImports are all the value specifiers that are in the type position
};
}
return {
messageId: 'someImportsAreOnlyTypes',
data: { typeImports }, // typeImports are all the type specifiers in the value position
};
})();
context.report({
node: report.node,
...message,
*fix(fixer) {
if (isTypeImport) {
// take all the valueSpecifiers and put them on a new line
yield* fixToValueImportDeclaration(fixer, report, sourceImports);
}
else {
// take all the typeSpecifiers and put them on a new line
yield* fixToTypeImportDeclaration(fixer, report, sourceImports);
}
},
});
}
}
}
},
} }
: { },
// prefer no type imports
'ImportDeclaration[importKind = "type"]'(node) {
context.report({
node,
messageId: 'valueOverType',
fix(fixer) {
return fixRemoveTypeSpecifierFromImportDeclaration(fixer, node);
},
});
},
'ImportSpecifier[importKind = "type"]'(node) {
context.report({
node,
messageId: 'valueOverType',
fix(fixer) {
return fixRemoveTypeSpecifierFromImportSpecifier(fixer, node);
},
});
},
}),
...(disallowTypeAnnotations
? {
// disallow `import()` type
TSImportType(node) {
context.report({
node,
messageId: 'noImportTypeAnnotations',
});
},
}
: {}),
}; };
function classifySpecifier(node) { function classifySpecifier(node) {
const defaultSpecifier = node.specifiers[0].type === utils_1.AST_NODE_TYPES.ImportDefaultSpecifier const defaultSpecifier = node.specifiers[0].type === utils_1.AST_NODE_TYPES.ImportDefaultSpecifier
@@ -568,54 +586,6 @@ exports.default = (0, util_1.createRule)({
} }
} }
} }
function* fixToValueImportDeclaration(fixer, report, sourceImports) {
const { node } = report;
const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = classifySpecifier(node);
if (namespaceSpecifier) {
// import type * as types from 'foo'
yield* fixRemoveTypeSpecifierFromImportDeclaration(fixer, node);
return;
}
else if (defaultSpecifier) {
if (report.valueSpecifiers.includes(defaultSpecifier) &&
namedSpecifiers.length === 0) {
// import type Type from 'foo'
yield* fixRemoveTypeSpecifierFromImportDeclaration(fixer, node);
return;
}
}
else {
if (namedSpecifiers.every(specifier => report.valueSpecifiers.includes(specifier))) {
// import type {Type1, Type2} from 'foo'
yield* fixRemoveTypeSpecifierFromImportDeclaration(fixer, node);
return;
}
}
// we have some valueSpecifiers intermixed in types that need to be put on their own line
// import type { Type1, A } from 'foo'
// import type { A } from 'foo'
const valueNamedSpecifiers = namedSpecifiers.filter(specifier => report.valueSpecifiers.includes(specifier));
const fixesNamedSpecifiers = getFixesNamedSpecifiers(fixer, node, valueNamedSpecifiers, namedSpecifiers);
const afterFixes = [];
if (valueNamedSpecifiers.length) {
if (sourceImports.valueOnlyNamedImport) {
const insertTypeNamedSpecifiers = fixInsertNamedSpecifiersInNamedSpecifierList(fixer, sourceImports.valueOnlyNamedImport, fixesNamedSpecifiers.typeNamedSpecifiersText);
if (sourceImports.valueOnlyNamedImport.range[1] <= node.range[0]) {
yield insertTypeNamedSpecifiers;
}
else {
afterFixes.push(insertTypeNamedSpecifiers);
}
}
else {
// some are types.
// Add new value import and later remove those value specifiers from import type
yield fixer.insertTextBefore(node, `import {${fixesNamedSpecifiers.typeNamedSpecifiersText}} from ${context.sourceCode.getText(node.source)};\n`);
}
}
yield* fixesNamedSpecifiers.removeTypeNamedSpecifiers;
yield* afterFixes;
}
function* fixRemoveTypeSpecifierFromImportDeclaration(fixer, node) { function* fixRemoveTypeSpecifierFromImportDeclaration(fixer, node) {
// import type Foo from 'foo' // import type Foo from 'foo'
// ^^^^ remove // ^^^^ remove

Some files were not shown because too many files have changed in this diff Show More