-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
87 lines (80 loc) · 4.09 KB
/
Copy pathaction.yml
File metadata and controls
87 lines (80 loc) · 4.09 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: "Setup CI caches"
description: "Caches Maven dependencies, generated-client build outputs, and Playwright browsers."
inputs:
cache-type:
description: "Type of cache to setup"
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-quality|application-server-verification|application-server-integration|server-contracts|webapp-e2e|webapp-storybook) ;;
*) echo "::error::Unknown cache type '$CACHE_TYPE'."; exit 1 ;;
esac
- name: Compute generated-client cache identity
id: generated-clients-identity
if: startsWith(inputs.cache-type, 'application-server-') || contains(fromJSON('["webapp-e2e", "server-contracts"]'), inputs.cache-type)
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: Compute Playwright cache identity
id: playwright-identity
if: contains(fromJSON('["webapp-storybook", "webapp-e2e"]'), inputs.cache-type)
shell: bash
env:
DEPENDENCY_HASH: ${{ hashFiles('bun.lock') }}
run: |
if [[ -z "$DEPENDENCY_HASH" ]]; then
echo "::error::Cannot compute the Playwright cache identity from the checked-out repository."
exit 1
fi
echo "hash=$DEPENDENCY_HASH" >> "$GITHUB_OUTPUT"
- name: Set up JDK 21
id: java
if: startsWith(inputs.cache-type, 'application-server-') || contains(fromJSON('["webapp-e2e", "server-contracts"]'), inputs.cache-type)
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
- name: Restore generated clients
if: github.event_name == 'pull_request' && (startsWith(inputs.cache-type, 'application-server-') || contains(fromJSON('["webapp-e2e", "server-contracts"]'), inputs.cache-type))
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: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) && (startsWith(inputs.cache-type, 'application-server-') || contains(fromJSON('["webapp-e2e", "server-contracts"]'), inputs.cache-type))
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 }}
- name: Cache Playwright browsers
if: contains(fromJSON('["webapp-storybook", "webapp-e2e"]'), inputs.cache-type)
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/ms-playwright
key: ${{ inputs.os }}-playwright-${{ steps.playwright-identity.outputs.hash }}
restore-keys: |
${{ inputs.os }}-playwright-