Skip to content

Commit e284efb

Browse files
authored
Merge pull request #545 from github/aeisenberg/pack-run
Allow the codeql-action to run packages
2 parents babcc1b + 20aafcd commit e284efb

28 files changed

+1175
-157
lines changed

.github/workflows/post-release-mergeback.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ on:
1616
branches:
1717
- v1
1818

19-
pull_request:
20-
paths:
21-
- .github/workflows/post-release-mergeback.yml
22-
2319
jobs:
2420
merge-back:
2521
runs-on: ubuntu-latest

.github/workflows/pr-checks.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,49 @@ jobs:
100100
exit 1
101101
fi
102102
103+
# Packaging test that runs against a javascript database
104+
test-packaging-javascript:
105+
needs: [check-js, check-node-modules]
106+
runs-on: ubuntu-latest
107+
108+
steps:
109+
- uses: actions/checkout@v2
110+
- name: Move codeql-action
111+
shell: bash
112+
run: |
113+
mkdir ../action
114+
mv * .github ../action/
115+
mv ../action/tests/multi-language-repo/{*,.github} .
116+
mv ../action/.github/workflows .github
117+
- uses: ./../action/init
118+
with:
119+
config-file: ".github/codeql/codeql-config-packaging.yml"
120+
languages: javascript
121+
# TODO: this is temporary until we have a release that includes the latest packaging work.
122+
tools: https://github.com/dsp-testing/aeisenberg-codeql-action-packaging/releases/download/codeql-bundle-20210606/codeql-bundle-linux64.tar.gz
123+
124+
- name: Build code
125+
shell: bash
126+
run: ./build.sh
127+
- uses: ./../action/analyze
128+
with:
129+
output: "${{ runner.temp }}/results"
130+
env:
131+
TEST_MODE: true
132+
- name: Assert Results
133+
run: |
134+
cd "$RUNNER_TEMP/results"
135+
# We should have 3 hits from these rules
136+
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
137+
138+
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
139+
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
140+
echo "Found matching rules '$RULES'"
141+
if [ "$RULES" != "$EXPECTED_RULES" ]; then
142+
echo "Did not match expected rules '$EXPECTED_RULES'."
143+
exit 1
144+
fi
145+
103146
# Identify the CodeQL tool versions to integration test against.
104147
check-codeql-versions:
105148
needs: [check-js, check-node-modules]

lib/analysis-paths.test.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analysis-paths.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze.js

Lines changed: 43 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)