|
| 1 | +name: Weekly Code Scanning |
| 2 | + |
| 3 | +#on: [push, pull_request] |
| 4 | +on: |
| 5 | + schedule: |
| 6 | + - cron: "0 0 1 * *" # First day of the months |
| 7 | + |
| 8 | +# For most projects, this workflow file will not need changing; you simply need |
| 9 | +# to commit it to your repository. |
| 10 | +# |
| 11 | +# You may wish to alter this file to override the set of languages analyzed, |
| 12 | +# or to provide custom queries or build logic. |
| 13 | +# |
| 14 | +jobs: |
| 15 | + analyze: |
| 16 | + name: Analyze (${{ matrix.name }}) |
| 17 | + # Runner size impacts CodeQL analysis time. To learn more, please see: |
| 18 | + # - https://gh.io/recommended-hardware-resources-for-running-codeql |
| 19 | + # - https://gh.io/supported-runners-and-hardware-resources |
| 20 | + # - https://gh.io/using-larger-runners (GitHub.com only) |
| 21 | + # Consider using larger runners or machines with greater resources for possible analysis time improvements. |
| 22 | + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || (matrix.version == 'mac-x64' && 'macos-12') || 'ubuntu-latest' }} |
| 23 | + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} |
| 24 | + permissions: |
| 25 | + # required for all workflows |
| 26 | + security-events: write |
| 27 | + |
| 28 | + # required to fetch internal or private CodeQL packs |
| 29 | + #packages: read |
| 30 | + |
| 31 | + # only required for workflows in private repositories |
| 32 | + #actions: read |
| 33 | + #contents: read |
| 34 | + |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + include: |
| 39 | + #- name: c-cpp (auto) |
| 40 | + # language: c-cpp |
| 41 | + # build-mode: autobuild |
| 42 | + #- name: c-cpp (win-x86) |
| 43 | + # language: c-cpp |
| 44 | + # build-mode: manual |
| 45 | + # version: win-x86 |
| 46 | + # cmakeargs: '-DDEVILUTIONX_SYSTEM_LIBSODIUM=OFF -DDEVILUTIONX_SYSTEM_SDL2=OFF -DUSE_PATCH=ON -DHELLFIRE=ON -DCMAKE_TOOLCHAIN_FILE=../CMake/mingwcc.toolchain.cmake' |
| 47 | + - name: c-cpp (win-x64) |
| 48 | + language: c-cpp |
| 49 | + build-mode: manual |
| 50 | + version: win-x64 |
| 51 | + cmakeargs: '-DDEVILUTIONX_SYSTEM_LIBSODIUM=OFF -DDEVILUTIONX_SYSTEM_SDL2=OFF -DUSE_PATCH=ON -DHELLFIRE=ON -DCMAKE_TOOLCHAIN_FILE=../CMake/mingwcc64.toolchain.cmake' |
| 52 | + #- name: c-cpp (linux-x64) |
| 53 | + # language: c-cpp |
| 54 | + # build-mode: manual |
| 55 | + # version: linux-x64 |
| 56 | + # cmakeargs: '-DDEVILUTIONX_SYSTEM_LIBSODIUM=OFF -DDEVILUTIONX_SYSTEM_SDL2=OFF -DUSE_PATCH=ON -DHELLFIRE=ON -DCMAKE_INSTALL_PREFIX=/usr' |
| 57 | + #- name: c-cpp (mac-x64) |
| 58 | + # language: c-cpp |
| 59 | + # build-mode: manual |
| 60 | + # version: mac-x64 |
| 61 | + # cmakeargs: '-DDEVILUTIONX_SYSTEM_LIBSODIUM=OFF -DDEVILUTIONX_SYSTEM_SDL2=OFF -DUSE_PATCH=ON -DHELLFIRE=ON -DMACOSX_STANDALONE_APP_BUNDLE=ON' |
| 62 | + - name: java |
| 63 | + language: java-kotlin |
| 64 | + build-mode: none # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too. |
| 65 | + - name: python |
| 66 | + language: python |
| 67 | + build-mode: none |
| 68 | + #- language: ruby |
| 69 | + # build-mode: none |
| 70 | + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' |
| 71 | + # Use `c-cpp` to analyze code written in C, C++ or both |
| 72 | + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both |
| 73 | + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both |
| 74 | + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, |
| 75 | + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. |
| 76 | + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how |
| 77 | + # 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 |
| 78 | + steps: |
| 79 | + - name: Checkout repository |
| 80 | + uses: actions/checkout@v4 |
| 81 | + |
| 82 | + # Initializes the CodeQL tools for scanning. |
| 83 | + - name: Initialize CodeQL |
| 84 | + uses: github/codeql-action/init@v3 |
| 85 | + with: |
| 86 | + languages: ${{ matrix.language }} |
| 87 | + build-mode: ${{ matrix.build-mode }} |
| 88 | + #debug: true |
| 89 | + # If you wish to specify custom queries, you can do so here or in a config file. |
| 90 | + # By default, queries listed here will override any specified in a config file. |
| 91 | + # Prefix the list here with "+" to use these queries and those in the config file. |
| 92 | + |
| 93 | + # 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 |
| 94 | + # queries: security-extended,security-and-quality |
| 95 | + |
| 96 | + # If the analyze step fails for one of the languages you are analyzing with |
| 97 | + # "We were unable to automatically build your code", modify the matrix above |
| 98 | + # to set the build mode to "manual" for that language. Then modify this step |
| 99 | + # to build your code. |
| 100 | + # ℹ️ Command-line programs to run using the OS shell. |
| 101 | + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
| 102 | + - name: Create Build Environment |
| 103 | + if: matrix.version == 'win-x86' |
| 104 | + run: > |
| 105 | + sudo apt-get update && |
| 106 | + sudo apt install -y cmake gcc-mingw-w64-i686 g++-mingw-w64-i686 pkg-config-mingw-w64-i686 libz-mingw-w64-dev gettext dpkg-dev wget git sudo && |
| 107 | + sudo rm /usr/i686-w64-mingw32/lib/libz.dll.a && |
| 108 | + sudo Packaging/windows/mingw-prep.sh |
| 109 | +
|
| 110 | + - name: Create Build Environment |
| 111 | + if: matrix.version == 'win-x64' |
| 112 | + run: > |
| 113 | + sudo apt-get update && |
| 114 | + sudo apt-get install -y cmake gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 pkg-config-mingw-w64-x86-64 libz-mingw-w64-dev dpkg-dev wget git sudo && |
| 115 | + sudo rm /usr/x86_64-w64-mingw32/lib/libz.dll.a && |
| 116 | + sudo Packaging/windows/mingw-prep.sh |
| 117 | +
|
| 118 | + - name: Create Build Environment |
| 119 | + if: matrix.version == 'linux-x64' |
| 120 | + run: Packaging/nix/debian-host-prep.sh |
| 121 | + |
| 122 | + - name: Create Build Environment |
| 123 | + if: matrix.version == 'mac-x64' |
| 124 | + run: brew bundle install |
| 125 | + |
| 126 | + # TODO: -j $(nproc) vs. -j $(sysctl -n hw.physicalcpu) |
| 127 | + - name: Build |
| 128 | + if: matrix.build-mode == 'manual' |
| 129 | + shell: bash |
| 130 | + run: | |
| 131 | + cmake -S. -Bbuild ${{ matrix.cmakeargs }} -DCMAKE_BUILD_TYPE="Release" && \ |
| 132 | + cmake --build build --target package |
| 133 | +
|
| 134 | + - name: Perform CodeQL Analysis |
| 135 | + uses: github/codeql-action/analyze@v3 |
| 136 | + with: |
| 137 | + category: "/language:${{matrix.language}}${{matrix.version}}" |
| 138 | + |
0 commit comments