Rename TEST_MODE to specific variable for CodeQL Action

This allows us to set it automatically in the workflow generator,
simplifying things and reducing the scope for error.
This commit is contained in:
Henry Mercer 2022-11-16 16:08:15 +00:00
parent c939e6615d
commit a190d3876a
70 changed files with 51 additions and 245 deletions

View file

@ -35,14 +35,14 @@ runs:
tools: ${{ inputs.tools }} tools: ${{ inputs.tools }}
db-location: ${{ runner.temp }}/query-filter-test db-location: ${{ runner.temp }}/query-filter-test
env: env:
TEST_MODE: "true" CODEQL_ACTION_TEST_MODE: "true"
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
upload: false upload: false
env: env:
TEST_MODE: "true" CODEQL_ACTION_TEST_MODE: "true"
- name: Check SARIF - name: Check SARIF
uses: ./../action/.github/check-sarif uses: ./../action/.github/check-sarif
with: with:

View file

@ -83,8 +83,6 @@ jobs:
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 }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@ -92,7 +90,6 @@ jobs:
with: with:
ref: refs/heads/main ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2 sha: 5e235361806c361d4d3f8859e3c897658025a9a2
env:
TEST_MODE: true
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -46,8 +46,6 @@ jobs:
with: with:
languages: csharp languages: csharp
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/autobuild - uses: ./../action/autobuild
env: env:
# Explicitly disable the CLR tracer. # Explicitly disable the CLR tracer.
@ -58,8 +56,6 @@ jobs:
CORECLR_PROFILER: '' CORECLR_PROFILER: ''
CORECLR_PROFILER_PATH_64: '' CORECLR_PROFILER_PATH_64: ''
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
@ -70,3 +66,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -49,7 +49,6 @@ jobs:
env: env:
CODEQL_FILE_BASELINE_INFORMATION: true CODEQL_FILE_BASELINE_INFORMATION: true
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@ -59,7 +58,6 @@ jobs:
env: env:
CODEQL_FILE_BASELINE_INFORMATION: true CODEQL_FILE_BASELINE_INFORMATION: true
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true
TEST_MODE: true
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
@ -85,3 +83,4 @@ jobs:
done done
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -43,8 +43,6 @@ jobs:
languages: java languages: java
ram: 230 ram: 230
threads: 1 threads: 1
env:
TEST_MODE: true
- name: Assert Results - name: Assert Results
shell: bash shell: bash
run: | run: |
@ -66,3 +64,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -82,14 +82,11 @@ jobs:
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 }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -69,12 +69,8 @@ jobs:
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/autobuild - uses: ./../action/autobuild
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
- shell: bash - shell: bash
run: | run: |
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then
@ -90,3 +86,4 @@ jobs:
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -69,14 +69,10 @@ jobs:
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- 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
@ -94,3 +90,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -69,11 +69,7 @@ jobs:
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
- shell: bash - shell: bash
run: | run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"
@ -84,3 +80,4 @@ jobs:
env: env:
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -54,8 +54,6 @@ jobs:
packages: "*/*" packages: "*/*"
token: "${{ secrets.GITHUB_TOKEN }}" token: "${{ secrets.GITHUB_TOKEN }}"
env:
TEST_MODE: true
- name: Verify packages installed - name: Verify packages installed
shell: bash shell: bash
run: | run: |
@ -79,3 +77,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -52,8 +52,6 @@ jobs:
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 }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
skip-queries: true skip-queries: true
@ -68,3 +66,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -71,15 +71,11 @@ jobs:
queries: security-extended queries: security-extended
source-root: ./../action/tests/ml-powered-queries-repo source-root: ./../action/tests/ml-powered-queries-repo
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
env:
TEST_MODE: true
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@ -138,3 +134,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -69,15 +69,11 @@ jobs:
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 }}
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- shell: bash - shell: bash
run: | run: |
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
@ -112,3 +108,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -60,16 +60,12 @@ jobs:
packs: +dsp-testing/codeql-pack1@1.0.0 packs: +dsp-testing/codeql-pack1@1.0.0
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- name: Check results - name: Check results
uses: ./../action/.github/check-sarif uses: ./../action/.github/check-sarif
@ -96,3 +92,4 @@ jobs:
CODEQL_PASS_CONFIG_TO_CLI: true CODEQL_PASS_CONFIG_TO_CLI: true
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -60,16 +60,12 @@ jobs:
packs: +dsp-testing/codeql-pack1@1.0.0 packs: +dsp-testing/codeql-pack1@1.0.0
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- name: Check results - name: Check results
uses: ./../action/.github/check-sarif uses: ./../action/.github/check-sarif
@ -94,3 +90,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -59,16 +59,12 @@ jobs:
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 }}
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- name: Check results - name: Check results
uses: ./../action/.github/check-sarif uses: ./../action/.github/check-sarif
@ -93,3 +89,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -60,16 +60,12 @@ jobs:
languages: javascript languages: javascript
packs: dsp-testing/codeql-pack1@1.0.0, dsp-testing/codeql-pack2, dsp-testing/codeql-pack3:other-query.ql packs: dsp-testing/codeql-pack1@1.0.0, dsp-testing/codeql-pack2, dsp-testing/codeql-pack3:other-query.ql
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- name: Check results - name: Check results
uses: ./../action/.github/check-sarif uses: ./../action/.github/check-sarif
@ -94,3 +90,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -83,13 +83,10 @@ jobs:
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 }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -58,7 +58,6 @@ jobs:
- uses: ./../action/upload-sarif - uses: ./../action/upload-sarif
with: with:
sarif_file: rubocop.sarif sarif_file: rubocop.sarif
env:
TEST_MODE: true
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -51,12 +51,8 @@ jobs:
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
@ -68,3 +64,4 @@ jobs:
env: env:
CODEQL_ENABLE_EXPERIMENTAL_FEATURES: 'true' CODEQL_ENABLE_EXPERIMENTAL_FEATURES: 'true'
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

5
.github/workflows/__ruby.yml generated vendored
View file

@ -52,12 +52,8 @@ jobs:
with: with:
languages: ruby languages: ruby
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
@ -69,3 +65,4 @@ jobs:
env: env:
CODEQL_ENABLE_EXPERIMENTAL_FEATURES: 'true' CODEQL_ENABLE_EXPERIMENTAL_FEATURES: 'true'
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -54,8 +54,6 @@ jobs:
packs: +dsp-testing/codeql-pack1@1.0.0 packs: +dsp-testing/codeql-pack1@1.0.0
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@ -63,8 +61,6 @@ jobs:
with: with:
skip-queries: true skip-queries: true
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
env:
TEST_MODE: true
- name: Assert No Results - name: Assert No Results
shell: bash shell: bash
@ -77,8 +73,6 @@ jobs:
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
env:
TEST_MODE: true
- name: Assert Results - name: Assert Results
shell: bash shell: bash
run: | run: |
@ -95,3 +89,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -46,13 +46,9 @@ jobs:
with: with:
languages: swift languages: swift
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/autobuild - uses: ./../action/autobuild
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
@ -64,3 +60,4 @@ jobs:
env: env:
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true'
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -52,15 +52,11 @@ jobs:
with: with:
languages: swift languages: swift
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
@ -73,3 +69,4 @@ jobs:
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true'
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false' DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -49,14 +49,10 @@ jobs:
with: with:
languages: java languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/autobuild - uses: ./../action/autobuild
with: with:
working-directory: autobuild-dir working-directory: autobuild-dir
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |
@ -67,3 +63,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -47,13 +47,10 @@ jobs:
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ./codeql-bundle.tar.gz tools: ./codeql-bundle.tar.gz
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

5
.github/workflows/__test-proxy.yml generated vendored
View file

@ -42,14 +42,11 @@ jobs:
with: with:
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
env: env:
https_proxy: http://squid-proxy:3128 https_proxy: http://squid-proxy:3128
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true
container: container:
image: ubuntu:22.04 image: ubuntu:22.04
options: --dns 127.0.0.1 options: --dns 127.0.0.1

View file

@ -57,15 +57,11 @@ jobs:
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 }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: env -i PATH="$PATH" HOME="$HOME" ./build.sh run: env -i PATH="$PATH" HOME="$HOME" ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
env:
TEST_MODE: true
- shell: bash - shell: bash
run: | run: |
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
@ -106,3 +102,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -83,8 +83,6 @@ jobs:
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 }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@ -93,13 +91,10 @@ jobs:
ref: refs/heads/main ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2 sha: 5e235361806c361d4d3f8859e3c897658025a9a2
upload: false upload: false
env:
TEST_MODE: true
- uses: ./../action/upload-sarif - uses: ./../action/upload-sarif
with: with:
ref: refs/heads/main ref: refs/heads/main
sha: 5e235361806c361d4d3f8859e3c897658025a9a2 sha: 5e235361806c361d4d3f8859e3c897658025a9a2
env:
TEST_MODE: true
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -88,8 +88,6 @@ jobs:
languages: csharp,javascript languages: csharp,javascript
source-path: x/y/z/some-path/tests/multi-language-repo source-path: x/y/z/some-path/tests/multi-language-repo
debug: true debug: true
env:
TEST_MODE: true
- name: Build code (non-windows) - name: Build code (non-windows)
shell: bash shell: bash
if: ${{ runner.os != 'Windows' }} if: ${{ runner.os != 'Windows' }}
@ -106,16 +104,12 @@ jobs:
ref: v1.1.0 ref: v1.1.0
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
upload: false upload: false
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- name: Verify SARIF after upload - name: Verify SARIF after upload
shell: bash shell: bash
@ -147,3 +141,4 @@ jobs:
fi fi
env: env:
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
CODEQL_ACTION_TEST_MODE: true

View file

@ -23,6 +23,8 @@ jobs:
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
name: Upload debug artifacts after failure in analyze name: Upload debug artifacts after failure in analyze
continue-on-error: true continue-on-error: true
env:
CODEQL_ACTION_TEST_MODE: true
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
@ -44,8 +46,6 @@ jobs:
debug: true debug: true
debug-artifact-name: my-debug-artifacts debug-artifact-name: my-debug-artifacts
debug-database-name: my-db debug-database-name: my-db
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@ -54,8 +54,6 @@ jobs:
with: with:
expect-error: true expect-error: true
ram: 1 ram: 1
env:
TEST_MODE: true
download-and-check-artifacts: download-and-check-artifacts:
name: Download and check debug artifacts after failure in analyze name: Download and check debug artifacts after failure in analyze
needs: upload-artifacts needs: upload-artifacts

View file

@ -45,6 +45,8 @@ jobs:
- os: macos-latest - os: macos-latest
version: nightly-latest version: nightly-latest
name: Upload debug artifacts name: Upload debug artifacts
env:
CODEQL_ACTION_TEST_MODE: true
timeout-minutes: 45 timeout-minutes: 45
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
@ -64,15 +66,11 @@ jobs:
debug: true debug: true
debug-artifact-name: my-debug-artifacts debug-artifact-name: my-debug-artifacts
debug-database-name: my-db debug-database-name: my-db
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
download-and-check-artifacts: download-and-check-artifacts:
name: Download and check debug artifacts name: Download and check debug artifacts
needs: upload-artifacts needs: upload-artifacts

View file

@ -17,6 +17,8 @@ on:
jobs: jobs:
expected-queries: expected-queries:
name: Expected Queries Tests name: Expected Queries Tests
env:
CODEQL_ACTION_TEST_MODE: true
timeout-minutes: 45 timeout-minutes: 45
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -31,15 +33,11 @@ jobs:
with: with:
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: ${{ runner.temp }}/results output: ${{ runner.temp }}/results
upload-database: false upload-database: false
upload: false upload: false
env:
TEST_MODE: true
- name: Check Sarif - name: Check Sarif
uses: ./../action/.github/check-sarif uses: ./../action/.github/check-sarif

View file

@ -148,6 +148,7 @@ jobs:
python_deps_type: pipenv python_deps_type: pipenv
env: env:
CODEQL_ACTION_TEST_MODE: true
PYTHON_DEPS_TYPE: ${{ matrix.python_deps_type }} PYTHON_DEPS_TYPE: ${{ matrix.python_deps_type }}
PYTHON_VERSION: ${{ matrix.python_version }} PYTHON_VERSION: ${{ matrix.python_version }}
@ -165,8 +166,6 @@ jobs:
tools: latest tools: latest
languages: python languages: python
setup-python-dependencies: false setup-python-dependencies: false
env:
TEST_MODE: true
- name: Test Auto Package Installation - name: Test Auto Package Installation
run: | run: |

View file

@ -1,6 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.CODEQL_ACTION_TESTING_ENVIRONMENT = exports.CODEQL_WORKFLOW_STARTED_AT = exports.ODASA_TRACER_CONFIGURATION = void 0; exports.CODEQL_ACTION_TEST_MODE = exports.CODEQL_ACTION_TESTING_ENVIRONMENT = exports.CODEQL_WORKFLOW_STARTED_AT = exports.ODASA_TRACER_CONFIGURATION = void 0;
exports.ODASA_TRACER_CONFIGURATION = "ODASA_TRACER_CONFIGURATION"; exports.ODASA_TRACER_CONFIGURATION = "ODASA_TRACER_CONFIGURATION";
// The time at which the first action (normally init) started executing. // The time at which the first action (normally init) started executing.
// If a workflow invokes a different action without first invoking the init // If a workflow invokes a different action without first invoking the init
@ -9,4 +9,6 @@ exports.ODASA_TRACER_CONFIGURATION = "ODASA_TRACER_CONFIGURATION";
// rather that the init action. // rather that the init action.
exports.CODEQL_WORKFLOW_STARTED_AT = "CODEQL_WORKFLOW_STARTED_AT"; exports.CODEQL_WORKFLOW_STARTED_AT = "CODEQL_WORKFLOW_STARTED_AT";
exports.CODEQL_ACTION_TESTING_ENVIRONMENT = "CODEQL_ACTION_TESTING_ENVIRONMENT"; exports.CODEQL_ACTION_TESTING_ENVIRONMENT = "CODEQL_ACTION_TESTING_ENVIRONMENT";
/** Used to disable uploading SARIF results or status reports to the GitHub API */
exports.CODEQL_ACTION_TEST_MODE = "CODEQL_ACTION_TEST_MODE";
//# sourceMappingURL=shared-environment.js.map //# sourceMappingURL=shared-environment.js.map

View file

@ -1 +1 @@
{"version":3,"file":"shared-environment.js","sourceRoot":"","sources":["../src/shared-environment.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AACvE,wEAAwE;AACxE,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,+BAA+B;AAClB,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAE1D,QAAA,iCAAiC,GAC5C,mCAAmC,CAAC"} {"version":3,"file":"shared-environment.js","sourceRoot":"","sources":["../src/shared-environment.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AACvE,wEAAwE;AACxE,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,+BAA+B;AAClB,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAE1D,QAAA,iCAAiC,GAC5C,mCAAmC,CAAC;AAEtC,kFAAkF;AACrE,QAAA,uBAAuB,GAAG,yBAAyB,CAAC"}

3
lib/util.js generated
View file

@ -37,6 +37,7 @@ const apiCompatibility = __importStar(require("./api-compatibility.json"));
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
const config_utils_1 = require("./config-utils"); const config_utils_1 = require("./config-utils");
const feature_flags_1 = require("./feature-flags"); const feature_flags_1 = require("./feature-flags");
const shared_environment_1 = require("./shared-environment");
/** /**
* Specifies bundle versions that are known to be broken * Specifies bundle versions that are known to be broken
* and will not be used if found in the toolcache. * and will not be used if found in the toolcache.
@ -557,7 +558,7 @@ exports.checkActionVersion = checkActionVersion;
* In test mode, we don't upload SARIF results or status reports to the GitHub API. * In test mode, we don't upload SARIF results or status reports to the GitHub API.
*/ */
function isInTestMode() { function isInTestMode() {
return process.env["TEST_MODE"] === "true"; return process.env[shared_environment_1.CODEQL_ACTION_TEST_MODE] === "true";
} }
exports.isInTestMode = isInTestMode; exports.isInTestMode = isInTestMode;
/** /**

File diff suppressed because one or more lines are too long

View file

@ -6,8 +6,6 @@ steps:
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@${{ github.sha }} config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ github.sha }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@ -15,5 +13,3 @@ steps:
with: with:
ref: 'refs/heads/main' ref: 'refs/heads/main'
sha: '5e235361806c361d4d3f8859e3c897658025a9a2' sha: '5e235361806c361d4d3f8859e3c897658025a9a2'
env:
TEST_MODE: true

View file

@ -6,8 +6,6 @@ steps:
with: with:
languages: csharp languages: csharp
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/autobuild - uses: ./../action/autobuild
env: env:
# Explicitly disable the CLR tracer. # Explicitly disable the CLR tracer.
@ -18,8 +16,6 @@ steps:
CORECLR_PROFILER: "" CORECLR_PROFILER: ""
CORECLR_PROFILER_PATH_64: "" CORECLR_PROFILER_PATH_64: ""
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |

View file

@ -9,7 +9,6 @@ steps:
env: env:
CODEQL_FILE_BASELINE_INFORMATION: true CODEQL_FILE_BASELINE_INFORMATION: true
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@ -19,7 +18,6 @@ steps:
env: env:
CODEQL_FILE_BASELINE_INFORMATION: true CODEQL_FILE_BASELINE_INFORMATION: true
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true
TEST_MODE: true
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:

View file

@ -8,8 +8,6 @@ steps:
languages: java languages: java
ram: 230 ram: 230
threads: 1 threads: 1
env:
TEST_MODE: true
- name: Assert Results - name: Assert Results
shell: bash shell: bash
run: | run: |

View file

@ -8,11 +8,7 @@ steps:
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 }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true

View file

@ -8,12 +8,8 @@ steps:
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/autobuild - uses: ./../action/autobuild
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
- shell: bash - shell: bash
run: | run: |
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then

View file

@ -6,14 +6,10 @@ steps:
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- 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

View file

@ -8,11 +8,7 @@ steps:
with: with:
languages: go languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
- shell: bash - shell: bash
run: | run: |
cd "$RUNNER_TEMP/codeql_databases" cd "$RUNNER_TEMP/codeql_databases"

View file

@ -19,8 +19,6 @@ steps:
packages: "*/*" packages: "*/*"
token: "${{ secrets.GITHUB_TOKEN }}" token: "${{ secrets.GITHUB_TOKEN }}"
env:
TEST_MODE: true
- name: Verify packages installed - name: Verify packages installed
shell: bash shell: bash
run: | run: |

View file

@ -13,8 +13,6 @@ steps:
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 }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
skip-queries: true skip-queries: true

View file

@ -14,15 +14,11 @@ steps:
queries: security-extended queries: security-extended
source-root: ./../action/tests/ml-powered-queries-repo source-root: ./../action/tests/ml-powered-queries-repo
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
with: with:
output: "${{ runner.temp }}/results" output: "${{ runner.temp }}/results"
upload-database: false upload-database: false
env:
TEST_MODE: true
- name: Upload SARIF - name: Upload SARIF
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View file

@ -6,15 +6,11 @@ steps:
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 }}
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- shell: bash - shell: bash
run: | run: |
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}

View file

@ -12,16 +12,12 @@ steps:
packs: +dsp-testing/codeql-pack1@1.0.0 packs: +dsp-testing/codeql-pack1@1.0.0
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- 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"
env:
TEST_MODE: true
- name: Check results - name: Check results
uses: ./../action/.github/check-sarif uses: ./../action/.github/check-sarif

View file

@ -8,16 +8,12 @@ steps:
packs: +dsp-testing/codeql-pack1@1.0.0 packs: +dsp-testing/codeql-pack1@1.0.0
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- 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"
env:
TEST_MODE: true
- name: Check results - name: Check results
uses: ./../action/.github/check-sarif uses: ./../action/.github/check-sarif

View file

@ -7,16 +7,12 @@ steps:
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 }}
env:
TEST_MODE: true
- 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"
env:
TEST_MODE: true
- name: Check results - name: Check results
uses: ./../action/.github/check-sarif uses: ./../action/.github/check-sarif

View file

@ -8,16 +8,12 @@ steps:
languages: javascript languages: javascript
packs: dsp-testing/codeql-pack1@1.0.0, dsp-testing/codeql-pack2, dsp-testing/codeql-pack3:other-query.ql packs: dsp-testing/codeql-pack1@1.0.0, dsp-testing/codeql-pack2, dsp-testing/codeql-pack3:other-query.ql
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- 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"
env:
TEST_MODE: true
- name: Check results - name: Check results
uses: ./../action/.github/check-sarif uses: ./../action/.github/check-sarif

View file

@ -6,11 +6,7 @@ steps:
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@${{ github.sha }} config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ github.sha }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true

View file

@ -24,5 +24,3 @@ steps:
- uses: ./../action/upload-sarif - uses: ./../action/upload-sarif
with: with:
sarif_file: rubocop.sarif sarif_file: rubocop.sarif
env:
TEST_MODE: true

View file

@ -10,12 +10,8 @@ steps:
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |

View file

@ -9,12 +9,8 @@ steps:
with: with:
languages: ruby languages: ruby
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |

View file

@ -9,8 +9,6 @@ steps:
packs: +dsp-testing/codeql-pack1@1.0.0 packs: +dsp-testing/codeql-pack1@1.0.0
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@ -18,8 +16,6 @@ steps:
with: with:
skip-queries: true skip-queries: true
output: "${{ runner.temp }}/results" output: "${{ runner.temp }}/results"
env:
TEST_MODE: true
- name: Assert No Results - name: Assert No Results
shell: bash shell: bash
@ -32,8 +28,6 @@ steps:
with: with:
output: "${{ runner.temp }}/results" output: "${{ runner.temp }}/results"
upload-database: false upload-database: false
env:
TEST_MODE: true
- name: Assert Results - name: Assert Results
shell: bash shell: bash
run: | run: |

View file

@ -10,13 +10,9 @@ steps:
with: with:
languages: swift languages: swift
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/autobuild - uses: ./../action/autobuild
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |

View file

@ -10,15 +10,11 @@ steps:
with: with:
languages: swift languages: swift
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |

View file

@ -14,14 +14,10 @@ steps:
with: with:
languages: java languages: java
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/autobuild - uses: ./../action/autobuild
with: with:
working-directory: autobuild-dir working-directory: autobuild-dir
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true
- name: Check database - name: Check database
shell: bash shell: bash
run: | run: |

View file

@ -12,11 +12,7 @@ steps:
- uses: ./../action/init - uses: ./../action/init
with: with:
tools: ./codeql-bundle.tar.gz tools: ./codeql-bundle.tar.gz
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true

View file

@ -17,8 +17,4 @@ steps:
with: with:
languages: javascript languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }} tools: ${{ steps.prepare-test.outputs.tools-url }}
env:
TEST_MODE: true
- uses: ./../action/analyze - uses: ./../action/analyze
env:
TEST_MODE: true

View file

@ -6,15 +6,11 @@ steps:
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 }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: env -i PATH="$PATH" HOME="$HOME" ./build.sh run: env -i PATH="$PATH" HOME="$HOME" ./build.sh
- uses: ./../action/analyze - uses: ./../action/analyze
id: analysis id: analysis
env:
TEST_MODE: true
- shell: bash - shell: bash
run: | run: |
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"

View file

@ -6,8 +6,6 @@ steps:
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@${{ github.sha }} config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ github.sha }}
env:
TEST_MODE: true
- name: Build code - name: Build code
shell: bash shell: bash
run: ./build.sh run: ./build.sh
@ -16,11 +14,7 @@ steps:
ref: 'refs/heads/main' ref: 'refs/heads/main'
sha: '5e235361806c361d4d3f8859e3c897658025a9a2' sha: '5e235361806c361d4d3f8859e3c897658025a9a2'
upload: false upload: false
env:
TEST_MODE: true
- uses: ./../action/upload-sarif - uses: ./../action/upload-sarif
with: with:
ref: 'refs/heads/main' ref: 'refs/heads/main'
sha: '5e235361806c361d4d3f8859e3c897658025a9a2' sha: '5e235361806c361d4d3f8859e3c897658025a9a2'
env:
TEST_MODE: true

View file

@ -14,8 +14,6 @@ steps:
languages: csharp,javascript languages: csharp,javascript
source-path: x/y/z/some-path/tests/multi-language-repo source-path: x/y/z/some-path/tests/multi-language-repo
debug: true debug: true
env:
TEST_MODE: true
- name: Build code (non-windows) - name: Build code (non-windows)
shell: bash shell: bash
if: ${{ runner.os != 'Windows' }} if: ${{ runner.os != 'Windows' }}
@ -32,16 +30,12 @@ steps:
ref: v1.1.0 ref: v1.1.0
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
upload: false upload: false
env:
TEST_MODE: true
- 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
env:
TEST_MODE: true
- name: Verify SARIF after upload - name: Verify SARIF after upload
shell: bash shell: bash

View file

@ -116,6 +116,7 @@ for file in os.listdir('checks'):
checkJob['env'] = checkJob.get('env', {}) checkJob['env'] = checkJob.get('env', {})
checkJob['env']['INTERNAL_CODEQL_ACTION_DEBUG_LOC'] = True checkJob['env']['INTERNAL_CODEQL_ACTION_DEBUG_LOC'] = True
checkJob['env']['CODEQL_ACTION_TEST_MODE'] = True
checkName = file[:len(file) - 4] checkName = file[:len(file) - 4]
with open(f"../.github/workflows/__{checkName}.yml", 'w') as output_stream: with open(f"../.github/workflows/__{checkName}.yml", 'w') as output_stream:

View file

@ -8,3 +8,6 @@ export const CODEQL_WORKFLOW_STARTED_AT = "CODEQL_WORKFLOW_STARTED_AT";
export const CODEQL_ACTION_TESTING_ENVIRONMENT = export const CODEQL_ACTION_TESTING_ENVIRONMENT =
"CODEQL_ACTION_TESTING_ENVIRONMENT"; "CODEQL_ACTION_TESTING_ENVIRONMENT";
/** Used to disable uploading SARIF results or status reports to the GitHub API */
export const CODEQL_ACTION_TEST_MODE = "CODEQL_ACTION_TEST_MODE";

View file

@ -20,6 +20,7 @@ import {
import { Feature, FeatureEnablement } from "./feature-flags"; import { Feature, FeatureEnablement } from "./feature-flags";
import { Language } from "./languages"; import { Language } from "./languages";
import { Logger } from "./logging"; import { Logger } from "./logging";
import { CODEQL_ACTION_TEST_MODE } from "./shared-environment";
/** /**
* Specifies bundle versions that are known to be broken * Specifies bundle versions that are known to be broken
@ -664,7 +665,7 @@ export async function checkActionVersion(version: string) {
* In test mode, we don't upload SARIF results or status reports to the GitHub API. * In test mode, we don't upload SARIF results or status reports to the GitHub API.
*/ */
export function isInTestMode(): boolean { export function isInTestMode(): boolean {
return process.env["TEST_MODE"] === "true"; return process.env[CODEQL_ACTION_TEST_MODE] === "true";
} }
/** /**