| 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 <[email protected]> |
| 16 | |
| 17 | name: "CodeQL" |
| 18 | |
| 19 | on: |
| 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 | |
| 28 | permissions: {} |
| 29 | |
| 30 | jobs: |
| 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.1 |
| 53 | |
| 54 | # Initializes the CodeQL tools for scanning. |
| 55 | - name: Initialize CodeQL |
| 56 | uses: github/codeql-action/init@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v3.29.5 |
| 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@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v3.29.5 |
| 72 | |
| 73 | - uses: actions/setup-python@v6 |
| 74 | if: matrix.language == 'cpp' |
| 75 | with: |
| 76 | python-version: '3.11' |
| 77 | - name: Install Dependencies |
| 78 | if: matrix.language == 'cpp' |
| 79 | run: | |
| 80 | sudo apt update |
| 81 | sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev |
| 82 | |
| 83 | - name: Generate build files |
| 84 | if: matrix.language == 'cpp' |
| 85 | run: cmake -S. -B build -D CMAKE_BUILD_TYPE=Release -D UPDATE_DEPS=ON |
| 86 | env: |
| 87 | CC: gcc |
| 88 | CXX: g++ |
| 89 | |
| 90 | - name: Build the loader |
| 91 | if: matrix.language == 'cpp' |
| 92 | run: cmake --build build |
| 93 | |
| 94 | - name: Perform CodeQL Analysis |
| 95 | uses: github/codeql-action/analyze@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v3.29.5 |
| 96 | with: |
| 97 | category: "/language:${{matrix.language}}" |