Skip to content

Commit 3f68750

Browse files
committed
ci: move the Rust CodeQL analysis off the pull-request path
DO NOT MERGE THIS COMMIT WHILE CODE SCANNING DEFAULT SETUP IS ENABLED. GitHub refuses uploads from an advanced configuration while the default one is active, so the setting has to be turned off first -- Settings -> Code security -> Code scanning -> CodeQL analysis -> Disable. The file says so at the top as well. It is the last commit in the series so it can be dropped on its own. `Analyze (rust)` is 17.4 minutes, the single largest job in the repository, larger than the full Rust test suite, because CodeQL builds the whole workspace under its tracer. The other five languages together come to about five minutes. Rust moves to pushes on `next` and to the weekly schedule. Every finding it would have made is still made, on the merge commit rather than on the pull request that produced it -- reported one merge later, not missed. The cheap languages keep running per pull request. `c-cpp` is dropped: the repository contains one C file, `tools/sca/examples/hello-c/src/server.c`, which is example material for a supply-chain-analysis demo and ships in nothing.
1 parent d335ea9 commit 3f68750

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# SPDX-FileCopyrightText: © 2026 Phala Network <dstack@phala.network>
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# CodeQL, as an advanced configuration.
6+
#
7+
# THIS FILE CANNOT BE MERGED WHILE CODE SCANNING DEFAULT SETUP IS ENABLED.
8+
# GitHub refuses uploads from an advanced configuration while the default one is
9+
# active, so that setting has to be turned off first:
10+
#
11+
# Settings -> Code security -> Code scanning -> CodeQL analysis -> Disable
12+
#
13+
# or
14+
#
15+
# gh api -X PATCH repos/Dstack-TEE/dstack/code-scanning/default-setup \
16+
# -f state=not-configured
17+
#
18+
# What changes, and what it costs:
19+
#
20+
# Default setup runs every language on every pull request. `Analyze (rust)` is
21+
# 17.4 minutes of that -- the single largest job in the repository, larger than
22+
# the full Rust test suite -- because CodeQL builds the whole workspace under
23+
# its tracer. The other five languages together come to about five minutes.
24+
#
25+
# Rust moves to pushes on `next` and to the weekly schedule. Every finding it
26+
# would have made is still made, on the merge commit rather than on the pull
27+
# request that produced it: a regression is reported one merge later than it
28+
# would have been, not missed. The cheap languages keep running per pull
29+
# request, where they cost little and catch things early.
30+
#
31+
# `c-cpp` is dropped. The repository contains exactly one C file,
32+
# `tools/sca/examples/hello-c/src/server.c`, which is example material for a
33+
# supply-chain-analysis demo and is not shipped in any image.
34+
35+
name: CodeQL
36+
37+
on:
38+
push:
39+
branches: [next, 'release/**']
40+
pull_request:
41+
branches: [next, 'release/**']
42+
schedule:
43+
# Weekly, matching the cadence default setup was running.
44+
- cron: '31 4 * * 1'
45+
46+
permissions:
47+
contents: read
48+
49+
jobs:
50+
analyze:
51+
name: Analyze (${{ matrix.language }})
52+
runs-on: ubuntu-latest
53+
permissions:
54+
security-events: write
55+
packages: read
56+
actions: read
57+
contents: read
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
include:
62+
- language: actions
63+
build-mode: none
64+
- language: go
65+
build-mode: autobuild
66+
- language: javascript-typescript
67+
build-mode: none
68+
- language: python
69+
build-mode: none
70+
steps:
71+
- uses: actions/checkout@v5
72+
73+
- name: Initialize CodeQL
74+
uses: github/codeql-action/init@v3
75+
with:
76+
languages: ${{ matrix.language }}
77+
build-mode: ${{ matrix.build-mode }}
78+
79+
- name: Perform CodeQL Analysis
80+
uses: github/codeql-action/analyze@v3
81+
with:
82+
category: /language:${{ matrix.language }}
83+
84+
# Rust is separated for what it costs, not because it matters less. Gated with
85+
# `if:` rather than a `paths:` filter so the weekly schedule still reaches it.
86+
analyze-rust:
87+
name: Analyze (rust)
88+
if: github.event_name != 'pull_request'
89+
runs-on: ubuntu-latest
90+
permissions:
91+
security-events: write
92+
packages: read
93+
actions: read
94+
contents: read
95+
steps:
96+
- uses: actions/checkout@v5
97+
98+
- name: Initialize CodeQL
99+
uses: github/codeql-action/init@v3
100+
with:
101+
languages: rust
102+
build-mode: autobuild
103+
104+
- name: Perform CodeQL Analysis
105+
uses: github/codeql-action/analyze@v3
106+
with:
107+
category: /language:rust

0 commit comments

Comments
 (0)