-
Notifications
You must be signed in to change notification settings - Fork 55
184 lines (162 loc) · 6.83 KB
/
pipeline.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
name: Run sytest
on:
push:
branches: ["develop", "release-*"]
pull_request:
workflow_dispatch:
# Only run this action once per pull request/branch; restart if a new commit arrives.
# C.f. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
# and https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
synapse:
name: "Synapse: ${{ matrix.label }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- label: Py 3.10, PG 14, Monolith
sytest-tag: bookworm-python3.10
postgres: postgres
- label: Py 3.10, PG 14, Workers
sytest-tag: bookworm-python3.10
postgres: postgres
workers: workers
- label: debian-testing, Monolith
sytest-tag: testing
postgres: postgres
- label: debian-testing, Workers
sytest-tag: testing
postgres: postgres
workers: workers
container:
image: matrixdotorg/sytest-synapse:${{ matrix.sytest-tag }}
volumes:
# bootstrap.sh expects the sytest source available at /sytest.
# TODO Buildkite mounted /sytest as readonly. Can we do this on GHA? Do we need it?
- ${{ github.workspace }}/sytest:/sytest
# synapse_sytest.sh expects a synapse checkout at /src
- ${{ github.workspace }}/synapse:/src
env:
POSTGRES: ${{ matrix.postgres && 1 }}
WORKERS: ${{ matrix.workers && 1 }}
BLACKLIST: ${{ (matrix.workers && 'synapse-blacklist-with-workers') || 'sytest-blacklist' }}
steps:
- name: Checkout sytest
uses: actions/checkout@v2
with:
path: sytest
# TODO the shell script below is nicked from complement. We use this pattern
# in a few places. Can we make this an Action so it's easier to reuse?
- name: Fetch corresponding synapse branch
shell: bash
run: |
# Attempt to use the version of synapse which best matches the current
# build. Depending on whether this is a PR or release, etc. we need to
# use different fallbacks.
#
# 1. First check if there's a similarly named branch (GITHUB_HEAD_REF
# for pull requests, otherwise GITHUB_REF).
# 2. Attempt to use the base branch, e.g. when merging into release-vX.Y
# (GITHUB_BASE_REF for pull requests).
# 3. Use the default synapse branch ("develop").
for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "develop"; do
# Skip empty branch names and merge commits.
if [[ -z "$BRANCH_NAME" || $BRANCH_NAME =~ ^refs/pull/.* ]]; then
continue
fi
(wget -O - "https://github.com/element-hq/synapse/archive/$BRANCH_NAME.tar.gz" \
| tar -xz --strip-components=1 -C /src/) \
&& echo "Successfully downloaded and extracted $BRANCH_NAME.tar.gz" \
&& break
done
- name: Prepare blacklist file for running with workers
if: ${{ matrix.workers }}
run: cat /src/sytest-blacklist /src/.ci/worker-blacklist > /src/synapse-blacklist-with-workers
- name: Run sytest
run: |
echo POSTGRES=${POSTGRES:-<NOT SET>}
echo WORKERS=${WORKERS:-<NOT SET>}
echo BLACKLIST=${BLACKLIST:-<NOT SET>}
bash -xe /bootstrap.sh synapse
- name: Summarise results.tap
# Use always() to run this step even if previous ones failed.
if: ${{ always() }}
run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
- name: Upload SyTest logs
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: ${{ always() }}
with:
name: Sytest Logs - ${{ job.status }} - (Synapse, ${{ matrix.label }})
path: |
/logs/results.tap
/logs/**/*.log*
dendrite:
runs-on: ubuntu-latest
name: "Dendrite: ${{ matrix.label }}"
strategy:
fail-fast: false
matrix:
include:
- label: SQLite
- label: Postgres
postgres: postgres
container:
image: matrixdotorg/sytest-dendrite
volumes:
# bootstrap.sh expects the sytest source available at /sytest.
# TODO Buildkite mounted /sytest as readonly. Can we do this on GHA? Do we need it?
- ${{ github.workspace }}/sytest:/sytest
# synapse_sytest.sh expects a synapse checkout at /src
- ${{ github.workspace }}/dendrite:/src
env:
POSTGRES: ${{ matrix.postgres && 1 }}
API: ${{ matrix.api && 1 }}
steps:
- name: Checkout sytest
uses: actions/checkout@v2
with:
path: sytest
# TODO the shell script below is nicked from complement. We use this pattern
# in a few places. Can we make this an Action so it's easier to reuse?
- name: Fetch corresponding dendrite branch
shell: bash
run: |
# Attempt to use the version of dendrite which best matches the current
# build. Depending on whether this is a PR or release, etc. we need to
# use different fallbacks.
#
# 1. First check if there's a similarly named branch (GITHUB_HEAD_REF
# for pull requests, otherwise GITHUB_REF).
# 2. Attempt to use the base branch, e.g. when merging into release-vX.Y
# (GITHUB_BASE_REF for pull requests).
# 3. Use the default dendrite branch ("master").
for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "master"; do
# Skip empty branch names and merge commits.
if [[ -z "$BRANCH_NAME" || $BRANCH_NAME =~ ^refs/pull/.* ]]; then
continue
fi
(wget -O - "https://github.com/element-hq/dendrite/archive/$BRANCH_NAME.tar.gz" \
| tar -xz --strip-components=1 -C /src/) \
&& echo "Successfully downloaded and extracted $BRANCH_NAME.tar.gz" \
&& break
done
- name: Run sytest
run: |
echo POSTGRES=${POSTGRES:-<NOT SET>}
echo API=${API:-<NOT SET>}
bash -xe /bootstrap.sh dendrite
- name: Summarise results.tap
if: ${{ always() }}
run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
- name: Upload SyTest logs
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: ${{ always() }}
with:
name: Sytest Logs - ${{ job.status }} - (Dendrite, ${{ join(matrix.*, ', ') }})
path: |
/logs/results.tap
/logs/**/*.log*