Skip to content

Commit cc4fa48

Browse files
nficanoclaude
andcommitted
ci: add GitHub Actions test workflow
Runs unit tests on push to main and PRs, with caching, concurrency control, minimal permissions, and pinned action versions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 00f3130 commit cc4fa48

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# CI workflow for java-sdk (Gradle, JDK 25).
2+
#
3+
# Action pinning policy:
4+
# - First-party actions (actions/*) are pinned to a major tag.
5+
# - Third-party actions are pinned to a full commit SHA with a version
6+
# comment alongside.
7+
name: test
8+
9+
on:
10+
push:
11+
branches: [main]
12+
paths-ignore:
13+
- '**.md'
14+
- 'docs/**'
15+
- 'LICENSE'
16+
- '.gitignore'
17+
- '.editorconfig'
18+
pull_request:
19+
branches: [main]
20+
paths-ignore:
21+
- '**.md'
22+
- 'docs/**'
23+
- 'LICENSE'
24+
- '.gitignore'
25+
- '.editorconfig'
26+
workflow_dispatch:
27+
28+
concurrency:
29+
group: ${{ github.workflow }}-${{ github.ref }}
30+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
31+
32+
permissions:
33+
contents: read
34+
35+
jobs:
36+
test:
37+
name: test (JDK ${{ matrix.java }})
38+
runs-on: ubuntu-latest
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
# build.gradle.kts pins toolchain + options.release to JDK 25.
43+
# JDK 25 is the September 2025 LTS, so floor and latest LTS coincide.
44+
java: ['25']
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 1
50+
51+
- name: Set up JDK ${{ matrix.java }}
52+
uses: actions/setup-java@v4
53+
with:
54+
distribution: temurin
55+
java-version: ${{ matrix.java }}
56+
cache: gradle
57+
58+
- name: Validate Gradle wrapper
59+
# gradle/actions/wrapper-validation v4.4.4
60+
uses: gradle/actions/wrapper-validation@ac638b010cf58a27ee6c972d7336334ccaf61c96
61+
62+
- name: Resolve dependencies
63+
run: ./gradlew --no-daemon dependencies
64+
65+
- name: Build
66+
run: ./gradlew --no-daemon assemble
67+
68+
- name: Test
69+
run: ./gradlew --no-daemon test
70+
71+
- name: Upload test reports
72+
if: failure()
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: test-reports-jdk${{ matrix.java }}
76+
path: |
77+
**/build/reports/tests/
78+
**/build/test-results/
79+
if-no-files-found: ignore
80+
retention-days: 7

0 commit comments

Comments
 (0)