Extract query-filters test into a composite action
Removes duplicated yaml. Also add some better typings.
This commit is contained in:
parent
428caf0cf5
commit
59ca9b59cb
4 changed files with 86 additions and 58 deletions
52
.github/query-filter-test/action.yml
vendored
Normal file
52
.github/query-filter-test/action.yml
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
name: Query Filter Test
|
||||
description: Runs a test of query filters using the check sarif action
|
||||
inputs:
|
||||
sarif-file:
|
||||
required: true
|
||||
description: The sarif file to check
|
||||
|
||||
queries-run:
|
||||
required: true
|
||||
description: |
|
||||
Comma separated list of query ids that should be included in this SARIF file.
|
||||
|
||||
queries-not-run:
|
||||
required: true
|
||||
description: |
|
||||
Comma separated list of query ids that should NOT be included in this SARIF file.
|
||||
|
||||
config-file:
|
||||
required: true
|
||||
description: |
|
||||
The location of the codeql configuration file to use.
|
||||
|
||||
tools:
|
||||
required: true
|
||||
description: |
|
||||
The url of codeql to use.
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: javascript
|
||||
config-file: ./.github/codeql/codeql-config-query-filters1.yml
|
||||
tools: ${{ inputs.tools }}
|
||||
db-location: ${{ runner.temp }}/query-filter-test
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
upload-database: false
|
||||
upload: false
|
||||
env:
|
||||
TEST_MODE: "true"
|
||||
- name: Check Sarif
|
||||
uses: ./../action/.github/check-sarif
|
||||
with:
|
||||
sarif-file: ${{ inputs.sarif-file }}
|
||||
queries-run: ${{ inputs.queries-run}}
|
||||
queries-not-run: ${{ inputs.queries-not-run}}
|
||||
- name: Cleanup after test
|
||||
shell: bash
|
||||
run: rm -rf "$RUNNER_TEMP/results" "$RUNNER_TEMP//query-filter-test"
|
||||
66
.github/workflows/query-filters.yml
vendored
66
.github/workflows/query-filters.yml
vendored
|
|
@ -27,71 +27,29 @@ jobs:
|
|||
with:
|
||||
version: latest
|
||||
|
||||
# Test 1
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: javascript
|
||||
config-file: ./.github/codeql/codeql-config-query-filters1.yml
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
db-location: ${{ runner.temp }}/test1
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
upload-database: false
|
||||
upload: false
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Check Sarif
|
||||
uses: ./../action/.github/check-sarif
|
||||
- name: Check Sarif for default queries with Single include, Single exclude
|
||||
uses: ./../action/.github/query-filter-test
|
||||
with:
|
||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||
queries-run: js/zipslip
|
||||
queries-not-run: js/path-injection
|
||||
- name: Cleanup after test
|
||||
run: rm -rf "$RUNNER_TEMP/results"
|
||||
|
||||
# Test 2
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: javascript
|
||||
config-file: ./.github/codeql/codeql-config-query-filters2.yml
|
||||
config-file: ./.github/codeql/codeql-config-query-filters1.yml
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
db-location: ${{ runner.temp }}/test2
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
upload-database: false
|
||||
upload: false
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Check Sarif
|
||||
uses: ./../action/.github/check-sarif
|
||||
|
||||
- name: Check Sarif for query packs with Single include, Single exclude
|
||||
uses: ./../action/.github/query-filter-test
|
||||
with:
|
||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||
queries-run: js/zipslip,javascript/example/empty-or-one-block
|
||||
queries-not-run: js/path-injection
|
||||
- name: Cleanup after test
|
||||
run: rm -rf "$RUNNER_TEMP/results"
|
||||
|
||||
# Test 3
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: javascript
|
||||
config-file: ./.github/codeql/codeql-config-query-filters3.yml
|
||||
config-file: ./.github/codeql/codeql-config-query-filters2.yml
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
db-location: ${{ runner.temp }}/test3
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
upload-database: false
|
||||
upload: false
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Check Sarif
|
||||
uses: ./../action/.github/check-sarif
|
||||
|
||||
- name: Check Sarif for query packs and local queries with Single include, Single exclude
|
||||
uses: ./../action/.github/query-filter-test
|
||||
with:
|
||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||
queries-run: js/zipslip,javascript/example/empty-or-one-block,inrepo-javascript-querypack/show-ifs
|
||||
queries-not-run: js/path-injection,complex-python-querypack/show-ifs,complex-python-querypack/foo/bar/show-ifs
|
||||
- name: Cleanup after test
|
||||
run: rm -rf "$RUNNER_TEMP/results"
|
||||
config-file: ./.github/codeql/codeql-config-query-filters3.yml
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue