Skip to content

Commit 2b386c4

Browse files
authored
Merge pull request #17839 from github/redsun82/rust-analysis
Rust: add codeql analysis workflow
2 parents d4db759 + 5a84d29 commit 2b386c4

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/rust-analysis.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "Code scanning - Rust"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'rc/*'
8+
pull_request:
9+
branches:
10+
- main
11+
- 'rc/*'
12+
paths:
13+
- '**/*.rs'
14+
- '**/Cargo.toml'
15+
- '.github/codeql/codeql-config.yml'
16+
- '.github/workflows/rust-analysis.yml'
17+
schedule:
18+
- cron: '0 9 * * 1'
19+
20+
env:
21+
CODEQL_ENABLE_EXPERIMENTAL_FEATURES: "true"
22+
23+
jobs:
24+
analyze:
25+
strategy:
26+
matrix:
27+
language: [ 'rust' ]
28+
29+
runs-on: ubuntu-latest
30+
31+
permissions:
32+
contents: read
33+
security-events: write
34+
pull-requests: read
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v4
39+
40+
- name: Query latest nightly CodeQL bundle
41+
shell: bash
42+
id: codeql
43+
env:
44+
GITHUB_TOKEN: ${{ github.token }}
45+
run: |
46+
REPO=dsp-testing/codeql-cli-nightlies
47+
TAG=$(
48+
gh release list -R $REPO -L1 --exclude-drafts --json tagName -q ".[] | .tagName"
49+
)
50+
echo "nightly_bundle=https://github.com/$REPO/releases/download/$TAG/codeql-bundle-linux64.tar.zst" \
51+
| tee -a "$GITHUB_OUTPUT"
52+
53+
- name: Initialize CodeQL
54+
uses: github/codeql-action/init@main
55+
with:
56+
tools: ${{ steps.codeql.outputs.nightly_bundle }}
57+
languages: ${{ matrix.language }}
58+
config: |
59+
disable-default-queries: true
60+
queries:
61+
- uses: security-and-quality
62+
paths-ignore:
63+
- '/rust/ql/tests'
64+
65+
- name: Autobuild
66+
uses: github/codeql-action/autobuild@main
67+
68+
- name: Perform CodeQL Analysis
69+
uses: github/codeql-action/analyze@main

0 commit comments

Comments
 (0)