Skip to content

Commit b829784

Browse files
authored
build: split codeql runners into sections to try to reduce runtime headaches (#8163)
* build: split codeql runners into sections to try to reduce runtime headaches * build: switch codeql config to an exclude list for the main repo scan
1 parent fd1d5b9 commit b829784

6 files changed

Lines changed: 150 additions & 11 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
paths:
2+
- 'packages'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
paths:
2+
- 'core'
3+
- 'handwritten'

.github/codeql/codeql-repo.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
paths-ignore:
2+
- 'packages'
3+
- 'core'
4+
- 'handwritten'
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "CodeQL Advanced - autogenerated"
2+
3+
# The CodeQL jobs are kept separately so that their run time doesn't
4+
# exceed the max for an action job on GitHub.
5+
6+
on:
7+
schedule:
8+
- cron: '0 2 * * *'
9+
10+
jobs:
11+
analyze:
12+
name: Analyze (${{ matrix.language }})
13+
# Runner size impacts CodeQL analysis time. To learn more, please see:
14+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
15+
# - https://gh.io/supported-runners-and-hardware-resources
16+
# - https://gh.io/using-larger-runners (GitHub.com only)
17+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
18+
runs-on: ${{ 'ubuntu-latest' }}
19+
permissions:
20+
# required for all workflows
21+
security-events: write
22+
23+
# required to fetch internal or private CodeQL packs
24+
packages: read
25+
26+
# only required for workflows in private repositories
27+
actions: read
28+
contents: read
29+
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
include:
34+
- language: actions
35+
build-mode: none
36+
- language: javascript-typescript
37+
build-mode: none
38+
- language: python
39+
build-mode: none
40+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
41+
# Use `c-cpp` to analyze code written in C, C++ or both
42+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
43+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
44+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
45+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
46+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
47+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
52+
# Add any setup steps before running the `github/codeql-action/init` action.
53+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
54+
# or others). This is typically only required for manual builds.
55+
# - name: Setup runtime (example)
56+
# uses: actions/setup-example@v1
57+
58+
# Initializes the CodeQL tools for scanning - autogen flavour.
59+
- name: Initialize CodeQL for autogenerated
60+
uses: github/codeql-action/init@v4
61+
with:
62+
config-file: .github/codeql/codeql-autogenerated.yml
63+
languages: ${{ matrix.language }}
64+
build-mode: ${{ matrix.build-mode }}
65+
- name: Perform CodeQL Analysis for autogenerated
66+
uses: github/codeql-action/analyze@v4
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "CodeQL Advanced - handwritten"
2+
3+
# The CodeQL jobs are kept separately so that their run time doesn't
4+
# exceed the max for an action job on GitHub.
5+
6+
on:
7+
schedule:
8+
- cron: '30 1 * * *'
9+
10+
jobs:
11+
analyze:
12+
name: Analyze (${{ matrix.language }})
13+
# Runner size impacts CodeQL analysis time. To learn more, please see:
14+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
15+
# - https://gh.io/supported-runners-and-hardware-resources
16+
# - https://gh.io/using-larger-runners (GitHub.com only)
17+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
18+
runs-on: ${{ 'ubuntu-latest' }}
19+
permissions:
20+
# required for all workflows
21+
security-events: write
22+
23+
# required to fetch internal or private CodeQL packs
24+
packages: read
25+
26+
# only required for workflows in private repositories
27+
actions: read
28+
contents: read
29+
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
include:
34+
- language: actions
35+
build-mode: none
36+
- language: javascript-typescript
37+
build-mode: none
38+
- language: python
39+
build-mode: none
40+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
41+
# Use `c-cpp` to analyze code written in C, C++ or both
42+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
43+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
44+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
45+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
46+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
47+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
52+
# Add any setup steps before running the `github/codeql-action/init` action.
53+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
54+
# or others). This is typically only required for manual builds.
55+
# - name: Setup runtime (example)
56+
# uses: actions/setup-example@v1
57+
58+
# Initializes the CodeQL tools for scanning - handwritten flavour.
59+
- name: Initialize CodeQL for handwritten
60+
uses: github/codeql-action/init@v4
61+
with:
62+
config-file: .github/codeql/codeql-handwritten.yml
63+
languages: ${{ matrix.language }}
64+
build-mode: ${{ matrix.build-mode }}
65+
- name: Perform CodeQL Analysis for handwritten
66+
uses: github/codeql-action/analyze@v4
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
name: "CodeQL Advanced"
1+
name: "CodeQL Advanced - repo meta"
2+
3+
# The CodeQL jobs are kept separately so that their run time doesn't
4+
# exceed the max for an action job on GitHub.
25

36
on:
47
schedule:
5-
- cron: '0 4 * * *'
8+
- cron: '0 1 * * *'
69

710
jobs:
811
analyze:
@@ -52,18 +55,13 @@ jobs:
5255
# - name: Setup runtime (example)
5356
# uses: actions/setup-example@v1
5457

55-
# Initializes the CodeQL tools for scanning.
56-
- name: Initialize CodeQL
58+
# Initializes the CodeQL tools for scanning - repo meta flavour.
59+
- name: Initialize CodeQL for repo meta
5760
uses: github/codeql-action/init@v4
5861
with:
62+
config-file: .github/codeql/codeql-repo.yml
5963
languages: ${{ matrix.language }}
6064
build-mode: ${{ matrix.build-mode }}
61-
# If you wish to specify custom queries, you can do so here or in a config file.
62-
# By default, queries listed here will override any specified in a config file.
63-
# Prefix the list here with "+" to use these queries and those in the config file.
64-
65-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
66-
# queries: security-extended,security-and-quality
6765

68-
- name: Perform CodeQL Analysis
66+
- name: Perform CodeQL Analysis for repo meta
6967
uses: github/codeql-action/analyze@v4

0 commit comments

Comments
 (0)