|
| 1 | +# Copyright 2021 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 | +# https://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 | +name: "CodeQL Java (Maven)" |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches: [ "main" ] |
| 20 | + pull_request: |
| 21 | + branches: [ "main" ] |
| 22 | + schedule: |
| 23 | + - cron: '30 1 * * 1' # Runs every Monday at 1:30 UTC |
| 24 | + |
| 25 | +jobs: |
| 26 | + analyze: |
| 27 | + name: Analyze |
| 28 | + runs-on: ubuntu-latest |
| 29 | + permissions: |
| 30 | + actions: read |
| 31 | + contents: read |
| 32 | + security-events: write |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout repository |
| 36 | + uses: actions/checkout@v4 |
| 37 | + |
| 38 | + # 1. Setup the Java Environment |
| 39 | + - name: Set up JDK 17 |
| 40 | + uses: actions/setup-java@v4 |
| 41 | + with: |
| 42 | + java-version: '17' |
| 43 | + distribution: 'temurin' |
| 44 | + cache: 'maven' # Speeds up subsequent runs by caching dependencies |
| 45 | + |
| 46 | + # 2. Initialize CodeQL |
| 47 | + - name: Initialize CodeQL |
| 48 | + uses: github/codeql-action/init@v3 |
| 49 | + with: |
| 50 | + languages: java |
| 51 | + # Optional: queries: security-extended,security-and-quality |
| 52 | + |
| 53 | + # 3. Manual Build (More reliable than Autobuild for Maven) |
| 54 | + - name: Build with Maven |
| 55 | + run: ./mvnw clean package -DskipTests # Skip tests to save time during analysis |
| 56 | + |
| 57 | + # 4. Perform Analysis |
| 58 | + - name: Perform CodeQL Analysis |
| 59 | + uses: github/codeql-action/analyze@v3 |
0 commit comments