-
Notifications
You must be signed in to change notification settings - Fork 3
186 lines (169 loc) · 6.42 KB
/
e2e.yaml
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: E2E
# Controls when the workflow will run
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 */6 * * *' # Every 6 hours
workflow_dispatch: # To start from UI
inputs:
sdkTypescriptCommit:
description: 'sdk-typescript commit'
required: false
default: ''
type: string
sdkJavaCommit:
description: 'sdk-java commit'
required: false
default: ''
type: string
restateCommit:
description: 'restate commit'
required: false
default: ''
type: string
workflow_call:
inputs:
sdkTypescriptCommit:
description: 'sdk-typescript commit'
required: false
default: ''
type: string
sdkJavaCommit:
description: 'sdk-java commit'
required: false
default: ''
type: string
restateCommit:
description: 'restate commit'
required: false
default: ''
type: string
e2eRef:
description: 'e2e repo ref, for cross-repo workflow calls'
required: true
type: string
jobs:
build:
# prevent e2e running on forks
if: github.repository_owner == 'restatedev'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
issues: read
checks: write
pull-requests: write
actions: read
services:
registry:
# if we are building a restate snapshot, start a local docker registry to store it
# an empty image skips the service (see https://github.com/actions/runner/issues/822)
image: ${{ inputs.restateCommit != '' && 'registry:2' || '' }}
ports:
- 5000:5000
steps:
- uses: actions/checkout@v3
with:
repository: restatedev/e2e
path: e2e
# if we are in a workflow_call, use the e2e branch from the workflow call (usually main)
# otherwise, defer to the checkout actions default, which depends on the triggering event
ref: ${{ inputs.e2eRef || '' }}
- name: "Check license headers"
run: "./check-license-headers"
working-directory: e2e
# Setup Java
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
# Setup node
- uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: 'https://registry.npmjs.org'
# Setup sdk-typescript snapshot if necessary
# Due to https://github.com/actions/upload-artifact/issues/53
# We must use download-artifact to get artifacts created during *this* workflow run, ie by workflow call
- name: Download sdk-typescript snapshot from in-progress workflow
if: ${{ inputs.sdkTypescriptCommit != '' && github.event_name != 'workflow_dispatch' }}
uses: actions/download-artifact@v3
with:
name: restatedev-restate-sdk
path: e2e/services/node-services
# In the workflow dispatch case where the artifact was created in a previous run, we can download as normal
- name: Download sdk-typescript snapshot from completed workflow
if: ${{ inputs.sdkTypescriptCommit != '' && github.event_name == 'workflow_dispatch' }}
uses: dawidd6/action-download-artifact@v2
with:
workflow: test.yml
repo: restatedev/sdk-typescript
commit: ${{ inputs.sdkTypescriptCommit }}
name: restatedev-restate-sdk
path: e2e/services/node-services
- name: Install sdk-typescript snapshot
if: ${{ inputs.sdkTypescriptCommit != '' }}
run: npm install restatedev-restate-sdk.tgz
working-directory: e2e/services/node-services
# Setup sdk-java snapshot if necessary
- name: Checkout sdk-java repo
uses: actions/checkout@v3
if: ${{ inputs.sdkJavaCommit != '' }}
with:
repository: restatedev/sdk-java
# if we are in a workflow_call, use the e2e branch from the workflow call (usually main)
# otherwise, defer to the checkout actions default, which depends on the triggering event
ref: ${{ inputs.sdkJavaCommit }}
path: "sdk-java"
# Setup restate snapshot if necessary
# Due to https://github.com/actions/upload-artifact/issues/53
# We must use download-artifact to get artifacts created during *this* workflow run, ie by workflow call
- name: Download restate snapshot from in-progress workflow
if: ${{ inputs.restateCommit != '' && github.event_name != 'workflow_dispatch' }}
uses: actions/download-artifact@v3
with:
name: restate.tar
# In the workflow dispatch case where the artifact was created in a previous run, we can download as normal
- name: Download restate snapshot from completed workflow
if: ${{ inputs.restateCommit != '' && github.event_name == 'workflow_dispatch' }}
uses: dawidd6/action-download-artifact@v2
with:
repo: restatedev/restate
workflow: docker.yml
commit: ${{ inputs.restateCommit }}
name: restate.tar
- name: Install restate snapshot
if: ${{ inputs.restateCommit != '' }}
run: |
output=$(docker load --input restate.tar)
docker tag "${output#*: }" "localhost:5000/restatedev/restate:latest"
docker push localhost:5000/restatedev/restate:latest
# Run tests
- name: Test
uses: gradle/gradle-build-action@v2
env:
E2E_IMAGE_PULL_POLICY: always
E2E_VERIFICATION_SEED: ${{ github.run_id }}
RESTATE_CONTAINER_IMAGE: ${{ inputs.restateCommit != '' && 'localhost:5000/restatedev/restate:latest' || '' }}
JAVA_SDK_LOCAL_BUILD: ${{ inputs.sdkJavaCommit != '' && 'true' || '' }}
with:
arguments: --continue -Djib.console=plain check
build-root-directory: e2e
# Upload container logs
- uses: actions/upload-artifact@v3
if: always() # Make sure this is run even when test fails
with:
name: container-logs
path: |
e2e/tests/build/test-results/*/container-logs/**
e2e/tests/build/reports/tests/**
e2e/tests/build/test-results/*/*.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
e2e/tests/build/test-results/*/*.xml