Files
floci/.github/workflows/ci.yml
T
Priamo Germosen a68bfc4e68 fix(ci): replace setup-java's broken maven cache with actions/cache (#2503)
* fix(ci): replace setup-java's broken maven cache with actions/cache

setup-java@v5.6.0's built-in cache: maven has never worked on this
repo: every run restores nothing ("maven cache is not found") and then
fails to save ("Path Validation Error: Path(s) specified in the action
for caching do(es) not exist"), so every single CI run resolves the
full dependency tree cold. Confirmed across 3 independent runs, no
custom localRepository override anywhere that would explain it -
looks like a bug in this pinned action version.

Uses actions/cache directly instead, keyed on pom.xml's hash - the
same underlying mechanism setup-java's option wraps, just debuggable
and not broken. Free (GitHub Actions cache storage is free up to
10GB/repo), same runner, no test/build logic touched.

* fix(ci): scope the maven cache key to the root pom.xml only

hashFiles('**/pom.xml') also picked up
compatibility-tests/sdk-test-java/pom.xml, a separate project this
workflow never builds - its own paths: trigger only watches the root
pom.xml. An unrelated change there would bust the cache key and cost
this fix its whole point on the next run.
2026-08-23 22:37:07 -05:00

51 lines
1.3 KiB
YAML

name: CI
on:
push:
branches:
- main
paths:
- 'src/**'
- 'pom.xml'
- '.github/workflows/ci.yml'
pull_request:
paths:
- 'src/**'
- 'pom.xml'
- '.github/workflows/ci.yml'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Build and Test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/setup-java@v5.6.0
with:
java-version: '25'
distribution: 'temurin'
# setup-java's built-in `cache: maven` never actually saves a cache on this action
# version - every run restores nothing ("maven cache is not found") and then fails to
# save with "Path Validation Error: Path(s) specified in the action for caching do(es)
# not exist", so every run has been resolving all dependencies cold. Using actions/cache
# directly instead, which is the same mechanism setup-java's option wraps.
- uses: actions/cache@v6.1.0
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: |
maven-${{ runner.os }}-
- name: Run tests
run: mvn test -B