22name : CodeQL
33
44on : # https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows
5+ schedule :
6+ # https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#schedule
7+ - cron : " 30 18 * * 1" # Mondays 18:30 UTC
58 push :
69 branches : [ "main" ]
710 paths-ignore :
811 - ' **/*.md'
9- - ' .github/*.yml'
10- - ' .github/workflows/build.yml'
11- - ' .github/workflows/licensecheck.yml'
1212 - ' **/.project'
1313 - ' **/.settings/*.prefs'
1414 - ' .gitignore'
@@ -18,9 +18,6 @@ on: # https://docs.github.com/en/actions/reference/workflows-and-actions/events
1818 branches : [ "main" ]
1919 paths-ignore :
2020 - ' **/*.md'
21- - ' .github/*.yml'
22- - ' .github/workflows/build.yml'
23- - ' .github/workflows/licensecheck.yml'
2421 - ' **/.project'
2522 - ' **/.settings/*.prefs'
2623 - ' .gitignore'
@@ -30,21 +27,38 @@ on: # https://docs.github.com/en/actions/reference/workflows-and-actions/events
3027 # https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#workflow_dispatch
3128
3229
30+ defaults :
31+ run :
32+ shell : bash
33+
34+
35+ env :
36+ JAVA_VERSION : 21
37+
38+
3339jobs :
3440
3541 # ##########################################################
3642 analyze :
3743 # ##########################################################
3844
45+ concurrency :
46+ group : codeql-${{ github.workflow }}-${{ github.ref }}-${{ matrix.language }}
47+ cancel-in-progress : true
48+
3949 strategy :
4050 fail-fast : false
4151 matrix :
4252 include :
4353 # build-mode: https://github.com/github/codeql-action#build-modes
44- - language : java-kotlin
45- build-mode : none
46- - language : javascript-typescript
54+ - language : actions
4755 build-mode : none
56+ - language : java
57+ build-mode : manual
58+ # avoid build error: "CodeQL detected code written in Java/Kotlin, GitHub Actions, C/C++ and Python,
59+ # but not any written in JavaScript."
60+ # - language: javascript
61+ # build-mode: none
4862 - language : python
4963 build-mode : none
5064
@@ -78,13 +92,37 @@ jobs:
7892 uses : actions/checkout@v5 # https://github.com/actions/checkout
7993
8094
81- # CodeQL executes https://github.com/ferstl/depgraph-maven-plugin
82- - name : " Install: JDK 25 for Maven ☕"
95+ - name : " Install: JDK ${{ env.JAVA_VERSION }} ☕"
8396 uses : actions/setup-java@v5 # https://github.com/actions/setup-java
84- if : ${{ matrix.language }} == 'java'
97+ if : matrix.language == 'java'
8598 with :
8699 distribution : temurin
87- 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'
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'
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') }}
88126
89127
90128 # https://docs.github.com/en/code-security/code-scanning
@@ -98,6 +136,28 @@ jobs:
98136 queries : +security-and-quality
99137
100138
139+ - name : " Build with Maven 🔨"
140+ if : matrix.language == 'java'
141+ run : |
142+ set -euo pipefail
143+
144+ MAVEN_OPTS="${MAVEN_OPTS:-}"
145+ MAVEN_OPTS+=" -Djava.security.egd=file:/dev/./urandom" # https://stackoverflow.com/questions/58991966/what-java-security-egd-option-is-for/59097932#59097932
146+ 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
147+ MAVEN_OPTS+=" -Xmx1024m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dhttps.protocols=TLSv1.3,TLSv1.2"
148+ export MAVEN_OPTS
149+ echo "MAVEN_OPTS: $MAVEN_OPTS"
150+
151+ ./mvnw \
152+ --errors \
153+ --no-transfer-progress \
154+ --batch-mode \
155+ --show-version \
156+ -Declipse.p2.mirrors=false \
157+ -Dmaven.test.skip=true \
158+ clean verify
159+
160+
101161 - name : Perform CodeQL Analysis
102162 uses : github/codeql-action/analyze@v4 # https://github.com/github/codeql-action
103163 with :
0 commit comments