Skip to content

Commit fd2bf7c

Browse files
Enable CodeQL (#285)
* Enable CodeQL * Build cortex-m0 in CodeQL * Trigger the CodeQL by cron only
1 parent 8ff9910 commit fd2bf7c

1 file changed

Lines changed: 109 additions & 0 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
schedule:
16+
- cron: '33 1 * * 6'
17+
18+
jobs:
19+
analyze:
20+
name: Analyze
21+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
22+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
23+
permissions:
24+
actions: read
25+
contents: read
26+
security-events: write
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
language: [ 'cpp' ]
32+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
33+
# Use only 'java' to analyze code written in Java, Kotlin or both
34+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
35+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v3
40+
41+
# Initializes the CodeQL tools for scanning.
42+
- name: Initialize CodeQL
43+
uses: github/codeql-action/init@v2
44+
with:
45+
languages: ${{ matrix.language }}
46+
# If you wish to specify custom queries, you can do so here or in a config file.
47+
# By default, queries listed here will override any specified in a config file.
48+
# Prefix the list here with "+" to use these queries and those in the config file.
49+
50+
# 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
51+
# queries: security-extended,security-and-quality
52+
53+
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
#- name: Autobuild
57+
# uses: github/codeql-action/autobuild@v2
58+
59+
60+
# ℹ️ Command-line programs to run using the OS shell.
61+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
62+
63+
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
65+
66+
#- run: |
67+
# echo "Run, Build Application using script"
68+
# ./scripts/install.sh
69+
# ./test/tx/cmake/run.sh build
70+
71+
# Store the arm compilers in the cache to speed up builds
72+
- name: Cache arm-none-eabi-gcc tools
73+
id: cache-arm-gcc
74+
uses: actions/cache@v1
75+
with:
76+
path: $HOME/arm-none-eabi-gcc-9-2019-q4
77+
key: ${{ runner.os }}-arm-gcc-9-2019-q4
78+
79+
# Get the arm-non-eabi-gcc toolchain
80+
- name: Install arm-none-eabi-gcc
81+
uses: fiam/arm-none-eabi-gcc@v1
82+
if: steps.cache-arm-gcc.outputs.cache-hit != 'true'
83+
with:
84+
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
85+
directory: $HOME/arm-none-eabi-gcc-9-2019-q4
86+
87+
# Get CMake into the environment
88+
- name: Install cmake 3.19.1
89+
uses: lukka/get-cmake@v3.19.1
90+
91+
# Get Ninja into the environment
92+
- name: Install ninja-build
93+
uses: seanmiddleditch/gha-setup-ninja@v3
94+
95+
# Prepare the build system
96+
- name: Prepare build system
97+
run: cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=./cmake/cortex_m0.cmake -GNinja .
98+
env:
99+
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
100+
101+
- name: Compile and link
102+
run: cmake --build ./build
103+
env:
104+
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
105+
106+
- name: Perform CodeQL Analysis
107+
uses: github/codeql-action/analyze@v2
108+
with:
109+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)