Skip to content

Commit 9d76a65

Browse files
committed
ci: run mvn build in CodeQL workflow
1 parent 6a452a4 commit 9d76a65

1 file changed

Lines changed: 60 additions & 5 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ on: # https://docs.github.com/en/actions/reference/workflows-and-actions/events
2727
# https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#workflow_dispatch
2828

2929

30+
defaults:
31+
run:
32+
shell: bash
33+
34+
35+
env:
36+
JAVA_VERSION: 21
37+
38+
3039
jobs:
3140

3241
###########################################################
@@ -45,7 +54,7 @@ jobs:
4554
- language: actions
4655
build-mode: none
4756
- language: java-kotlin
48-
build-mode: none
57+
build-mode: manual
4958
# avoid build error: "CodeQL detected code written in Java/Kotlin, GitHub Actions, C/C++ and Python,
5059
# but not any written in JavaScript/TypeScript."
5160
#- language: javascript-typescript
@@ -83,13 +92,59 @@ jobs:
8392
uses: actions/checkout@v5 # https://github.com/actions/checkout
8493

8594

86-
# CodeQL executes https://github.com/ferstl/depgraph-maven-plugin
87-
- name: "Install: JDK 25 for Maven/Tycho ☕"
95+
- name: "Install: JDK ${{ env.JAVA_VERSION }} ☕"
8896
uses: actions/setup-java@v5 # https://github.com/actions/setup-java
89-
if: matrix.language == 'java'
97+
if: matrix.language == 'java-kotlin'
9098
with:
9199
distribution: temurin
92-
java-version: 25
100+
java-version: ${{ env.JAVA_VERSION }}
101+
102+
103+
- name: "Cache: Local Maven Repository"
104+
uses: actions/cache/restore@v4
105+
if: matrix.language == 'java-kotlin'
106+
with:
107+
# Excluded sub directory not working https://github.com/actions/toolkit/issues/713
108+
path: |
109+
~/.m2/repository/*
110+
!~/.m2/repository/.cache/tycho
111+
!~/.m2/repository/.meta/p2-artifacts.properties
112+
!~/.m2/repository/p2
113+
!~/.m2/repository/*SNAPSHOT*
114+
key: ${{ runner.os }}-${{ runner.arch }}-repo-mvn-${{ hashFiles('**/pom.xml') }}
115+
116+
117+
- name: "Cache: Local Tycho Repository"
118+
uses: actions/cache/restore@v4
119+
if: matrix.language == 'java-kotlin'
120+
with:
121+
path: |
122+
~/.m2/repository/.cache/tycho
123+
~/.m2/repository/.meta/p2-artifacts.properties
124+
~/.m2/repository/p2
125+
key: ${{ runner.os }}-${{ runner.arch }}-repo-tycho-${{ hashFiles('target-platforms/target-platform-latest/target-platform-latest.target') }}
126+
127+
128+
- name: "Build with Maven 🔨"
129+
if: matrix.language == 'java-kotlin'
130+
run: |
131+
set -euo pipefail
132+
133+
MAVEN_OPTS="${MAVEN_OPTS:-}"
134+
MAVEN_OPTS+=" -Djava.security.egd=file:/dev/./urandom" # https://stackoverflow.com/questions/58991966/what-java-security-egd-option-is-for/59097932#59097932
135+
MAVEN_OPTS+=" -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS" # https://stackoverflow.com/questions/5120470/how-to-time-the-different-stages-of-maven-execution/49494561#49494561
136+
MAVEN_OPTS+=" -Xmx1024m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dhttps.protocols=TLSv1.3,TLSv1.2"
137+
export MAVEN_OPTS
138+
echo "MAVEN_OPTS: $MAVEN_OPTS"
139+
140+
./mvnw \
141+
--errors \
142+
--no-transfer-progress \
143+
--batch-mode \
144+
--show-version \
145+
-Declipse.p2.mirrors=false \
146+
-Dskip.tests=true \
147+
clean verify
93148

94149

95150
# https://docs.github.com/en/code-security/code-scanning

0 commit comments

Comments
 (0)