Skip to content

Commit 2ef13d1

Browse files
committed
Merge remote-tracking branch 'upstream/main' into mathiasvp/replace-ast-with-ir-use-usedataflow
2 parents 4c94ff7 + f3dca95 commit 2ef13d1

295 files changed

Lines changed: 19736 additions & 9655 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/ql--false-positive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: CodeQL False positive
2+
name: CodeQL false positive
33
about: Report CodeQL alerts that you think should not have been detected (not applicable, not exploitable, etc.)
44
title: False positive
55
labels: false-positive

.github/workflows/csharp-qltest.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,17 @@ jobs:
7070
codeql test run --threads=0 --ram 52000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}/csharp/extractor-pack" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
7171
env:
7272
GITHUB_TOKEN: ${{ github.token }}
73+
unit-tests:
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v3
77+
- name: Setup dotnet
78+
uses: actions/setup-dotnet@v3
79+
with:
80+
dotnet-version: 6.0.202
81+
- name: Extractor unit tests
82+
run: |
83+
dotnet test -p:RuntimeFrameworkVersion=6.0.4 "${{ github.workspace }}/csharp/extractor/Semmle.Util.Tests"
84+
dotnet test -p:RuntimeFrameworkVersion=6.0.4 "${{ github.workspace }}/csharp/extractor/Semmle.Extraction.Tests"
85+
dotnet test -p:RuntimeFrameworkVersion=6.0.4 "${{ github.workspace }}/csharp/autobuilder/Semmle.Autobuild.CSharp.Tests"
86+
dotnet test -p:RuntimeFrameworkVersion=6.0.4 "${{ github.workspace }}/cpp/autobuilder/Semmle.Autobuild.Cpp.Tests"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: "Go: Run Tests - Other OS"
2+
on:
3+
pull_request:
4+
paths:
5+
- "go/**"
6+
- "!go/ql/**" # don't run other-os if only ql/ files changed
7+
- .github/workflows/go-tests-other-os.yml
8+
- .github/actions/fetch-codeql/action.yml
9+
- .github/actions/cache-query-compilation/action.yml
10+
- codeql-workspace.yml
11+
jobs:
12+
test-mac:
13+
name: Test MacOS
14+
runs-on: macos-latest
15+
steps:
16+
- name: Set up Go 1.19
17+
uses: actions/setup-go@v3
18+
with:
19+
go-version: 1.19
20+
id: go
21+
22+
- name: Check out code
23+
uses: actions/checkout@v2
24+
25+
- name: Set up CodeQL CLI
26+
uses: ./.github/actions/fetch-codeql
27+
28+
- name: Enable problem matchers in repository
29+
shell: bash
30+
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
31+
32+
- name: Build
33+
run: |
34+
cd go
35+
make
36+
37+
- name: Cache compilation cache
38+
id: query-cache
39+
uses: ./.github/actions/cache-query-compilation
40+
with:
41+
key: go-qltest
42+
- name: Test
43+
run: |
44+
cd go
45+
make test cache="${{ steps.query-cache.outputs.cache-dir }}"
46+
47+
test-win:
48+
name: Test Windows
49+
runs-on: windows-latest-xl
50+
steps:
51+
- name: Set up Go 1.19
52+
uses: actions/setup-go@v3
53+
with:
54+
go-version: 1.19
55+
id: go
56+
57+
- name: Check out code
58+
uses: actions/checkout@v2
59+
60+
- name: Set up CodeQL CLI
61+
uses: ./.github/actions/fetch-codeql
62+
63+
- name: Enable problem matchers in repository
64+
shell: bash
65+
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
66+
67+
- name: Build
68+
run: |
69+
cd go
70+
make
71+
72+
- name: Cache compilation cache
73+
id: query-cache
74+
uses: ./.github/actions/cache-query-compilation
75+
with:
76+
key: go-qltest
77+
78+
- name: Test
79+
run: |
80+
cd go
81+
make test cache="${{ steps.query-cache.outputs.cache-dir }}"

.github/workflows/go-tests.yml

Lines changed: 19 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
name: "Go: Run Tests"
22
on:
3+
push:
4+
paths:
5+
- "go/**"
6+
- .github/workflows/go-tests.yml
7+
- .github/actions/fetch-codeql/action.yml
8+
- .github/actions/cache-query-compilation/action.yml
9+
- codeql-workspace.yml
10+
branches:
11+
- main
12+
- "rc/*"
313
pull_request:
414
paths:
515
- "go/**"
616
- .github/workflows/go-tests.yml
717
- .github/actions/fetch-codeql/action.yml
18+
- .github/actions/cache-query-compilation/action.yml
819
- codeql-workspace.yml
920
jobs:
1021
test-linux:
1122
name: Test Linux (Ubuntu)
12-
runs-on: ubuntu-latest
23+
runs-on: ubuntu-latest-xl
1324
steps:
1425
- name: Set up Go 1.19
1526
uses: actions/setup-go@v3
@@ -32,7 +43,7 @@ jobs:
3243
cd go
3344
make
3445
35-
- name: Check that all QL and Go code is autoformatted
46+
- name: Check that all Go code is autoformatted
3647
run: |
3748
cd go
3849
make check-formatting
@@ -48,67 +59,13 @@ jobs:
4859
name: qhelp-markdown
4960
path: go/qhelp-out/**/*.md
5061

51-
- name: Test
52-
run: |
53-
cd go
54-
make test
55-
56-
test-mac:
57-
name: Test MacOS
58-
runs-on: macos-latest
59-
steps:
60-
- name: Set up Go 1.19
61-
uses: actions/setup-go@v3
62-
with:
63-
go-version: 1.19
64-
id: go
65-
66-
- name: Check out code
67-
uses: actions/checkout@v2
68-
69-
- name: Set up CodeQL CLI
70-
uses: ./.github/actions/fetch-codeql
71-
72-
- name: Enable problem matchers in repository
73-
shell: bash
74-
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
75-
76-
- name: Build
77-
run: |
78-
cd go
79-
make
80-
81-
- name: Test
82-
run: |
83-
cd go
84-
make test
85-
86-
test-win:
87-
name: Test Windows
88-
runs-on: windows-2019
89-
steps:
90-
- name: Set up Go 1.19
91-
uses: actions/setup-go@v3
62+
- name: Cache compilation cache
63+
id: query-cache
64+
uses: ./.github/actions/cache-query-compilation
9265
with:
93-
go-version: 1.19
94-
id: go
95-
96-
- name: Check out code
97-
uses: actions/checkout@v2
98-
99-
- name: Set up CodeQL CLI
100-
uses: ./.github/actions/fetch-codeql
101-
102-
- name: Enable problem matchers in repository
103-
shell: bash
104-
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
105-
106-
- name: Build
107-
run: |
108-
cd go
109-
make
110-
66+
key: go-qltest
67+
11168
- name: Test
11269
run: |
11370
cd go
114-
make test
71+
make test cache="${{ steps.query-cache.outputs.cache-dir }}"

.github/workflows/ruby-build.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,39 @@ jobs:
4848
run: |
4949
brew install gnu-tar
5050
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
51+
- name: Cache entire extractor
52+
uses: actions/cache@v3
53+
id: cache-extractor
54+
with:
55+
path: |
56+
ruby/target/release/ruby-autobuilder
57+
ruby/target/release/ruby-autobuilder.exe
58+
ruby/target/release/ruby-extractor
59+
ruby/target/release/ruby-extractor.exe
60+
ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
61+
key: ${{ runner.os }}-ruby-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}--${{ hashFiles('ruby/**/*.rs') }}
5162
- uses: actions/cache@v3
63+
if: steps.cache-extractor.outputs.cache-hit != 'true'
5264
with:
5365
path: |
5466
~/.cargo/registry
5567
~/.cargo/git
5668
ruby/target
5769
key: ${{ runner.os }}-ruby-rust-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}
5870
- name: Check formatting
71+
if: steps.cache-extractor.outputs.cache-hit != 'true'
5972
run: cargo fmt --all -- --check
6073
- name: Build
74+
if: steps.cache-extractor.outputs.cache-hit != 'true'
6175
run: cargo build --verbose
6276
- name: Run tests
77+
if: steps.cache-extractor.outputs.cache-hit != 'true'
6378
run: cargo test --verbose
6479
- name: Release build
80+
if: steps.cache-extractor.outputs.cache-hit != 'true'
6581
run: cargo build --release
6682
- name: Generate dbscheme
67-
if: ${{ matrix.os == 'ubuntu-latest' }}
83+
if: ${{ matrix.os == 'ubuntu-latest' && steps.cache-extractor.outputs.cache-hit != 'true'}}
6884
run: target/release/ruby-generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
6985
- uses: actions/upload-artifact@v3
7086
if: ${{ matrix.os == 'ubuntu-latest' }}

.github/workflows/swift.yml

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,92 +8,76 @@ on:
88
- "*.bazel*"
99
- .github/workflows/swift.yml
1010
- .github/actions/fetch-codeql/action.yml
11+
- .github/actions/cache-query-compilation/action.yml
1112
- codeql-workspace.yml
1213
- .pre-commit-config.yaml
1314
- "!**/*.md"
1415
- "!**/*.qhelp"
1516
branches:
1617
- main
18+
- rc/*
19+
push:
20+
paths:
21+
- "swift/**"
22+
- "misc/bazel/**"
23+
- "*.bazel*"
24+
- .github/workflows/swift.yml
25+
- .github/actions/fetch-codeql/action.yml
26+
- .github/actions/cache-query-compilation/action.yml
27+
- codeql-workspace.yml
28+
- "!**/*.md"
29+
- "!**/*.qhelp"
30+
branches:
31+
- main
32+
- rc/*
1733

1834
jobs:
19-
changes:
20-
runs-on: ubuntu-latest
21-
outputs:
22-
codegen: ${{ steps.filter.outputs.codegen }}
23-
ql: ${{ steps.filter.outputs.ql }}
24-
steps:
25-
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
26-
id: filter
27-
with:
28-
filters: |
29-
codegen:
30-
- '.github/workflows/swift.yml'
31-
- "misc/bazel/**"
32-
- "*.bazel*"
33-
- 'swift/actions/setup-env/**'
34-
- '.pre-commit-config.yaml'
35-
- 'swift/codegen/**'
36-
- 'swift/schema.py'
37-
- 'swift/**/*.dbscheme'
38-
- 'swift/ql/lib/codeql/swift/elements.qll'
39-
- 'swift/ql/lib/codeql/swift/elements/**'
40-
- 'swift/ql/lib/codeql/swift/generated/**'
41-
- 'swift/ql/test/extractor-tests/generated/**'
42-
- 'swift/ql/.generated.list'
43-
ql:
44-
- 'github/workflows/swift.yml'
45-
- 'swift/**/*.ql'
46-
- 'swift/**/*.qll'
4735
# not using a matrix as you cannot depend on a specific job in a matrix, and we want to start linux checks
4836
# without waiting for the macOS build
4937
build-and-test-macos:
38+
if: ${{ github.event_name == 'pull_request' }}
5039
runs-on: macos-12-xl
5140
steps:
5241
- uses: actions/checkout@v3
5342
- uses: ./swift/actions/create-extractor-pack
5443
- uses: ./swift/actions/run-quick-tests
5544
- uses: ./swift/actions/print-unextracted
5645
build-and-test-linux:
57-
runs-on: ubuntu-20.04
46+
runs-on: ubuntu-latest-xl
5847
steps:
5948
- uses: actions/checkout@v3
6049
- uses: ./swift/actions/create-extractor-pack
6150
- uses: ./swift/actions/run-quick-tests
6251
- uses: ./swift/actions/print-unextracted
6352
qltests-linux:
6453
needs: build-and-test-linux
65-
runs-on: ubuntu-latest
54+
runs-on: ubuntu-latest-xl
6655
steps:
6756
- uses: actions/checkout@v3
6857
- uses: ./swift/actions/run-ql-tests
6958
qltests-macos:
59+
if : ${{ github.event_name == 'pull_request' }}
7060
needs: build-and-test-macos
7161
runs-on: macos-12-xl
72-
strategy:
73-
fail-fast: false
74-
matrix:
75-
slice: ["1/2", "2/2"]
7662
steps:
7763
- uses: actions/checkout@v3
7864
- uses: ./swift/actions/run-ql-tests
79-
with:
80-
flags: --slice ${{ matrix.slice }}
8165
integration-tests-linux:
8266
needs: build-and-test-linux
83-
runs-on: ubuntu-latest
67+
runs-on: ubuntu-latest-xl
8468
steps:
8569
- uses: actions/checkout@v3
8670
- uses: ./swift/actions/run-integration-tests
8771
integration-tests-macos:
72+
if : ${{ github.event_name == 'pull_request' }}
8873
needs: build-and-test-macos
8974
runs-on: macos-12-xl
9075
steps:
9176
- uses: actions/checkout@v3
9277
- uses: ./swift/actions/run-integration-tests
9378
codegen:
79+
if : ${{ github.event_name == 'pull_request' }}
9480
runs-on: ubuntu-latest
95-
needs: changes
96-
if: ${{ needs.changes.outputs.codegen == 'true' }}
9781
steps:
9882
- uses: actions/checkout@v3
9983
- uses: ./swift/actions/setup-env
@@ -114,6 +98,7 @@ jobs:
11498
name: swift-generated-cpp-files
11599
path: generated-cpp-files/**
116100
database-upgrade-scripts:
101+
if : ${{ github.event_name == 'pull_request' }}
117102
runs-on: ubuntu-latest
118103
steps:
119104
- uses: actions/checkout@v3

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"omnisharp.autoStart": false
2+
"omnisharp.autoStart": false,
3+
"cmake.sourceDirectory": "${workspaceFolder}/swift",
4+
"cmake.buildDirectory": "${workspaceFolder}/bazel-cmake-build"
35
}

codeql-workspace.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ provide:
2525
- "misc/suite-helpers/qlpack.yml"
2626
- "ruby/extractor-pack/codeql-extractor.yml"
2727
- "swift/extractor-pack/codeql-extractor.yml"
28-
- "ql/extractor-pack/codeql-extractor.ym"
28+
- "swift/integration-tests/qlpack.yml"
29+
- "ql/extractor-pack/codeql-extractor.yml"
2930

3031
versionPolicies:
3132
default:

0 commit comments

Comments
 (0)