Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #26 from github/integration-tests
Testing overhaul
- Loading branch information
David Verdeguer
authored and
GitHub
committed
May 12, 2020
Unverified
No user is associated with the committer email.
Showing
42 changed files
with
432 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
me: "CodeQL config" | ||
name: "CodeQL config" | ||
queries: | ||
- name: Run custom queries | ||
uses: ./queries | ||
paths-ignore: | ||
- tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,117 @@ | ||
name: "Integration Testing" | ||
|
||
on: [push] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
dispatch-events: | ||
if: github.event.repository.full_name == 'github/codeql-action' | ||
multi-language-repo_test-autodetect-languages: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Move codeql-action | ||
shell: bash | ||
run: | | ||
mkdir ../action | ||
shopt -s dotglob | ||
mv * ../action/ | ||
mv ../action/tests/multi-language-repo/* . | ||
- uses: ./../action/init | ||
- name: Build code | ||
shell: bash | ||
run: ./build.sh | ||
- uses: ./../action/analyze | ||
env: | ||
TEST_MODE: true | ||
|
||
multi-language-repo_test-custom-queries: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Move codeql-action | ||
shell: bash | ||
run: | | ||
mkdir ../action | ||
shopt -s dotglob | ||
mv * ../action/ | ||
mv ../action/tests/multi-language-repo/* . | ||
- uses: ./../action/init | ||
with: | ||
languages: cpp,csharp,java,javascript,python | ||
config-file: ./.github/codeql/custom-queries.yml | ||
- name: Build code | ||
shell: bash | ||
run: ./build.sh | ||
- uses: ./../action/analyze | ||
env: | ||
TEST_MODE: true | ||
|
||
# Currently is not possible to analyze Go in conjunction with other languages in macos | ||
multi-language-repo_test-go-custom-queries: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/setup-go@v2 | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
with: | ||
go-version: '^1.13.1' | ||
- uses: actions/checkout@v2 | ||
- name: Move codeql-action | ||
shell: bash | ||
run: | | ||
mkdir ../action | ||
shopt -s dotglob | ||
mv * ../action/ | ||
mv ../action/tests/multi-language-repo/* . | ||
- uses: ./../action/init | ||
with: | ||
languages: go | ||
config-file: ./.github/codeql/custom-queries.yml | ||
- name: Build code | ||
shell: bash | ||
run: ./build.sh | ||
- uses: ./../action/analyze | ||
env: | ||
TEST_MODE: true | ||
|
||
|
||
multi-language-repo_rubocop: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Send repository dispatch events | ||
- uses: actions/checkout@v2 | ||
- name: Move codeql-action | ||
shell: bash | ||
run: | | ||
mkdir ../action | ||
shopt -s dotglob | ||
mv * ../action/ | ||
mv ../action/tests/multi-language-repo/* . | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.6 | ||
- name: Install Code Scanning integration | ||
run: bundle add code-scanning-rubocop --version 0.2.0 --skip-install | ||
- name: Install dependencies | ||
run: bundle install | ||
- name: Rubocop run | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: Bearer ${{ secrets.CODEQL_TESTING_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.everest-preview+json" \ | ||
https://api.github.com/repos/Anthophila/amazon-cognito-js-copy/dispatches \ | ||
-d '{"event_type":"codeql-integration","client_payload": {"sha": "${{ github.sha }}"}}' | ||
curl -X POST \ | ||
-H "Authorization: Bearer ${{ secrets.CODEQL_TESTING_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.everest-preview+json" \ | ||
https://api.github.com/repos/Anthophila/electron-test-action/dispatches \ | ||
-d '{"event_type":"codeql-integration","client_payload": {"sha": "${{ github.sha }}"}}' | ||
bash -c " | ||
bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif | ||
[[ $? -ne 2 ]] | ||
" | ||
- uses: ./../action/upload-sarif | ||
with: | ||
sarif_file: rubocop.sarif | ||
env: | ||
TEST_MODE: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/multi-language-repo/.github/codeql/custom-queries.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Use custom queries | ||
|
||
disable-default-queries: true | ||
|
||
queries: | ||
# Query suites | ||
- name: Select a query suite | ||
uses: ./codeql-qlpacks/complex-python-qlpack/rootAndBar.qls | ||
# QL pack subset | ||
- name: Select a ql file | ||
uses: ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql | ||
- name: Select a subfolder | ||
uses: ./codeql-qlpacks/complex-javascript-qlpack/foo | ||
- name: Select a folder with two subfolders | ||
uses: ./codeql-qlpacks/complex-javascript-qlpack/foo2 | ||
# Inrepo QL pack | ||
- name: Select an inrepo ql pack | ||
uses: ./codeql-qlpacks/csharp-qlpack | ||
- name: Java queries | ||
uses: ./codeql-qlpacks/java-qlpack | ||
# External QL packs | ||
- name: Go queries | ||
uses: Anthophila/go-querypack@master | ||
- name: Cpp queries | ||
uses: Anthophila/cpp-querypack@second-branch | ||
- name: Javascript queries | ||
uses: Anthophila/javascript-querypack/show_ifs2.ql@master | ||
- name: Python queries | ||
uses: Anthophila/python-querypack/show_ifs2.ql@second-branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source "https://rubygems.org" do | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Main { | ||
public static void main(String args[]) { | ||
if (true) { | ||
System.out.println("Hello, World!"); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
gcc -o main main.c | ||
|
||
dotnet build | ||
|
||
javac Main.java | ||
|
11 changes: 11 additions & 0 deletions
11
tests/multi-language-repo/codeql-qlpacks/complex-javascript-qlpack/foo/show_ifs.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @name Foo Show Ifs | ||
* @description Foo Show Ifs | ||
* @kind problem | ||
* @id complex-javascript-querypack/foo-show-ifs | ||
*/ | ||
|
||
import javascript | ||
|
||
from IfStmt i | ||
select i, "foo if" |
11 changes: 11 additions & 0 deletions
11
tests/multi-language-repo/codeql-qlpacks/complex-javascript-qlpack/foo2/bar/show_ifs.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @name Bar Show Ifs | ||
* @description Bar Show Ifs | ||
* @kind problem | ||
* @id complex-javascript-querypack/bar-ifs | ||
*/ | ||
|
||
import javascript | ||
|
||
from IfStmt i | ||
select i, "bar if" |
11 changes: 11 additions & 0 deletions
11
...-language-repo/codeql-qlpacks/complex-javascript-qlpack/foo2/barfoo/barfoobar/show_ifs.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @name Barfoobar Show Ifs | ||
* @description Barfoobar Show Ifs | ||
* @kind problem | ||
* @id complex-javascript-querypack/barfoobar-ifs | ||
*/ | ||
|
||
import javascript | ||
|
||
from IfStmt i | ||
select i, "barfoobar if" |
11 changes: 11 additions & 0 deletions
11
tests/multi-language-repo/codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @name Foo2 Show Ifs | ||
* @description Foo2 Show Ifs | ||
* @kind problem | ||
* @id complex-javascript-querypack/foo2-ifs | ||
*/ | ||
|
||
import javascript | ||
|
||
from IfStmt i | ||
select i, "foo2 if" |
3 changes: 3 additions & 0 deletions
3
tests/multi-language-repo/codeql-qlpacks/complex-javascript-qlpack/qlpack.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: complex-javascript-querypack | ||
version: 0.0.1 | ||
libraryPathDependencies: codeql-javascript |
11 changes: 11 additions & 0 deletions
11
tests/multi-language-repo/codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @name Root Show Ifs | ||
* @description Root Show Ifs | ||
* @kind problem | ||
* @id complex-javascript-querypack/root-show-ifs | ||
*/ | ||
|
||
import javascript | ||
|
||
from IfStmt i | ||
select i, "root if" |
11 changes: 11 additions & 0 deletions
11
tests/multi-language-repo/codeql-qlpacks/complex-python-qlpack/foo/bar/show_ifs.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @name Foo/Bar Show Ifs | ||
* @description Foo/Bar Show Ifs | ||
* @kind problem | ||
* @id complex-python-querypack/foo/bar/show-ifs | ||
*/ | ||
|
||
import python | ||
|
||
from If i | ||
select i, "foo/bar if" |
11 changes: 11 additions & 0 deletions
11
tests/multi-language-repo/codeql-qlpacks/complex-python-qlpack/foo/show_ifs.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @name Foo Show Ifs | ||
* @description Foo Show Ifs | ||
* @kind problem | ||
* @id complex-python-querypack/foo/show-ifs | ||
*/ | ||
|
||
import python | ||
|
||
from If i | ||
select i, "foo if" |
3 changes: 3 additions & 0 deletions
3
tests/multi-language-repo/codeql-qlpacks/complex-python-qlpack/qlpack.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: inrepo-python-querypack | ||
version: 0.0.1 | ||
libraryPathDependencies: codeql-python |
2 changes: 2 additions & 0 deletions
2
tests/multi-language-repo/codeql-qlpacks/complex-python-qlpack/rootAndBar.qls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- query: show_ifs.ql | ||
- query: foo/bar/show_ifs.ql |
Oops, something went wrong.