|
| 1 | +name: Build CodeQL Queries |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ main ] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + compile: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + # language: [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ] |
| 16 | + language: [ 'java' ] |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + with: |
| 21 | + submodules: true |
| 22 | + |
| 23 | + # Conditionally run actions based on files modified by PR, feature branch or pushed commits |
| 24 | + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 |
| 25 | + id: changes |
| 26 | + with: |
| 27 | + filters: | |
| 28 | + src: |
| 29 | + - '${{ matrix.language }}/**' |
| 30 | +
|
| 31 | + - name: Install CodeQL |
| 32 | + if: steps.changes.outputs.src == 'true' |
| 33 | + env: |
| 34 | + GITHUB_TOKEN: ${{ github.token }} |
| 35 | + run: | |
| 36 | + gh repo clone github/codeql |
| 37 | + gh extension install github/gh-codeql |
| 38 | + gh codeql pack download "codeql/${{ matrix.language }}-queries" |
| 39 | + gh codeql pack install --additional-packs=./codeql/misc "${{ matrix.language }}" |
| 40 | +
|
| 41 | + - name: Compile Queries |
| 42 | + if: steps.changes.outputs.src == 'true' |
| 43 | + env: |
| 44 | + GITHUB_TOKEN: ${{ github.token }} |
| 45 | + run: | |
| 46 | + ./.github/scripts/pr-compile.sh ${{ github.event.number }} ${{ matrix.language }} |
| 47 | +
|
| 48 | + - name: Test Queries |
| 49 | + if: steps.changes.outputs.src == 'true' |
| 50 | + env: |
| 51 | + GITHUB_TOKEN: ${{ github.token }} |
| 52 | + run: | |
| 53 | + ./.github/scripts/pr-tests.sh ${{ github.event.number }} ${{ matrix.language }} |
| 54 | +
|
| 55 | + - name: Compile / Check Suites & Packs |
| 56 | + if: steps.changes.outputs.src == 'true' |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ github.token }} |
| 59 | + run: | |
| 60 | + ./.github/scripts/pr-suites-packs.sh ${{ github.event.number }} ${{ matrix.language }} |
| 61 | +
|
| 62 | + extensions: |
| 63 | + runs-on: ubuntu-latest |
| 64 | + |
| 65 | + strategy: |
| 66 | + fail-fast: false |
| 67 | + matrix: |
| 68 | + # language: [ 'csharp', 'java', 'javascript' ] |
| 69 | + language: [ 'java' ] |
| 70 | + |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v3 |
| 73 | + with: |
| 74 | + submodules: true |
| 75 | + |
| 76 | + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 |
| 77 | + id: changes |
| 78 | + with: |
| 79 | + filters: | |
| 80 | + src: |
| 81 | + - '${{ matrix.language }}/ext/**' |
| 82 | +
|
| 83 | + - name: Install CodeQL |
| 84 | + if: steps.changes.outputs.src == 'true' |
| 85 | + env: |
| 86 | + GITHUB_TOKEN: ${{ github.token }} |
| 87 | + run: | |
| 88 | + gh extension install github/gh-codeql |
| 89 | + gh codeql pack install "githubsecuritylab/${{ matrix.language }}-extensions" |
| 90 | + gh codeql pack create "githubsecuritylab/${{ matrix.language }}-extensions" |
| 91 | +
|
0 commit comments