Repository navigation
154 lines (140 loc) · 5.29 KB
/
Copy pathjava.yaml
File metadata and controls
154 lines (140 loc) · 5.29 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Java Features Testing
on:
workflow_call:
inputs:
java-repo-path:
type: string
default: 'temporalio/sdk-java'
version:
required: true
type: string
# When true, the version refers to a repo tag/ref. When false, package version downloaded via
# gradle.
version-is-repo-ref:
required: true
type: boolean
features-repo-path:
type: string
default: 'temporalio/features'
features-repo-ref:
type: string
default: 'main'
# If set, download the docker image for server from the provided artifact name
docker-image-artifact-name:
type: string
required: false
# Additional dynamic config values to append to docker.yaml (YAML format)
dynamic-config-values:
type: string
required: false
permissions:
contents: read
actions: read
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./features
steps:
- name: Print git info
run: 'echo head_ref: "$GITHUB_HEAD_REF", ref: "$GITHUB_REF", java sdk version: "$INPUT_VERSION"'
working-directory: '.'
env:
INPUT_VERSION: ${{ inputs.version }}
- name: Download docker artifacts
if: ${{ inputs.docker-image-artifact-name }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: ${{ inputs.docker-image-artifact-name }}
path: /tmp/server-docker
- name: Load server Docker Images
if: ${{ inputs.docker-image-artifact-name }}
run: |
docker load --input /tmp/server-docker/temporal-server.tar
docker load --input /tmp/server-docker/temporal-admin-tools.tar
working-directory: '.'
- name: Override IMAGE_TAG environment variable
if: ${{ inputs.docker-image-artifact-name }}
run: |
image_tag=latest
# image_tag won't exist on older builds (like 1.22.0), so default to latest
if [ -f /tmp/server-docker/image_tag ]; then
image_tag=$(cat /tmp/server-docker/image_tag)
fi
echo "IMAGE_TAG=${image_tag}" >> $GITHUB_ENV
working-directory: '.'
- name: Checkout SDK features repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: features
repository: ${{ inputs.features-repo-path }}
ref: ${{ inputs.features-repo-ref }}
fetch-depth: 0
- name: Checkout Java SDK repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
if: ${{ inputs.version-is-repo-ref }}
with:
repository: ${{ inputs.java-repo-path }}
submodules: recursive
path: sdk-java
ref: ${{ inputs.version }}
fetch-depth: 0
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
distribution: 'temurin'
java-version: '23'
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version: '^1.21'
- name: Append custom dynamic config
if: ${{ inputs.dynamic-config-values }}
env:
DYNAMIC_CONFIG_VALUES: ${{ inputs.dynamic-config-values }}
run: |
echo "" >> ./dockerfiles/dynamicconfig/docker.yaml
echo "$DYNAMIC_CONFIG_VALUES" >> ./dockerfiles/dynamicconfig/docker.yaml
- name: Start containerized server and dependencies
id: start-server
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.yml \
up -d cassandra elasticsearch temporal-admin-tools temporal-server temporal-create-namespace
- name: Show all container logs
if: always()
run: |
echo "=== All container logs ==="
docker compose \
-f ./dockerfiles/docker-compose.yml \
logs
working-directory: ./features
- name: Run SDK-features tests directly
if: inputs.docker-image-artifact-name == ''
env:
INPUT_VERSION: ${{ inputs.version }}
INPUT_VERSION_IS_REPO_REF: ${{ inputs.version-is-repo-ref }}
run: |
if [ "$INPUT_VERSION_IS_REPO_REF" = "true" ]; then
go run . run --lang java --version "$(realpath ../sdk-java)"
else
go run . run --lang java --version "$INPUT_VERSION"
fi
# Running the tests in their own step keeps the logs readable
- name: Run containerized SDK-features tests
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.yml \
up --no-log-prefix --exit-code-from features-tests-java features-tests-java
- name: Show all container logs before teardown
if: always() && inputs.docker-image-artifact-name
run: |
echo "=== All container logs before teardown ==="
docker compose \
-f ./dockerfiles/docker-compose.yml \
logs
working-directory: ./features
- name: Tear down docker compose
if: inputs.docker-image-artifact-name && (success() || failure())
run: docker compose -f ./dockerfiles/docker-compose.yml down -v