Skip to content

Commit

Permalink
Merge pull request #545 from github/aeisenberg/pack-run
Browse files Browse the repository at this point in the history
Allow the codeql-action to run packages
  • Loading branch information
aeisenberg authored Jun 10, 2021
2 parents babcc1b + 20aafcd commit e284efb
Show file tree
Hide file tree
Showing 28 changed files with 1,175 additions and 157 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/post-release-mergeback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ on:
branches:
- v1

pull_request:
paths:
- .github/workflows/post-release-mergeback.yml

jobs:
merge-back:
runs-on: ubuntu-latest
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,49 @@ jobs:
exit 1
fi
# Packaging test that runs against a javascript database
test-packaging-javascript:
needs: [check-js, check-node-modules]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Move codeql-action
shell: bash
run: |
mkdir ../action
mv * .github ../action/
mv ../action/tests/multi-language-repo/{*,.github} .
mv ../action/.github/workflows .github
- uses: ./../action/init
with:
config-file: ".github/codeql/codeql-config-packaging.yml"
languages: javascript
# TODO: this is temporary until we have a release that includes the latest packaging work.
tools: https://github.com/dsp-testing/aeisenberg-codeql-action-packaging/releases/download/codeql-bundle-20210606/codeql-bundle-linux64.tar.gz

- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
with:
output: "${{ runner.temp }}/results"
env:
TEST_MODE: true
- name: Assert Results
run: |
cd "$RUNNER_TEMP/results"
# We should have 3 hits from these rules
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
# 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" " " | xargs)"
echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1
fi
# Identify the CodeQL tool versions to integration test against.
check-codeql-versions:
needs: [check-js, check-node-modules]
Expand Down
3 changes: 3 additions & 0 deletions lib/analysis-paths.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analysis-paths.test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 43 additions & 13 deletions lib/analyze.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e284efb

Please sign in to comment.