Skip to content

Commit 81c7d4a

Browse files
author
Gonzalo Diaz
committed
[CONFIG] [Github Actions] CodeQL code analisys tool added.
1 parent 74e7061 commit 81c7d4a

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
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+
13+
---
14+
name: "CodeQL Advanced"
15+
16+
on: # yamllint disable-line rule:truthy
17+
push:
18+
branches: ["main"]
19+
pull_request:
20+
branches: ["main"]
21+
workflow_dispatch:
22+
schedule:
23+
# ┌───────────── minute (0 - 59)
24+
# │ ┌───────────── hour (0 - 23)
25+
# │ │ ┌───────────── day of the month (1 - 31)
26+
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
27+
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
28+
# │ │ │ │ │
29+
# │ │ │ │ │
30+
# │ │ │ │ │
31+
# * * * * *
32+
- cron: '16 20 * * 0'
33+
34+
jobs:
35+
analyze:
36+
name: Analyze (${{ matrix.language }})
37+
# Runner size impacts CodeQL analysis time. To learn more, please see:
38+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
39+
# - https://gh.io/supported-runners-and-hardware-resources
40+
# - https://gh.io/using-larger-runners (GitHub.com only)
41+
# Consider using larger runners or machines with greater resources
42+
# for possible analysis time improvements.
43+
runs-on:
44+
${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
45+
permissions:
46+
# required for all workflows
47+
security-events: write
48+
49+
# required to fetch internal or private CodeQL packs
50+
packages: read
51+
52+
# only required for workflows in private repositories
53+
actions: read
54+
contents: read
55+
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
include:
60+
- language: c-cpp
61+
build-mode: manual
62+
# yamllint disable rule:line-length
63+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
64+
# Use `c-cpp` to analyze code written in C, C++ or both
65+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
66+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
67+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
68+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
69+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
70+
# 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
71+
# yamllint enable rule:line-length
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v4
75+
76+
- name: Check Tools
77+
run: |
78+
make --version
79+
cmake --version
80+
vcpkg --version
81+
82+
- name: Install dependencies
83+
run: |
84+
vcpkg --x-wait-for-lock integrate install
85+
vcpkg --x-wait-for-lock install
86+
87+
# Initializes the CodeQL tools for scanning.
88+
- name: Initialize CodeQL
89+
uses: github/codeql-action/init@v3
90+
with:
91+
languages: ${{ matrix.language }}
92+
build-mode: ${{ matrix.build-mode }}
93+
# yamllint disable rule:line-length
94+
# If you wish to specify custom queries, you can do so here or in a config file.
95+
# By default, queries listed here will override any specified in a config file.
96+
# Prefix the list here with "+" to use these queries and those in the config file.
97+
98+
# 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
99+
# queries: security-extended,security-and-quality
100+
# yamllint enable rule:line-length
101+
102+
# yamllint disable rule:line-length
103+
# If the analyze step fails for one of the languages you are analyzing with
104+
# "We were unable to automatically build your code", modify the matrix above
105+
# to set the build mode to "manual" for that language. Then modify this step
106+
# to build your code.
107+
# ℹ️ Command-line programs to run using the OS shell.
108+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
109+
# yamllint enaable rule:line-length
110+
- if: matrix.build-mode == 'manual'
111+
shell: bash
112+
run: |
113+
export VCPKG_ROOT=/usr/local/share/vcpkg
114+
cmake --preset debug -B build
115+
cmake --preset debug \
116+
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
117+
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
118+
build
119+
cmake --build build --verbose
120+
121+
- name: Perform CodeQL Analysis
122+
uses: github/codeql-action/analyze@v3
123+
with:
124+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)