-
Notifications
You must be signed in to change notification settings - Fork 5
73 lines (61 loc) · 2.3 KB
/
java-maven-openjdk-codeql.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: "CodeQL"
on:
workflow_call:
inputs:
runs-on:
description: |
The type of machine to run the job on. Must be provided as a stringified list (e.g. `runs-on: '["ubuntu-latest","self-hosted"]'`)
required: true
type: string
mvn-version:
description: |
The Maven version used for the execution. You can specify minor or patch version (3.9 or 3.9.1). Default : 3.9
required: false
type: number
default: 3.9
mvn-additional-arguments:
description: |
The additional arguments to pass to the Maven invocation. You can use this to specify a custom profile for example.
required: false
type: string
jdk-version:
description: |
The JDK version to use for the build.
required: true
type: number
jobs:
analyze-java:
name: Analyze Java
runs-on: ${{ fromJson(inputs.runs-on) }}
container:
image: maven:${{ inputs.mvn-version }}-eclipse-temurin-${{ inputs.jdk-version }}
permissions:
actions: read
contents: read
security-events: write
steps:
# Allow calling Git on a working copy owned by another user than the current one.
# see: https://github.blog/2022-04-12-git-security-vulnerability-announced/
- name: Git directory permission fix
run: git config --global --add safe.directory $GITHUB_WORKSPACE
# Fix HOME variable as GitHub is overriding it, and it breaks assumptions from maven.
- run: echo "HOME=/root" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: java
- name: Cache maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build project
run: mvn ${{ inputs.mvn-additional-arguments }} -T1C --also-make --batch-mode --strict-checksums --update-snapshots -Dmaven.gitcommitid.skip=true -DskipTests clean test-compile
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:java"