|
| 1 | +name: CodeQL_AIO_Larger_Runner_Example.yml |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ main ] |
| 5 | + |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + Container_Example01_JavaScript: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + permissions: |
| 13 | + actions: read |
| 14 | + contents: read |
| 15 | + security-events: write |
| 16 | + |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + language: [javascript] |
| 21 | + |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v3 |
| 26 | + |
| 27 | + # Initializes the CodeQL tools for scanning. |
| 28 | + - name: Initialize CodeQL |
| 29 | + uses: github/codeql-action/init@v2 |
| 30 | + with: |
| 31 | + languages: |
| 32 | + ${{ matrix.language }} |
| 33 | + # If you wish to specify custom queries, you can do so here or in a config file. |
| 34 | + # By default, queries listed here will override any specified in a config file. |
| 35 | + # Prefix the list here with "+" to use these queries and those in the config file. |
| 36 | + |
| 37 | + # 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 |
| 38 | + # queries: security-extended,security-and-quality |
| 39 | + |
| 40 | + - name: NPM Installation |
| 41 | + working-directory: /Example01_JavaScript/ |
| 42 | + run: | |
| 43 | + npm i -g typescript ts-node && \ |
| 44 | + npm install --omit=dev --unsafe-perm && \ |
| 45 | + npm dedupe && \ |
| 46 | + rm -rf frontend/node_modules && \ |
| 47 | + rm -rf frontend/.angular && \ |
| 48 | + rm -rf frontend/src/assets && \ |
| 49 | + mkdir logs && \ |
| 50 | + chown -R 65532 logs && \ |
| 51 | + chgrp -R 0 ftp/ frontend/dist/ logs/ data/ i18n/ && \ |
| 52 | + chmod -R g=u ftp/ frontend/dist/ logs/ data/ i18n/ && \ |
| 53 | + rm data/chatbot/botDefaultTrainingData.json || true && \ |
| 54 | + rm ftp/legal.md || true && \ |
| 55 | + rm i18n/*.json || true |
| 56 | +
|
| 57 | + - name: Perform CodeQL Analysis |
| 58 | + uses: github/codeql-action/analyze@v2 |
| 59 | + |
| 60 | + Container_Example02_Java: |
| 61 | + needs: Container_Example01_JavaScript |
| 62 | + runs-on: Ubuntu-latest |
| 63 | + permissions: |
| 64 | + actions: read |
| 65 | + contents: read |
| 66 | + security-events: write |
| 67 | + |
| 68 | + strategy: |
| 69 | + fail-fast: false |
| 70 | + matrix: |
| 71 | + language: [Java] |
| 72 | + |
| 73 | + container: |
| 74 | + image: openjdk:8 |
| 75 | + options: --cpus 5 --user root |
| 76 | + |
| 77 | + steps: |
| 78 | + - name: Checkout repository |
| 79 | + uses: actions/checkout@v3 |
| 80 | + |
| 81 | + - name: Install dependencies |
| 82 | + working-directory: /Example02_Java/ |
| 83 | + run: | |
| 84 | + apt-get update && \ |
| 85 | + apt-get install build-essential maven default-jdk cowsay netcat -y && \ |
| 86 | + update-alternatives --config javac |
| 87 | + |
| 88 | +
|
| 89 | + - name: Initialize CodeQL |
| 90 | + uses: github/codeql-action/init@v2 |
| 91 | + with: |
| 92 | + languages: ${{ matrix.language }} |
| 93 | + |
| 94 | + - name: Build with Maven |
| 95 | + working-directory: /Example02_Java/ |
| 96 | + run: | |
| 97 | + mvn -B package --file pom.xml |
| 98 | +
|
| 99 | + - name: Perform CodeQL Analysis |
| 100 | + uses: github/codeql-action/analyze@v2 |
| 101 | + |
| 102 | + Container_Example03_Csharp: |
| 103 | + needs: [Container_Example01_JavaScript, Container_Example02_Java] |
| 104 | + runs-on: windows-latest |
| 105 | + permissions: |
| 106 | + actions: read |
| 107 | + contents: read |
| 108 | + security-events: write |
| 109 | + |
| 110 | + strategy: |
| 111 | + fail-fast: false |
| 112 | + matrix: |
| 113 | + language: [csharp] |
| 114 | + |
| 115 | + |
| 116 | + steps: |
| 117 | + - name: Checkout repository |
| 118 | + uses: actions/checkout@v3 |
| 119 | + |
| 120 | + - name: Initialize CodeQL |
| 121 | + uses: github/codeql-action/init@v2 |
| 122 | + with: |
| 123 | + languages: ${{ matrix.language }} |
| 124 | + |
| 125 | + - name: Install dependencies |
| 126 | + run: | |
| 127 | + apt-get update && apt-get upgrade -y --no-install-recommends && \ |
| 128 | + apt-get install -y wget && \ |
| 129 | + apt-get install -y curl |
| 130 | +
|
| 131 | + - name: Setup .NET |
| 132 | + uses: actions/setup-dotnet@v3 |
| 133 | + with: |
| 134 | + dotnet-version: 7.0.x |
| 135 | + |
| 136 | + - name: Build with dotnet |
| 137 | + working-directory: /Example03_Csharp/WebGoatCore/ |
| 138 | + run: dotnet build WebGoatCore.csproj |
| 139 | + |
| 140 | + # - name: Autobuild |
| 141 | + # uses: github/codeql-action/autobuild@v2 |
| 142 | + |
| 143 | + - name: Perform CodeQL Analysis |
| 144 | + uses: github/codeql-action/analyze@v2 |
| 145 | + |
| 146 | + Container_Example04_DockerBuild_and_Scan: |
| 147 | + needs: [Container_Example01_JavaScript, Container_Example02_Java, Container_Example03_Csharp] |
| 148 | + runs-on: ubuntu-latest |
| 149 | + permissions: |
| 150 | + actions: read |
| 151 | + contents: read |
| 152 | + security-events: write |
| 153 | + |
| 154 | + strategy: |
| 155 | + fail-fast: false |
| 156 | + matrix: |
| 157 | + language: [ 'python' ] |
| 158 | + |
| 159 | + steps: |
| 160 | + |
| 161 | + - name: Checkout repository |
| 162 | + uses: actions/checkout@v3 |
| 163 | + |
| 164 | + - name: Initialize CodeQL |
| 165 | + uses: github/codeql-action/init@v2 |
| 166 | + with: |
| 167 | + languages: ${{ matrix.language }} |
| 168 | + |
| 169 | + - name: Autobuild |
| 170 | + uses: github/codeql-action/autobuild@v2 |
| 171 | + |
| 172 | + - name: Perform CodeQL Analysis |
| 173 | + uses: github/codeql-action/analyze@v2 |
| 174 | + |
0 commit comments