|
| 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 | + push: |
| 16 | + branches: [ "main" ] |
| 17 | + pull_request: |
| 18 | + branches: [ "main" ] |
| 19 | + schedule: |
| 20 | + - cron: '41 6 * * 6' |
| 21 | + |
| 22 | +jobs: |
| 23 | + build: |
| 24 | + name: Roslyn Compiler Warnings |
| 25 | + runs-on: [ self-hosted ] |
| 26 | + env: |
| 27 | + # Required for actions/setup-dotnet@v3 on self-hosted runners where runners don't have sudo permissions |
| 28 | + DOTNET_INSTALL_DIR: "./.dotnet" |
| 29 | + steps: |
| 30 | + - name: Checkout repository |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + submodules: 'recursive' |
| 34 | + |
| 35 | + # Install the .NET Core workload |
| 36 | + - name: Install .NET Core |
| 37 | + uses: actions/setup-dotnet@v3 |
| 38 | + with: |
| 39 | + dotnet-version: 8.x.x |
| 40 | + |
| 41 | + # Execute the build |
| 42 | + - name: Execute Release Build |
| 43 | + working-directory: ./src |
| 44 | + run: dotnet build --configuration Release |
| 45 | + test: |
| 46 | + name: Tests |
| 47 | + runs-on: [ self-hosted ] |
| 48 | + env: |
| 49 | + # Required for actions/setup-dotnet@v3 on self-hosted runners where runners don't have sudo permissions |
| 50 | + DOTNET_INSTALL_DIR: "./.dotnet" |
| 51 | + steps: |
| 52 | + - name: Checkout repository |
| 53 | + uses: actions/checkout@v4 |
| 54 | + with: |
| 55 | + submodules: 'recursive' |
| 56 | + |
| 57 | + # Install the .NET Core workload |
| 58 | + - name: Install .NET Core |
| 59 | + uses: actions/setup-dotnet@v3 |
| 60 | + with: |
| 61 | + dotnet-version: 8.x.x |
| 62 | + |
| 63 | + # Execute the tests |
| 64 | + - name: Execute Tests |
| 65 | + working-directory: ./src |
| 66 | + run: dotnet test |
| 67 | + |
| 68 | + code-ql: |
| 69 | + name: Analyze |
| 70 | + # Runner size impacts CodeQL analysis time. To learn more, please see: |
| 71 | + # - https://gh.io/recommended-hardware-resources-for-running-codeql |
| 72 | + # - https://gh.io/supported-runners-and-hardware-resources |
| 73 | + # - https://gh.io/using-larger-runners |
| 74 | + # Consider using larger runners for possible analysis time improvements. |
| 75 | + runs-on: [ self-hosted ] |
| 76 | + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} |
| 77 | + permissions: |
| 78 | + # required for all workflows |
| 79 | + security-events: write |
| 80 | + |
| 81 | + # only required for workflows in private repositories |
| 82 | + actions: read |
| 83 | + contents: read |
| 84 | + |
| 85 | + strategy: |
| 86 | + fail-fast: false |
| 87 | + matrix: |
| 88 | + language: [ 'csharp' ] |
| 89 | + # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] |
| 90 | + # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both |
| 91 | + # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both |
| 92 | + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support |
| 93 | + env: |
| 94 | + # Required for actions/setup-dotnet@v3 on self-hosted runners where runners don't have sudo permissions |
| 95 | + DOTNET_INSTALL_DIR: "./.dotnet" |
| 96 | + steps: |
| 97 | + - name: Checkout repository |
| 98 | + uses: actions/checkout@v4 |
| 99 | + with: |
| 100 | + submodules: 'recursive' |
| 101 | + |
| 102 | + # Initializes the CodeQL tools for scanning. |
| 103 | + - name: Initialize CodeQL |
| 104 | + uses: github/codeql-action/init@v3 |
| 105 | + with: |
| 106 | + languages: ${{ matrix.language }} |
| 107 | + # If you wish to specify custom queries, you can do so here or in a config file. |
| 108 | + # By default, queries listed here will override any specified in a config file. |
| 109 | + # Prefix the list here with "+" to use these queries and those in the config file. |
| 110 | + |
| 111 | + # 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 |
| 112 | + # queries: security-extended,security-and-quality |
| 113 | + |
| 114 | + |
| 115 | + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). |
| 116 | + # If this step fails, then you should remove it and run the build manually (see below) |
| 117 | + # - name: Autobuild |
| 118 | + # uses: github/codeql-action/autobuild@v3 |
| 119 | + # Install the .NET Core workload |
| 120 | + - name: Install .NET Core |
| 121 | + uses: actions/setup-dotnet@v3 |
| 122 | + with: |
| 123 | + dotnet-version: 8.x.x |
| 124 | + |
| 125 | + # Execute the build |
| 126 | + - name: Execute Build |
| 127 | + working-directory: ./src |
| 128 | + run: dotnet build |
| 129 | + |
| 130 | + # ℹ️ Command-line programs to run using the OS shell. |
| 131 | + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
| 132 | + |
| 133 | + # If the Autobuild fails above, remove it and uncomment the following three lines. |
| 134 | + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. |
| 135 | + |
| 136 | + # - run: | |
| 137 | + # echo "Run, Build Application using script" |
| 138 | + # ./location_of_script_within_repo/buildscript.sh |
| 139 | + |
| 140 | + - name: Perform CodeQL Analysis |
| 141 | + uses: github/codeql-action/analyze@v3 |
| 142 | + with: |
| 143 | + category: "/language:${{matrix.language}}" |
0 commit comments