-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
65 lines (60 loc) · 3.01 KB
/
Copy pathaction.yml
File metadata and controls
65 lines (60 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: "Setup CI caches"
description: "Set up the JDK and cache Maven dependencies; reactor jobs also restore the generated-client build cache."
inputs:
cache-type:
description: "application-server-reactor for jobs that run the Maven reactor; application-server-tests for jobs that run goals against the packaged reactor"
required: true
os:
description: "Operating system for cache key"
required: false
default: "ubuntu-latest"
runs:
using: "composite"
steps:
- name: Validate cache type
shell: bash
env:
CACHE_TYPE: ${{ inputs.cache-type }}
run: |
case "$CACHE_TYPE" in
application-server-reactor|application-server-tests) ;;
*) echo "::error::Unknown cache type '$CACHE_TYPE'."; exit 1 ;;
esac
- name: Compute generated-client cache identity
id: generated-clients-identity
if: inputs.cache-type == 'application-server-reactor'
shell: bash
env:
DEPENDENCY_HASH: ${{ hashFiles('server/pom.xml', 'server/generated-clients/pom.xml', 'server/.mvn/**', 'server/generated-clients/src/**') }}
run: |
if [[ -z "$DEPENDENCY_HASH" ]]; then
echo "::error::Cannot compute the generated-client cache identity from the checked-out repository."
exit 1
fi
echo "hash=$DEPENDENCY_HASH" >> "$GITHUB_OUTPUT"
- name: Set up JDK 21
id: java
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: "temurin"
java-version: "21"
cache: "maven"
cache-dependency-path: |
server/**/pom.xml
server/.mvn/extensions.xml
server/.mvn/wrapper/maven-wrapper.properties
cache-read-only: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) || !contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }}
cache-jdk: false
# Merge groups branch from main and read its caches like a pull request does.
- name: Restore generated clients
if: inputs.cache-type == 'application-server-reactor' && contains(fromJSON('["pull_request", "merge_group"]'), github.event_name)
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/build-cache
key: ${{ inputs.os }}-${{ steps.java.outputs.distribution }}-${{ steps.java.outputs.version }}-generated-clients-${{ steps.generated-clients-identity.outputs.hash }}
- name: Cache generated clients
if: inputs.cache-type == 'application-server-reactor' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name)
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/build-cache
key: ${{ inputs.os }}-${{ steps.java.outputs.distribution }}-${{ steps.java.outputs.version }}-generated-clients-${{ steps.generated-clients-identity.outputs.hash }}