Skip to content

Commit a017b75

Browse files
committed
Merge branch 'main' into rbPoly
2 parents d67e756 + ddef87f commit a017b75

File tree

4,045 files changed

+448409
-146253
lines changed

Some content is hidden

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

4,045 files changed

+448409
-146253
lines changed

.github/ISSUE_TEMPLATE/ql---general.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ assignees: ''
1010
**Description of the issue**
1111

1212
<!-- Please explain briefly what is the problem.
13-
If it is about an LGTM project, please include its URL.-->
13+
If it is about a GitHub project, please include its URL. -->
1414

.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/actions/cache-query-compilation/action.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ outputs:
1414
runs:
1515
using: composite
1616
steps:
17-
# Cache the query compilation caches.
18-
# calculate the merge-base with main, in a way that works both on PRs and pushes to main.
17+
# calculate the merge-base with main, in a way that works both on PRs and pushes to main.
1918
- name: Calculate merge-base
2019
shell: bash
2120
if: ${{ github.event_name == 'pull_request' }}
@@ -24,38 +23,32 @@ runs:
2423
run: |
2524
MERGE_BASE=$(git cat-file commit $GITHUB_SHA | grep '^parent ' | head -1 | cut -f 2 -d " ")
2625
echo "merge_base=$MERGE_BASE" >> $GITHUB_ENV
27-
- name: Read CodeQL query compilation - PR
26+
- name: Restore cache (PR)
2827
if: ${{ github.event_name == 'pull_request' }}
29-
uses: erik-krogh/actions-cache@a88d0603fe5fb5606db9f002dfcadeb32b5f84c6
28+
uses: actions/cache/restore@v3
3029
with:
3130
path: '**/.cache'
32-
read-only: true
33-
key: codeql-compile-${{ inputs.key }}-pr-${{ github.sha }} # deliberately not using the `compile-compile-main` keys here.
31+
key: codeql-compile-${{ inputs.key }}-pr-${{ github.sha }}
3432
restore-keys: |
3533
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-${{ env.merge_base }}
3634
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-
3735
codeql-compile-${{ inputs.key }}-main-
38-
- name: Fill CodeQL query compilation cache - main
36+
- name: Fill cache (only branch push)
3937
if: ${{ github.event_name != 'pull_request' }}
40-
uses: erik-krogh/actions-cache@a88d0603fe5fb5606db9f002dfcadeb32b5f84c6
38+
uses: actions/cache@v3
4139
with:
4240
path: '**/.cache'
4341
key: codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-${{ github.sha }} # just fill on main
44-
restore-keys: | # restore from another random commit, to speed up compilation.
45-
codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-
42+
restore-keys: | # restore the latest cache if the exact cache is unavailable, to speed up compilation.
43+
codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-
4644
codeql-compile-${{ inputs.key }}-main-
4745
- name: Fill compilation cache directory
4846
id: fill-compilation-dir
49-
shell: bash
47+
shell: bash
5048
run: |
5149
# Move all the existing cache into another folder, so we only preserve the cache for the current queries.
52-
mkdir -p ${COMBINED_CACHE_DIR}
53-
rm -f **/.cache/{lock,size} # -f to avoid errors if the cache is empty.
54-
# copy the contents of the .cache folders into the combined cache folder.
55-
cp -r **/.cache/* ${COMBINED_CACHE_DIR}/ || : # ignore missing files
56-
# clean up the .cache folders
57-
rm -rf **/.cache/*
50+
node $GITHUB_WORKSPACE/.github/actions/cache-query-compilation/move-caches.js ${COMBINED_CACHE_DIR}
5851
5952
echo "compdir=${COMBINED_CACHE_DIR}" >> $GITHUB_OUTPUT
60-
env:
61-
COMBINED_CACHE_DIR: ${{ github.workspace }}/compilation-dir
53+
env:
54+
COMBINED_CACHE_DIR: ${{ runner.temp }}/compilation-dir
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// # Move all the existing cache into another folder, so we only preserve the cache for the current queries.
2+
// mkdir -p ${COMBINED_CACHE_DIR}
3+
// rm -f **/.cache/{lock,size} # -f to avoid errors if the cache is empty.
4+
// # copy the contents of the .cache folders into the combined cache folder.
5+
// cp -r **/.cache/* ${COMBINED_CACHE_DIR}/ || : # ignore missing files
6+
// # clean up the .cache folders
7+
// rm -rf **/.cache/*
8+
9+
const fs = require("fs");
10+
const path = require("path");
11+
12+
// the first argv is the cache folder to create.
13+
const COMBINED_CACHE_DIR = process.argv[2];
14+
15+
function* walkCaches(dir) {
16+
const files = fs.readdirSync(dir, { withFileTypes: true });
17+
for (const file of files) {
18+
if (file.isDirectory()) {
19+
const filePath = path.join(dir, file.name);
20+
yield* walkCaches(filePath);
21+
if (file.name === ".cache") {
22+
yield filePath;
23+
}
24+
}
25+
}
26+
}
27+
28+
async function copyDir(src, dest) {
29+
for await (const file of await fs.promises.readdir(src, { withFileTypes: true })) {
30+
const srcPath = path.join(src, file.name);
31+
const destPath = path.join(dest, file.name);
32+
if (file.isDirectory()) {
33+
if (!fs.existsSync(destPath)) {
34+
fs.mkdirSync(destPath);
35+
}
36+
await copyDir(srcPath, destPath);
37+
} else {
38+
await fs.promises.copyFile(srcPath, destPath);
39+
}
40+
}
41+
}
42+
43+
async function main() {
44+
const cacheDirs = [...walkCaches(".")];
45+
46+
for (const dir of cacheDirs) {
47+
console.log(`Found .cache dir at ${dir}`);
48+
}
49+
50+
// mkdir -p ${COMBINED_CACHE_DIR}
51+
fs.mkdirSync(COMBINED_CACHE_DIR, { recursive: true });
52+
53+
// rm -f **/.cache/{lock,size} # -f to avoid errors if the cache is empty.
54+
await Promise.all(
55+
cacheDirs.map((cacheDir) =>
56+
(async function () {
57+
await fs.promises.rm(path.join(cacheDir, "lock"), { force: true });
58+
await fs.promises.rm(path.join(cacheDir, "size"), { force: true });
59+
})()
60+
)
61+
);
62+
63+
// # copy the contents of the .cache folders into the combined cache folder.
64+
// cp -r **/.cache/* ${COMBINED_CACHE_DIR}/ || : # ignore missing files
65+
await Promise.all(
66+
cacheDirs.map((cacheDir) => copyDir(cacheDir, COMBINED_CACHE_DIR))
67+
);
68+
69+
// # clean up the .cache folders
70+
// rm -rf **/.cache/*
71+
await Promise.all(
72+
cacheDirs.map((cacheDir) => fs.promises.rm(cacheDir, { recursive: true }))
73+
);
74+
}
75+
main();

.github/actions/fetch-codeql/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ runs:
1919
gh extension install github/gh-codeql
2020
gh codeql set-channel "$CHANNEL"
2121
gh codeql version
22+
printf "CODEQL_FETCHED_CODEQL_PATH=" >> "${GITHUB_ENV}"
23+
gh codeql version --format=json | jq -r .unpackedLocation >> "${GITHUB_ENV}"
2224
gh codeql version --format=json | jq -r .unpackedLocation >> "${GITHUB_PATH}"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Find Latest CodeQL Bundle
2+
description: Finds the URL of the latest released version of the CodeQL bundle.
3+
outputs:
4+
url:
5+
description: The download URL of the latest CodeQL bundle release
6+
value: ${{ steps.find-latest.outputs.url }}
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Find Latest Release
11+
id: find-latest
12+
shell: pwsh
13+
run: |
14+
$Latest = gh release list --repo github/codeql-action --exclude-drafts --limit 1000 |
15+
ForEach-Object { $C = $_ -split "`t"; return @{ type = $C[1]; tag = $C[2]; } } |
16+
Where-Object { $_.type -eq 'Latest' }
17+
18+
$Tag = $Latest.tag
19+
if ($Tag -eq '') {
20+
throw 'Failed to find latest bundle release.'
21+
}
22+
23+
Write-Output "Latest bundle tag is '${Tag}'."
24+
"url=https://github.com/github/codeql-action/releases/download/${Tag}/codeql-bundle-linux64.tar.gz" >> $env:GITHUB_OUTPUT
25+
env:
26+
GITHUB_TOKEN: ${{ github.token }}

.github/actions/os-version/action.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: OS Version
2+
description: Get OS version.
3+
4+
outputs:
5+
version:
6+
description: "OS version"
7+
value: ${{ steps.version.outputs.version }}
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- if: runner.os == 'Linux'
13+
shell: bash
14+
run: |
15+
. /etc/os-release
16+
echo "VERSION=${NAME} ${VERSION}" >> $GITHUB_ENV
17+
- if: runner.os == 'Windows'
18+
shell: powershell
19+
run: |
20+
$objects = systeminfo.exe /FO CSV | ConvertFrom-Csv
21+
"VERSION=$($objects.'OS Name') $($objects.'OS Version')" >> $env:GITHUB_ENV
22+
- if: runner.os == 'macOS'
23+
shell: bash
24+
run: |
25+
echo "VERSION=$(sw_vers -productName) $(sw_vers -productVersion)" >> $GITHUB_ENV
26+
- name: Emit OS version
27+
id: version
28+
shell: bash
29+
run: |
30+
echo "$VERSION"
31+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
32+

.github/dependabot.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
version: 2
22
updates:
33
- package-ecosystem: "cargo"
4-
directory: "ruby/node-types"
5-
schedule:
6-
interval: "daily"
7-
- package-ecosystem: "cargo"
8-
directory: "ruby/generator"
9-
schedule:
10-
interval: "daily"
11-
- package-ecosystem: "cargo"
12-
directory: "ruby/extractor"
13-
schedule:
14-
interval: "daily"
15-
- package-ecosystem: "cargo"
16-
directory: "ruby/autobuilder"
4+
directory: "ruby"
175
schedule:
186
interval: "daily"
197

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
jobs:
1515
atm-check-query-suite:
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-latest-xl
1717

1818
steps:
1919
- uses: actions/checkout@v3
@@ -23,6 +23,12 @@ jobs:
2323
with:
2424
channel: release
2525

26+
- name: Cache compilation cache
27+
id: query-cache
28+
uses: ./.github/actions/cache-query-compilation
29+
with:
30+
key: atm-suite
31+
2632
- name: Install ATM model
2733
run: |
2834
set -exu
@@ -50,10 +56,13 @@ jobs:
5056
echo "SARIF_PATH=${SARIF_PATH}" >> "${GITHUB_ENV}"
5157
5258
codeql database analyze \
59+
--threads=0 \
60+
--ram 50000 \
5361
--format sarif-latest \
5462
--output "${SARIF_PATH}" \
5563
--sarif-group-rules-by-pack \
5664
-vv \
65+
--compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" \
5766
-- \
5867
"${DB_PATH}" \
5968
"${QUERY_PACK}/${QUERY_SUITE}"

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ jobs:
2626
run: |
2727
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq 'any(.[].filename ; test("/change-notes/.*[.]md$"))' |
2828
grep true -c
29+
- name: Fail if the change note filename doesn't match the expected format. The file name must be of the form 'YYYY-MM-DD.md' or 'YYYY-MM-DD-{title}.md', where '{title}' is arbitrary text.
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq '[.[].filename | select(test("/change-notes/.*[.]md$"))] | all(test("/change-notes/[0-9]{4}-[0-9]{2}-[0-9]{2}.*[.]md$"))' |
34+
grep true -c

0 commit comments

Comments
 (0)