Skip to content

Commit a25c7f7

Browse files
Rasmus Lerchedahl PetersenRasmus Lerchedahl Petersen
authored andcommitted
Merge branch 'main' of https://github.com/github/codeql into python/captured-variables-for-typetracking
2 parents 9e3d57d + bfbbb52 commit a25c7f7

File tree

3,277 files changed

+278868
-172235
lines changed

Some content is hidden

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

3,277 files changed

+278868
-172235
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.0
1+
6.1.2

.github/workflows/atm-check-query-suite.yml

Lines changed: 0 additions & 102 deletions
This file was deleted.

.github/workflows/atm-model-integration-tests.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/check-change-note.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "*/ql/src/**/*.qll"
99
- "*/ql/lib/**/*.ql"
1010
- "*/ql/lib/**/*.qll"
11+
- "*/ql/lib/**/*.yml"
1112
- "!**/experimental/**"
1213
- "!ql/**"
1314
- "!swift/**"

.github/workflows/close-stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/stale@v7
15+
- uses: actions/stale@v8
1616
with:
1717
repo-token: ${{ secrets.GITHUB_TOKEN }}
1818
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Comment or remove the `Stale` label in order to avoid having this issue closed in 7 days.'

.github/workflows/fast-forward.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Fast-forwards the branch specified in BRANCH_NAME
2+
# to the github.ref/sha that this workflow is run on.
3+
# Used as part of the release process, to ensure
4+
# external query writers can always access a branch of github/codeql
5+
# that is compatible with the latest stable release.
6+
name: Fast-forward tracking branch for selected CodeQL version
7+
on:
8+
workflow_dispatch:
9+
10+
jobs:
11+
fast-forward:
12+
name: Fast-forward tracking branch for selected CodeQL version
13+
runs-on: ubuntu-latest
14+
if: github.repository == 'github/codeql'
15+
permissions:
16+
contents: write
17+
env:
18+
BRANCH_NAME: 'lgtm.com'
19+
steps:
20+
- name: Validate chosen branch
21+
if: ${{ !startsWith(github.ref_name, 'codeql-cli-') }}
22+
shell: bash
23+
run: |
24+
echo "::error ::The $BRANCH_NAME tracking branch should only be fast-forwarded to the tip of a codeql-cli-* branch, got $GITHUB_REF_NAME instead."
25+
exit 1
26+
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
30+
- name: Git config
31+
shell: bash
32+
run: |
33+
git config user.name "github-actions[bot]"
34+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
35+
36+
- name: Fetch
37+
shell: bash
38+
run: |
39+
set -x
40+
echo "Fetching $BRANCH_NAME"
41+
# Explicitly unshallow and fetch to ensure the remote ref is available.
42+
git fetch --unshallow origin "$BRANCH_NAME"
43+
git checkout -b "$BRANCH_NAME" "origin/$BRANCH_NAME"
44+
45+
- name: Fast-forward
46+
shell: bash
47+
run: |
48+
echo "Fast-forwarding $BRANCH_NAME to ${GITHUB_REF}@${GITHUB_SHA}"
49+
git merge --ff-only "$GITHUB_SHA"
50+
git push origin "$BRANCH_NAME"

.github/workflows/go-tests-other-os.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Go 1.20
1616
uses: actions/setup-go@v4
1717
with:
18-
go-version: 1.20.0
18+
go-version: '1.20'
1919
id: go
2020

2121
- name: Check out code
@@ -50,7 +50,7 @@ jobs:
5050
- name: Set up Go 1.20
5151
uses: actions/setup-go@v4
5252
with:
53-
go-version: 1.20.0
53+
go-version: '1.20'
5454
id: go
5555

5656
- name: Check out code

.github/workflows/go-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Set up Go 1.20
2424
uses: actions/setup-go@v4
2525
with:
26-
go-version: 1.20.0
26+
go-version: '1.20'
2727
id: go
2828

2929
- name: Check out code

.github/workflows/ruby-build.yml

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,18 @@ jobs:
4848
run: |
4949
brew install gnu-tar
5050
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
51+
- name: Install cargo-cross
52+
if: runner.os == 'Linux'
53+
run: cargo install cross --version 0.2.5
5154
- uses: ./.github/actions/os-version
5255
id: os_version
5356
- name: Cache entire extractor
5457
uses: actions/cache@v3
5558
id: cache-extractor
5659
with:
5760
path: |
58-
ruby/extractor/target/release/autobuilder
59-
ruby/extractor/target/release/autobuilder.exe
60-
ruby/extractor/target/release/extractor
61-
ruby/extractor/target/release/extractor.exe
61+
ruby/extractor/target/release/codeql-extractor-ruby
62+
ruby/extractor/target/release/codeql-extractor-ruby.exe
6263
ruby/extractor/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
6364
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-extractor-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/extractor/Cargo.lock') }}--${{ hashFiles('ruby/extractor/**/*.rs') }}
6465
- uses: actions/cache@v3
@@ -78,12 +79,20 @@ jobs:
7879
- name: Run tests
7980
if: steps.cache-extractor.outputs.cache-hit != 'true'
8081
run: cd extractor && cargo test --verbose
81-
- name: Release build
82-
if: steps.cache-extractor.outputs.cache-hit != 'true'
82+
# On linux, build the extractor via cross in a centos7 container.
83+
# This ensures we don't depend on glibc > 2.17.
84+
- name: Release build (linux)
85+
if: steps.cache-extractor.outputs.cache-hit != 'true' && runner.os == 'Linux'
86+
run: |
87+
cd extractor
88+
cross build --release
89+
mv target/x86_64-unknown-linux-gnu/release/codeql-extractor-ruby target/release/
90+
- name: Release build (windows and macos)
91+
if: steps.cache-extractor.outputs.cache-hit != 'true' && runner.os != 'Linux'
8392
run: cd extractor && cargo build --release
8493
- name: Generate dbscheme
8594
if: ${{ matrix.os == 'ubuntu-latest' && steps.cache-extractor.outputs.cache-hit != 'true'}}
86-
run: extractor/target/release/generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
95+
run: extractor/target/release/codeql-extractor-ruby generate --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
8796
- uses: actions/upload-artifact@v3
8897
if: ${{ matrix.os == 'ubuntu-latest' }}
8998
with:
@@ -98,10 +107,8 @@ jobs:
98107
with:
99108
name: extractor-${{ matrix.os }}
100109
path: |
101-
ruby/extractor/target/release/autobuilder
102-
ruby/extractor/target/release/autobuilder.exe
103-
ruby/extractor/target/release/extractor
104-
ruby/extractor/target/release/extractor.exe
110+
ruby/extractor/target/release/codeql-extractor-ruby
111+
ruby/extractor/target/release/codeql-extractor-ruby.exe
105112
retention-days: 1
106113
compile-queries:
107114
runs-on: ubuntu-latest-xl
@@ -159,13 +166,10 @@ jobs:
159166
mkdir -p ruby
160167
cp -r codeql-extractor.yml tools ql/lib/ruby.dbscheme.stats ruby/
161168
mkdir -p ruby/tools/{linux64,osx64,win64}
162-
cp linux64/autobuilder ruby/tools/linux64/autobuilder
163-
cp osx64/autobuilder ruby/tools/osx64/autobuilder
164-
cp win64/autobuilder.exe ruby/tools/win64/autobuilder.exe
165-
cp linux64/extractor ruby/tools/linux64/extractor
166-
cp osx64/extractor ruby/tools/osx64/extractor
167-
cp win64/extractor.exe ruby/tools/win64/extractor.exe
168-
chmod +x ruby/tools/{linux64,osx64}/{autobuilder,extractor}
169+
cp linux64/codeql-extractor-ruby ruby/tools/linux64/extractor
170+
cp osx64/codeql-extractor-ruby ruby/tools/osx64/extractor
171+
cp win64/codeql-extractor-ruby.exe ruby/tools/win64/extractor.exe
172+
chmod +x ruby/tools/{linux64,osx64}/extractor
169173
zip -rq codeql-ruby.zip ruby
170174
- uses: actions/upload-artifact@v3
171175
with:
@@ -227,3 +231,54 @@ jobs:
227231
shell: bash
228232
run: |
229233
codeql database analyze --search-path "${{ runner.temp }}/ruby-bundle" --format=sarifv2.1.0 --output=out.sarif ../database ruby-code-scanning.qls
234+
235+
# This is a copy of the 'test' job that runs in a centos7 container.
236+
# This tests that the extractor works correctly on systems with an old glibc.
237+
test-centos7:
238+
defaults:
239+
run:
240+
working-directory: ${{ github.workspace }}
241+
strategy:
242+
fail-fast: false
243+
runs-on: ubuntu-latest
244+
container:
245+
image: centos:centos7
246+
env:
247+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
248+
needs: [package]
249+
steps:
250+
- name: Install gh cli
251+
run: |
252+
yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
253+
# fetch-codeql requires unzip and jq
254+
# jq is available in epel-release (https://docs.fedoraproject.org/en-US/epel/)
255+
yum install -y gh unzip epel-release
256+
yum install -y jq
257+
- uses: actions/checkout@v3
258+
- name: Fetch CodeQL
259+
uses: ./.github/actions/fetch-codeql
260+
261+
# Due to a bug in Actions, we can't use runner.temp in the run blocks here.
262+
# https://github.com/actions/runner/issues/2185
263+
264+
- name: Download Ruby bundle
265+
uses: actions/download-artifact@v3
266+
with:
267+
name: codeql-ruby-bundle
268+
path: ${{ runner.temp }}
269+
- name: Unzip Ruby bundle
270+
shell: bash
271+
run: unzip -q -d "$RUNNER_TEMP"/ruby-bundle "$RUNNER_TEMP"/codeql-ruby-bundle.zip
272+
273+
- name: Run QL test
274+
shell: bash
275+
run: |
276+
codeql test run --search-path "$RUNNER_TEMP"/ruby-bundle --additional-packs "$RUNNER_TEMP"/ruby-bundle ruby/ql/test/library-tests/ast/constants/
277+
- name: Create database
278+
shell: bash
279+
run: |
280+
codeql database create --search-path "$RUNNER_TEMP"/ruby-bundle --language ruby --source-root ruby/ql/test/library-tests/ast/constants/ ../database
281+
- name: Analyze database
282+
shell: bash
283+
run: |
284+
codeql database analyze --search-path "$RUNNER_TEMP"/ruby-bundle --format=sarifv2.1.0 --output=out.sarif ../database ruby-code-scanning.qls

.github/workflows/ruby-qltest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
paths:
66
- "ruby/**"
7+
- "shared/**"
78
- .github/workflows/ruby-build.yml
89
- .github/actions/fetch-codeql/action.yml
910
- codeql-workspace.yml

0 commit comments

Comments
 (0)