Skip to content

Commit f3e2c47

Browse files
committed
ci: consolidate GitHub workflows, add CodeQL and dependency report
Merge the three separate JDK/OS build workflows into a single ci.yml with a build matrix (ubuntu/windows x JDK 17/21) plus a deploy job, add concurrency cancellation and fork-safe guards, and bring in CodeQL and a weekly dependency-report workflow, mirroring the setup already used in ucanaccess and jackcess.
1 parent 65156da commit f3e2c47

8 files changed

Lines changed: 217 additions & 155 deletions

File tree

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build & Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
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
19+
20+
jobs:
21+
22+
build:
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os: [ubuntu-latest, windows-latest]
27+
java: ['17', '21']
28+
runs-on: ${{ matrix.os }}
29+
steps:
30+
- uses: actions/checkout@v7
31+
32+
- name: Set up JDK ${{ matrix.java }}
33+
uses: actions/setup-java@v6
34+
with:
35+
java-version: ${{ matrix.java }}
36+
distribution: temurin
37+
cache: maven
38+
39+
- name: Build with Maven/JDK ${{ matrix.java }} on ${{ matrix.os }}
40+
run: mvn --batch-mode --file pom.xml clean verify
41+
42+
deploy:
43+
needs: build
44+
# skip the deploy job for contributors/forks who lack the required secrets
45+
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
46+
runs-on: ubuntu-latest
47+
permissions:
48+
contents: read
49+
packages: write
50+
steps:
51+
- uses: actions/checkout@v7
52+
- name: Set up Java for deployment to Sonatype snapshot repo
53+
uses: actions/setup-java@v6
54+
with:
55+
java-version: '17'
56+
distribution: 'temurin'
57+
cache: maven
58+
# Sonatype Central Snapshots
59+
# must match distributionManagement/snapshotRepository/id in pom:
60+
server-id: central
61+
server-username: SONATYPE_CENTRAL_USERNAME
62+
server-password: SONATYPE_CENTRAL_PASSWORD
63+
64+
- name: Deploy to Sonatype Central snapshot repo
65+
run: mvn --batch-mode --file pom.xml deploy
66+
env:
67+
SONATYPE_CENTRAL_USERNAME: ${{ secrets.SONATYPE_CENTRAL_USERNAME }}
68+
SONATYPE_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }}

.github/workflows/ci_jdk17_ubuntu.yml

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

.github/workflows/ci_jdk17_win.yml

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

.github/workflows/ci_jdk21_ubuntu.yml

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

.github/workflows/ci_sonar_ubuntu.yml

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

.github/workflows/codeql.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: SonarCloud analysis with JDK 21 on Ubuntu
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
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
19+
20+
jobs:
21+
22+
build:
23+
runs-on: ubuntu-latest
24+
# skip the analysis job for contributors/forks who lack the required sonar token
25+
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
26+
steps:
27+
- uses: actions/checkout@v7
28+
with:
29+
# disabling shallow clone is recommended for improving relevancy of reporting
30+
fetch-depth: 0
31+
32+
- name: Set up JDK 21
33+
uses: actions/setup-java@v6
34+
with:
35+
java-version: '21'
36+
distribution: zulu
37+
cache: maven
38+
39+
- name: Cache SonarQube packages
40+
uses: actions/cache@v4
41+
with:
42+
path: ~/.sonar/cache
43+
key: ${{ runner.os }}-sonar
44+
restore-keys: ${{ runner.os }}-sonar
45+
46+
- name: Build with Maven/JDK 21, test with SonarCloud
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
50+
run: >
51+
mvn --batch-mode --file pom.xml verify
52+
org.sonarsource.scanner.maven:sonar-maven-plugin:5.5.0.6356:sonar
53+
-Dsonar.organization=speedbankingde
54+
-Dsonar.projectKey=SpeedBankingDe_iban-commons
55+
-Dsonar.host.url=https://sonarcloud.io

0 commit comments

Comments
 (0)