diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 302c7400..170e8f9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,19 @@ jobs: with: distribution: 'zulu' java-version: '25' - cache: 'maven' + # Unlike setup-java's cache, falls back to an older cache when pom.xml changes (e.g. dependency update PRs). + # The year in the key starts a fresh cache yearly, dropping unused dependency versions. + - name: Get year + id: year + run: echo "year=$(date -u +%Y)" >> "$GITHUB_OUTPUT" + - name: Cache Maven repository + uses: actions/cache@v6 + with: + path: | + ~/.m2/repository + !~/.m2/repository/com/softwaremill/jox + key: maven-ci-${{ steps.year.outputs.year }}-${{ hashFiles('**/pom.xml') }} + restore-keys: maven-ci-${{ steps.year.outputs.year }}- - name: Test run: mvn --batch-mode --update-snapshots verify - name: Prepare release notes @@ -32,6 +44,8 @@ jobs: fray-tests: runs-on: ubuntu-26.04 strategy: + # Jobs that pass still save the Maven cache, which a re-run of a failed job can then use + fail-fast: false matrix: channel_size: [ 0, 1, 10 ] segment_size: [ 4, 32 ] @@ -43,7 +57,17 @@ jobs: with: distribution: 'zulu' java-version: '25' - cache: 'maven' + - name: Get year + id: year + run: echo "year=$(date -u +%Y)" >> "$GITHUB_OUTPUT" + - name: Cache Maven repository + uses: actions/cache@v6 + with: + path: | + ~/.m2/repository + !~/.m2/repository/com/softwaremill/jox + key: maven-fray-${{ steps.year.outputs.year }}-${{ hashFiles('**/pom.xml') }} + restore-keys: maven-fray-${{ steps.year.outputs.year }}- - name: Install current Jox # so that latest channels code is available run: mvn install -DskipTests=true - name: Run Fray tests (CHANNEL_SIZE=${{ matrix.channel_size }}, JOX_SEGMENT_SIZE=${{ matrix.segment_size }})