Skip to content

Commit 406f852

Browse files
committed
ci: consolidate CI matrix, fix workflow_dispatch, add CodeQL and dependency report
- Merge the four per-JDK CI workflows into one matrix build (ubuntu-latest/windows-latest x JDK 11/17/21) for full OS/JDK parity - Align all CI jobs on `clean verify` so integration tests run consistently across JDK versions. - Remove the invalid `branches` filter under `workflow_dispatch` in the Sonar workflow (that key only applies to push/pull_request triggers). - Add 'concurrency' (cancel superseded runs) and least-privilege `permissions: contents: read` to all workflows. - Bump actions/checkout and actions/setup-java to their current major versions (v7/v6). - Add scheduled CodeQL analysis and a dependency/plugin update report, mirroring the setup already in use in the figlet project.
1 parent e3e81c6 commit 406f852

7 files changed

Lines changed: 132 additions & 96 deletions

File tree

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build with JDK 11 on Ubuntu
1+
name: Build & Deploy
22

33
on:
44
push:
@@ -7,23 +7,37 @@ on:
77
pull_request:
88
branches:
99
- master
10-
workflow_dispatch:
10+
workflow_dispatch: {}
11+
12+
# cancel superseded runs on the same branch/PR to save CI minutes.
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read
1119

1220
jobs:
21+
1322
build:
14-
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os: [ubuntu-latest, windows-latest]
27+
java: ['11', '17', '21']
28+
runs-on: ${{ matrix.os }}
1529
steps:
16-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v7
1731

18-
- name: Set up JDK 11
19-
uses: actions/setup-java@v3
32+
- name: Set up JDK ${{ matrix.java }}
33+
uses: actions/setup-java@v6
2034
with:
21-
java-version: '11'
35+
java-version: ${{ matrix.java }}
2236
distribution: temurin
2337
cache: maven
2438

25-
- name: Build with Maven/JDK 11
26-
run: mvn --batch-mode --file pom.xml clean package
39+
- name: Build with Maven/JDK ${{ matrix.java }} on ${{ matrix.os }}
40+
run: mvn --batch-mode --file pom.xml clean verify
2741

2842
deploy:
2943
needs: build
@@ -34,12 +48,12 @@ jobs:
3448
contents: read
3549
packages: write
3650
steps:
37-
- uses: actions/checkout@v4
51+
- uses: actions/checkout@v7
3852
- name: Set up Java for deployment to Sonatype snapshot repo
39-
uses: actions/setup-java@v3
53+
uses: actions/setup-java@v6
4054
with:
4155
java-version: '11'
42-
distribution: temurin
56+
distribution: 'temurin'
4357
cache: maven
4458
# Sonatype Central Snapshots
4559
# must match distributionManagement/snapshotRepository/id in pom:

.github/workflows/ci_jdk11_win.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/ci_jdk17_ubuntu.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/ci_jdk21_ubuntu.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/codeql.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
schedule:
11+
- cron: '30 3 * * 1'
12+
workflow_dispatch: {}
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
23+
analyze:
24+
name: Analyze (java-kotlin)
25+
runs-on: ubuntu-latest
26+
permissions:
27+
actions: read
28+
contents: read
29+
security-events: write
30+
31+
steps:
32+
- uses: actions/checkout@v7
33+
34+
- name: Set up JDK 17
35+
uses: actions/setup-java@v6
36+
with:
37+
java-version: '17'
38+
distribution: 'temurin'
39+
cache: maven
40+
41+
- name: Initialize CodeQL
42+
uses: github/codeql-action/init@v4
43+
with:
44+
languages: java-kotlin
45+
build-mode: manual
46+
47+
# Skip checkstyle/tests here: this build only needs to produce compiled
48+
# classes for CodeQL to analyze, not to enforce project lint rules.
49+
- name: Build for CodeQL analysis
50+
run: >
51+
mvn --batch-mode --file pom.xml
52+
-Dcheckstyle.skip=true
53+
-Dmaven.test.skip=true
54+
clean compile
55+
56+
- name: Perform CodeQL Analysis
57+
uses: github/codeql-action/analyze@v4
58+
with:
59+
category: "/language:java-kotlin"
60+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Dependency Report
2+
3+
on:
4+
schedule:
5+
- cron: '0 6 * * 1'
6+
workflow_dispatch: {}
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
13+
report:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v7
17+
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v6
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
cache: maven
24+
25+
# Report-only: versions-maven-plugin never fails the build, it only prints
26+
# what's outdated. No pull requests, no issues - just a workflow summary.
27+
- name: Report outdated dependencies & plugins
28+
run: |
29+
{
30+
echo "## Outdated dependencies & plugins"
31+
echo
32+
echo '```text'
33+
mvn --batch-mode --file pom.xml versions:display-dependency-updates versions:display-plugin-updates
34+
echo '```'
35+
} >> "$GITHUB_STEP_SUMMARY"
36+

.github/workflows/sonar_jdk17_ubuntu.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ on:
88
branches:
99
- master
1010
workflow_dispatch:
11-
branches:
12-
- master
11+
12+
# cancel superseded runs on the same branch/PR to save CI minutes.
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read
1319

1420
jobs:
1521

@@ -18,13 +24,13 @@ jobs:
1824
# skip the analysis job for contributors/forks who lack the required sonar token
1925
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
2026
steps:
21-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@v7
2228
with:
2329
# disabling shallow clone is recommended for improving relevancy of reporting
2430
fetch-depth: 0
2531

2632
- name: Set up JDKs (17 for build, 21 for sonarcloud)
27-
uses: actions/setup-java@v4
33+
uses: actions/setup-java@v6
2834
with:
2935
java-version: |
3036
17

0 commit comments

Comments
 (0)