• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15# Author: Joyce Brum <joycebrum@google.com>
16
17name: "CodeQL"
18
19on:
20  push:
21    branches: [ "main" ]
22  pull_request:
23    # The branches below must be a subset of the branches above
24    branches: [ "main" ]
25  schedule:
26    - cron: '26 7 * * 1'
27
28permissions: {}
29
30jobs:
31  analyze:
32    name: Analyze
33    # Runner size impacts CodeQL analysis time. To learn more, please see:
34    #   - https://gh.io/recommended-hardware-resources-for-running-codeql
35    #   - https://gh.io/supported-runners-and-hardware-resources
36    #   - https://gh.io/using-larger-runners
37    # Consider using larger runners for possible analysis time improvements.
38    runs-on: 'ubuntu-latest'
39    timeout-minutes: 360
40    permissions:
41      actions: read
42      contents: read
43      security-events: write
44
45    strategy:
46      fail-fast: false
47      matrix:
48        language: [ 'cpp', 'python' ]
49
50    steps:
51    - name: Checkout repository
52      uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
53
54    # Initializes the CodeQL tools for scanning.
55    - name: Initialize CodeQL
56      uses: github/codeql-action/init@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12
57      with:
58        languages: ${{ matrix.language }}
59    #     If you wish to specify custom queries, you can do so here or in a config file.
60    #     By default, queries listed here will override any specified in a config file.
61    #     Prefix the list here with "+" to use these queries and those in the config file.
62
63    #     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
64    #     queries: security-extended,security-and-quality
65
66
67    # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
68    # If this step fails, then you should remove it and run the build manually
69    - name: Autobuild
70      if: matrix.language == 'python'
71      uses: github/codeql-action/autobuild@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12
72
73    - uses: actions/setup-python@v5
74      if: matrix.language == 'cpp'
75      with:
76        python-version: '3.7'
77    - uses: lukka/get-cmake@latest
78      if: matrix.language == 'cpp'
79      with:
80        cmakeVersion: 3.17.2
81    - name: Install Dependencies
82      if: matrix.language == 'cpp'
83      run: |
84        sudo apt update
85        sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev
86
87    - name: Generate build files
88      if: matrix.language == 'cpp'
89      run: cmake -S. -B build -D CMAKE_BUILD_TYPE=Release -D UPDATE_DEPS=ON
90      env:
91        CC: gcc
92        CXX: g++
93
94    - name: Build the loader
95      if: matrix.language == 'cpp'
96      run: cmake --build build
97
98    - name: Perform CodeQL Analysis
99      uses: github/codeql-action/analyze@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12
100      with:
101        category: "/language:${{matrix.language}}"
102