@@ -19,250 +19,38 @@ defaults:
19
19
run :
20
20
shell : bash
21
21
jobs :
22
- e2e-test :
23
- if : github.repository_owner == 'getsentry'
24
- runs-on : ubuntu-22.04
25
- name : " Sentry self-hosted end-to-end tests"
26
- steps :
27
- - name : Checkout
28
- uses : actions/checkout@v4
29
- with :
30
- path : self-hosted
31
-
32
- - name : End to end tests
33
- uses : getsentry/action-self-hosted-e2e-tests@main
34
- with :
35
- project_name : self-hosted
36
-
37
22
unit-test :
38
23
if : github.repository_owner == 'getsentry'
39
- runs-on : ubuntu-22.04
40
- name : " unit tests"
24
+ runs-on : ${{ matrix.os }}
25
+ strategy :
26
+ matrix :
27
+ os : [ubuntu-24.04, ubuntu-24.04-arm]
28
+ name : ${{ matrix.os == 'ubuntu-24.04-arm' && 'unit tests (arm64)' || 'unit tests' }}
41
29
steps :
42
30
- name : Checkout
43
31
uses : actions/checkout@v4
44
32
45
- - name : Unit Tests
46
- run : ./unit-test.sh
47
-
48
- upgrade-test :
49
- if : github.repository_owner == 'getsentry'
50
- runs-on : ubuntu-22.04
51
- name : " Sentry upgrade test"
52
- env :
53
- REPORT_SELF_HOSTED_ISSUES : 0
54
- steps :
55
- - name : Get latest self-hosted release version
56
- run : |
57
- LATEST_TAG=$(curl -s https://api.github.com/repos/getsentry/self-hosted/releases/latest | jq -r '.tag_name')
58
- echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
59
-
60
- - name : Checkout latest release
61
- uses : actions/checkout@v4
62
- with :
63
- ref : ${{ env.LATEST_TAG }}
64
-
65
33
- name : Get Compose
66
- run : |
67
- # Docker Compose v1 is installed here, remove it
68
- sudo rm -f "/usr/local/bin/docker-compose"
69
- sudo rm -f "/usr/local/lib/docker/cli-plugins/docker-compose"
70
- sudo mkdir -p "/usr/local/lib/docker/cli-plugins"
71
- sudo curl -L https://github.com/docker/compose/releases/download/v2.26.0/docker-compose-`uname -s`-`uname -m` -o "/usr/local/lib/docker/cli-plugins/docker-compose"
72
- sudo chmod +x "/usr/local/lib/docker/cli-plugins/docker-compose"
73
-
74
- - name : Prepare Docker Volume Caching
75
- id : cache_key
76
- run : |
77
- # Set permissions for docker volumes so we can cache and restore
78
- sudo chmod o+x /var/lib/docker
79
- sudo chmod -R o+rwx /var/lib/docker/volumes
80
- source .env
81
- SENTRY_IMAGE_SHA=$(docker buildx imagetools inspect $SENTRY_IMAGE --format "{{println .Manifest.Digest}}")
82
- echo "SENTRY_IMAGE_SHA=$SENTRY_IMAGE_SHA" >> $GITHUB_OUTPUT
83
- SNUBA_IMAGE_SHA=$(docker buildx imagetools inspect $SNUBA_IMAGE --format "{{println .Manifest.Digest}}")
84
- echo "SNUBA_IMAGE_SHA=$SNUBA_IMAGE_SHA" >> $GITHUB_OUTPUT
85
-
86
- - name : Restore DB Volumes Cache
87
- id : restore_cache
88
- uses : actions/cache/restore@v4
89
- with :
90
- key : db-volumes-v4-${{ steps.cache_key.outputs.SENTRY_IMAGE_SHA }}-${{ steps.cache_key.outputs.SNUBA_IMAGE_SHA }}
91
- restore-keys : |
92
- db-volumes-v4-${{ steps.cache_key.outputs.SENTRY_IMAGE_SHA }}
93
- db-volumes-v4-
94
- path : |
95
- /var/lib/docker/volumes/sentry-postgres/_data
96
- /var/lib/docker/volumes/sentry-clickhouse/_data
97
- /var/lib/docker/volumes/sentry-kafka/_data
34
+ uses : ./get-compose-action
98
35
99
- - name : Install ${{ env.LATEST_TAG }}
100
- env :
101
- SKIP_DB_MIGRATIONS : ${{ steps.restore_cache.outputs.cache-hit == 'true' && '1' || '' }}
102
- run : |
103
- # This is for the cache restore on Kafka to work in older releases
104
- docker run --rm -v "sentry-kafka:/data" busybox chown -R 1000:1000 /data
105
- ./install.sh
106
-
107
- - name : Prepare Docker Volume Caching
108
- run : |
109
- # Set permissions for docker volumes so we can cache and restore
110
- sudo chmod o+x /var/lib/docker
111
- sudo chmod -R o+rx /var/lib/docker/volumes
112
- # Set tar ownership for it to be able to read
113
- # From: https://github.com/actions/toolkit/issues/946#issuecomment-1726311681
114
- sudo chown root /usr/bin/tar && sudo chmod u+s /usr/bin/tar
115
-
116
- - name : Save DB Volumes Cache
117
- if : steps.restore_cache.outputs.cache-hit != 'true'
118
- uses : actions/cache/save@v4
119
- with :
120
- key : ${{ steps.restore_cache.outputs.cache-primary-key }}
121
- path : |
122
- /var/lib/docker/volumes/sentry-postgres/_data
123
- /var/lib/docker/volumes/sentry-clickhouse/_data
124
- /var/lib/docker/volumes/sentry-kafka/_data
125
-
126
- - name : Checkout current ref
127
- uses : actions/checkout@v4
128
-
129
- - name : Install current ref
130
- run : |
131
- # This is for the cache restore on Kafka to work in older releases
132
- docker run --rm -v "sentry-kafka:/data" busybox chown -R 1000:1000 /data
133
- ./install.sh
134
-
135
- - name : Inspect failure
136
- if : failure()
137
- run : |
138
- docker compose ps
139
- docker compose logs
36
+ - name : Unit Tests
37
+ run : ./unit-test.sh
140
38
141
39
integration-test :
142
40
if : github.repository_owner == 'getsentry'
143
- runs-on : ubuntu-22.04
144
- name : integration test ${{ matrix.compose_version }} - customizations ${{ matrix.customizations }}
41
+ runs-on : ${{ matrix.os }}
145
42
strategy :
146
- fail-fast : false
147
43
matrix :
148
- customizations : ["disabled", "enabled"]
149
- compose_version : ["v2.19.0", "v2.26.0"]
150
- include :
151
- - compose_version : " v2.19.0"
152
- compose_path : " /usr/local/lib/docker/cli-plugins"
153
- - compose_version : " v2.26.0"
154
- compose_path : " /usr/local/lib/docker/cli-plugins"
44
+ os : [ubuntu-24.04, ubuntu-24.04-arm]
45
+ name : ${{ matrix.os == 'ubuntu-24.04-arm' && 'integration test (arm64)' || 'integration test' }}
155
46
env :
156
- COMPOSE_PROJECT_NAME : self-hosted-${{ strategy.job-index }}
157
47
REPORT_SELF_HOSTED_ISSUES : 0
158
48
SELF_HOSTED_TESTING_DSN : ${{ vars.SELF_HOSTED_TESTING_DSN }}
159
49
steps :
160
50
- name : Checkout
161
51
uses : actions/checkout@v4
162
52
163
- - name : Setup dev environment
164
- run : |
165
- pip install -r requirements-dev.txt
166
- echo "PY_COLORS=1" >> "$GITHUB_ENV"
167
- ### pytest-sentry configuration ###
168
- if [ "$GITHUB_REPOSITORY" = "getsentry/self-hosted" ]; then
169
- echo "PYTEST_SENTRY_DSN=$SELF_HOSTED_TESTING_DSN" >> $GITHUB_ENV
170
- echo "PYTEST_SENTRY_TRACES_SAMPLE_RATE=0" >> $GITHUB_ENV
171
-
172
- # This records failures on master to sentry in order to detect flakey tests, as it's
173
- # expected that people have failing tests on their PRs
174
- if [ "$GITHUB_REF" = "refs/heads/master" ]; then
175
- echo "PYTEST_SENTRY_ALWAYS_REPORT=1" >> $GITHUB_ENV
176
- fi
177
- fi
178
-
179
- - name : Get Compose
180
- run : |
181
- # Always remove `docker compose` support as that's the newer version
182
- # and comes installed by default nowadays.
183
- sudo rm -f "/usr/local/lib/docker/cli-plugins/docker-compose"
184
- # Docker Compose v1 is installed here, remove it
185
- sudo rm -f "/usr/local/bin/docker-compose"
186
- sudo rm -f "${{ matrix.compose_path }}/docker-compose"
187
- sudo mkdir -p "${{ matrix.compose_path }}"
188
- sudo curl -L https://github.com/docker/compose/releases/download/${{ matrix.compose_version }}/docker-compose-`uname -s`-`uname -m` -o "${{ matrix.compose_path }}/docker-compose"
189
- sudo chmod +x "${{ matrix.compose_path }}/docker-compose"
190
-
191
- - name : Prepare Docker Volume Caching
192
- id : cache_key
193
- run : |
194
- # Set permissions for docker volumes so we can cache and restore
195
- sudo chmod o+x /var/lib/docker
196
- sudo chmod -R o+rwx /var/lib/docker/volumes
197
- source .env
198
- SENTRY_IMAGE_SHA=$(docker buildx imagetools inspect $SENTRY_IMAGE --format "{{println .Manifest.Digest}}")
199
- echo "SENTRY_IMAGE_SHA=$SENTRY_IMAGE_SHA" >> $GITHUB_OUTPUT
200
- SNUBA_IMAGE_SHA=$(docker buildx imagetools inspect $SNUBA_IMAGE --format "{{println .Manifest.Digest}}")
201
- echo "SNUBA_IMAGE_SHA=$SNUBA_IMAGE_SHA" >> $GITHUB_OUTPUT
202
-
203
- - name : Restore DB Volumes Cache
204
- id : restore_cache
205
- uses : actions/cache/restore@v4
206
- with :
207
- key : db-volumes-v4-${{ steps.cache_key.outputs.SENTRY_IMAGE_SHA }}-${{ steps.cache_key.outputs.SNUBA_IMAGE_SHA }}
208
- restore-keys : |
209
- db-volumes-v4-${{ steps.cache_key.outputs.SENTRY_IMAGE_SHA }}
210
- db-volumes-v4-
211
- path : |
212
- /var/lib/docker/volumes/sentry-postgres/_data
213
- /var/lib/docker/volumes/sentry-clickhouse/_data
214
- /var/lib/docker/volumes/sentry-kafka/_data
215
-
216
- - name : Install self-hosted
217
- env :
218
- SKIP_DB_MIGRATIONS : ${{ steps.restore_cache.outputs.cache-hit == 'true' && '1' || '' }}
219
- run : |
220
- # This is for the cache restore on Kafka to work in older releases
221
- docker run --rm -v "sentry-kafka:/data" busybox chown -R 1000:1000 /data
222
- ./install.sh
223
-
224
- - name : Prepare Docker Volume Caching
225
- run : |
226
- # Set permissions for docker volumes so we can cache and restore
227
- sudo chmod o+x /var/lib/docker
228
- sudo chmod -R o+rx /var/lib/docker/volumes
229
- # Set tar ownership for it to be able to read
230
- # From: https://github.com/actions/toolkit/issues/946#issuecomment-1726311681
231
- sudo chown root /usr/bin/tar && sudo chmod u+s /usr/bin/tar
232
-
233
- - name : Save DB Volumes Cache
234
- if : steps.restore_cache.outputs.cache-hit != 'true'
235
- uses : actions/cache/save@v4
236
- with :
237
- key : ${{ steps.restore_cache.outputs.cache-primary-key }}
238
- path : |
239
- /var/lib/docker/volumes/sentry-postgres/_data
240
- /var/lib/docker/volumes/sentry-clickhouse/_data
241
- /var/lib/docker/volumes/sentry-kafka/_data
242
-
243
- - name : Integration Test
244
- run : |
245
- docker compose up --wait
246
- if [ "${{ matrix.compose_version }}" = "v2.19.0" ]; then
247
- pytest --reruns 3 --cov --junitxml=junit.xml _integration-test/ --customizations=${{ matrix.customizations }}
248
- else
249
- pytest --cov --junitxml=junit.xml _integration-test/ --customizations=${{ matrix.customizations }}
250
- fi
251
-
252
- - name : Inspect failure
253
- if : failure()
254
- run : |
255
- docker compose ps
256
- docker compose logs
257
-
258
- - name : Upload coverage to Codecov
259
- uses : codecov/codecov-action@v5
260
- with :
261
- token : ${{ secrets.CODECOV_TOKEN }}
262
- slug : getsentry/self-hosted
263
-
264
- - name : Upload test results to Codecov
265
- if : ${{ !cancelled() }}
266
- uses : codecov/test-results-action@v1
53
+ - name : Use action from local checkout
54
+ uses : ' ./'
267
55
with :
268
- token : ${{ secrets.CODECOV_TOKEN }}
56
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
0 commit comments