Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
86a804f
Allow the codeql-action to run packages
aeisenberg Jun 3, 2021
6cee818
Add better comments and error messages for pack-related changes
aeisenberg Jun 4, 2021
9b5753a
Fix logic for calculating if there are queries to run
aeisenberg Jun 4, 2021
06687e9
Avoid using `SemVer` instances
aeisenberg Jun 4, 2021
d87945e
Run the pack download command
aeisenberg Jun 4, 2021
02e8dcf
Fix out of memory in hash computation
edoardopirovano Jun 7, 2021
9e6b46a
Update changelog and version after v1.0.1
invalid-email-address Jun 7, 2021
fbb9046
1.0.2
invalid-email-address Jun 7, 2021
a69f472
Merge branch 'main' into mergeback/v1.0.1-to-main-ece2addc
aeisenberg Jun 7, 2021
9c13fef
Merge pull request #554 from github/mergeback/v1.0.1-to-main-ece2addc
aeisenberg Jun 7, 2021
c095005
Some refactoring in fingerprint computation
edoardopirovano Jun 7, 2021
2cc885d
Replace analyze with run-queries and interpret-results
edoardopirovano Jun 4, 2021
1cc5f1d
Packaging: Address review comments
aeisenberg Jun 7, 2021
d42f654
Add an integration test for packaging
aeisenberg Jun 8, 2021
0ea20c5
Add intepret-results timings to status reports
edoardopirovano Jun 9, 2021
06df98a
Add new log grouping for DB cleanup
edoardopirovano Jun 9, 2021
babcc1b
Add `--finalize-dataset` to `database finalize` call
edoardopirovano Jun 9, 2021
82388fd
Merge remote-tracking branch 'upstream/main' into aeisenberg/pack-run
aeisenberg Jun 9, 2021
db01c78
Remove unneeded action input in PR check
aeisenberg Jun 9, 2021
49b2220
Refactor codeql.ts
aeisenberg Jun 9, 2021
96e7de3
Use nullish conversion for packs
aeisenberg Jun 9, 2021
a2e96a4
Add pack download to its own log group
aeisenberg Jun 9, 2021
23cdd6b
Remove two log entries
aeisenberg Jun 9, 2021
6a1c070
Avoid running mergeback workflow on PR
aeisenberg Jun 9, 2021
20aafcd
Remove unnecessary type assertions
aeisenberg Jun 10, 2021
e284efb
Merge pull request #545 from github/aeisenberg/pack-run
aeisenberg Jun 10, 2021
d16268b
Fix update-release-branch-fix.py
aeisenberg Jun 16, 2021
efea923
Fix custom version of CLI to use for package testing
aeisenberg Jun 16, 2021
0b1f4a0
Merge pull request #566 from github/aeisenberg/update-release-branch-fix
aeisenberg Jun 17, 2021
028a76e
1.0.2
invalid-email-address Jun 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add an integration test for packaging
Uses two pre-existing packages to run some simple queries on a javascript
database.
  • Loading branch information
aeisenberg committed Jun 8, 2021
commit d42f654f7ab2bd398e52ec88903fb2c4c62c17f1
44 changes: 44 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,50 @@ 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:
db-location: "${{ runner.temp }}/customDbLocation"
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-custom.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
5 changes: 4 additions & 1 deletion lib/codeql.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/codeql.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/count-loc.test.js

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

5 changes: 4 additions & 1 deletion src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,10 @@ function getCodeQLForCmd(cmd: string): CodeQL {
const parsedOutput: PackDownloadOutput = JSON.parse(output);
if (
Array.isArray(parsedOutput.packs) &&
parsedOutput.packs.every((p) => p.name && p.version)
// TODO PackDownloadOutput will not include the version if it is not specified
// in the input. The version is always the latest version available.
// It should be added to the output, but this requires a CLI change
parsedOutput.packs.every((p) => p.name /* && p.version */)
) {
return parsedOutput;
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/count-loc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test("ensure lines of code works for cpp and js", async (t) => {

t.deepEqual(results, {
cpp: 6,
javascript: 3,
javascript: 9,
});
});

Expand All @@ -34,7 +34,7 @@ test("ensure lines of code can handle undefined language", async (t) => {
);

t.deepEqual(results, {
javascript: 3,
javascript: 9,
python: 5,
});
});
Expand Down Expand Up @@ -93,6 +93,6 @@ test("ensure lines of code can handle exclude", async (t) => {
);

t.deepEqual(results, {
javascript: 3,
javascript: 9,
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Pack testing in the CodeQL Action

disable-default-queries: true
packs:
javascript:
- dsp-testing/[email protected]
- dsp-testing/codeql-pack2 # latest
paths-ignore:
- tests
- lib
9 changes: 9 additions & 0 deletions tests/multi-language-repo/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
if (true) {
console.log("Hello, World!");
console.log("Good-bye, World!");
}

if (true) {
console.log("Hello, World!");
}

if (true) {
// empty
}