This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 169
226 lines (203 loc) · 8.4 KB
/
go-e2e.yml
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: End to End
defaults:
run:
shell: bash --noprofile --norc -eo pipefail {0}
on:
push:
branches: [master, main, force_test, release-*, staging, trying]
pull_request:
branches: ['**']
schedule:
- cron: "6 0 * * *"
# Allows to embed this workflow into another repository (e.g. promscale_extension)
# See .github/README.md in timescale/promscale_extension
workflow_call:
inputs:
docker_image_prefix:
required: true
type: string
ref:
required: false
type: string
default: ${{ github.ref }}
env:
golang-version: 1.22.1
jobs:
pick_docker_image:
name: pick_docker_image
runs-on: ubuntu-latest
outputs:
docker_image_12: ${{ steps.metadata.outputs.docker_image_12 }}
docker_image_13: ${{ steps.metadata.outputs.docker_image_13 }}
docker_image_14: ${{ steps.metadata.outputs.docker_image_14 }}
docker_image_15: ${{ steps.metadata.outputs.docker_image_15 }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
repository: timescale/promscale
ref: ${{ inputs.ref }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Figure out database container image from branch name
id: metadata
run: |
if [[ "${{ github.event_name }}" =~ 'workflow_call' ]]; then
docker_image_12=$(echo ${{inputs.docker_image_prefix}}-pg12)
docker_image_13=$(echo ${{inputs.docker_image_prefix}}-pg13)
docker_image_14=$(echo ${{inputs.docker_image_prefix}}-pg14)
docker_image_15=$(echo ${{inputs.docker_image_prefix}}-pg15)
else
branch_name=$(echo ${{github.head_ref || github.ref_name}} | sed 's#/#-#')
possible_branch_tag=$(echo ${branch_name}-ts2)
extension_version=$(cat EXTENSION_VERSION | tr -d '[:space:]')
stable_branch_tag=$(echo ${extension_version}-ts2)
image_base="ghcr.io/timescale/dev_promscale_extension"
docker_image_12=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg12 ${image_base}:${stable_branch_tag}-pg12)
docker_image_13=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg13 ${image_base}:${stable_branch_tag}-pg13)
docker_image_14=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg14 ${image_base}:${stable_branch_tag}-pg14)
docker_image_15=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg15 ${image_base}:${stable_branch_tag}-pg15)
fi;
echo "docker_image_12=${docker_image_12}" >> ${GITHUB_OUTPUT}
echo "docker_image_13=${docker_image_13}" >> ${GITHUB_OUTPUT}
echo "docker_image_14=${docker_image_14}" >> ${GITHUB_OUTPUT}
echo "docker_image_15=${docker_image_15}" >> ${GITHUB_OUTPUT}
test-end-to-end:
name: e2e
needs: pick_docker_image
runs-on: ubuntu-latest
strategy:
matrix:
test-setups:
- {name: "Singlenode (15)", shortname: "singlenode-15", multi: false, pg: 15}
- {name: "Singlenode (14)", shortname: "singlenode-14", multi: false, pg: 14}
- {name: "Singlenode (13)", shortname: "singlenode-13", multi: false, pg: 13}
- {name: "Singlenode (12)", shortname: "singlenode-12", multi: false, pg: 12}
# TODO (james): Skipping multinode because tests are broken for now
# - {name: "Multinode", shortname: "multinode", multi: true, pg: 14}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
repository: timescale/promscale
ref: ${{ inputs.ref }}
- name: Checkout test data files
run: wget https://github.com/timescale/promscale-test-data/raw/main/traces-dataset.sz -O pkg/tests/testdata/traces-dataset.sz
- name: Set up Go ${{ env.golang-version }}
uses: actions/setup-go@v3.5.0
with:
go-version: ${{ env.golang-version }}
id: go
- name: Use Go module caching
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Test ${{ matrix.test-setups.name }}
env:
DOCKER_IMAGE: ${{ needs.pick_docker_image.outputs[ format('docker_image_{0}', matrix.test-setups.pg) ] }}
MULTI: ${{ matrix.test-setups.multi }}
SHORTNAME: ${{ matrix.test-setups.shortname }}
run: go test -race -timeout=30m ./pkg/tests/end_to_end_tests/ -use-multinode=$MULTI -timescale-docker-image=$DOCKER_IMAGE
test-jaeger-storage-integration:
name: jaeger-storage-integration
needs: pick_docker_image
runs-on: ubuntu-latest
strategy:
matrix:
test-setups:
- {name: "Singlenode (15)", shortname: "singlenode-15", multi: false, pg: 15}
- {name: "Singlenode (14)", shortname: "singlenode-14", multi: false, pg: 14}
- {name: "Singlenode (13)", shortname: "singlenode-13", multi: false, pg: 13}
- {name: "Singlenode (12)", shortname: "singlenode-12", multi: false, pg: 12}
# TODO (james): Skipping multinode because tests are broken for now
# - {name: "Multinode", shortname: "multinode", multi: true, pg: 14}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
repository: timescale/promscale
ref: ${{ inputs.ref }}
- name: Set up Go ${{ env.golang-version }}
uses: actions/setup-go@v3.5.0
with:
go-version: ${{ env.golang-version }}
id: go
- name: Use Go module caching
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Test ${{ matrix.test-setups.name }}
env:
DOCKER_IMAGE: ${{ needs.pick_docker_image.outputs[ format('docker_image_{0}', matrix.test-setups.pg) ] }}
MULTI: ${{ matrix.test-setups.multi }}
SHORTNAME: ${{ matrix.test-setups.shortname }}
run: go test -v -race -timeout=30m ./pkg/tests/end_to_end_tests/ -use-multinode=$MULTI -timescale-docker-image=$DOCKER_IMAGE -tags=jaeger_storage_test -run="^TestJaegerStorageIntegration/"
upgrade_test:
name: upgrade_tests
needs: pick_docker_image
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
repository: timescale/promscale
ref: ${{ inputs.ref }}
- name: Set up Go ${{ env.golang-version }}
uses: actions/setup-go@v3.5.0
with:
go-version: ${{ env.golang-version }}
id: go
- name: Use Go module caching
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Test Upgrade from PG12
env:
DOCKER_IMAGE: ${{ needs.pick_docker_image.outputs.docker_image_12 }}
run: go test -race -v -timeout=30m ./pkg/tests/upgrade_tests/ -timescale-docker-image=$DOCKER_IMAGE
# Added to summarize the matrix
tests-result:
name: e2e results
if: always()
needs:
- test-end-to-end
- test-jaeger-storage-integration
runs-on: ubuntu-latest
steps:
- name: Mark the job as a success
if: needs.test-end-to-end.result == 'success' && needs.test-jaeger-storage-integration.result == 'success'
run: exit 0
- name: Mark the job as a failure
if: needs.test-end-to-end.result != 'success' || needs.test-jaeger-storage-integration.result != 'success'
run: exit 1