-
Notifications
You must be signed in to change notification settings - Fork 17
236 lines (189 loc) · 5.74 KB
/
build.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
227
228
229
230
231
232
233
234
235
236
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
toolchain-compat:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: '1.65'
profile: minimal
default: true
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-mintoolchain-${{ hashFiles('**/Cargo.lock') }}
- name: Check
run: cargo check --locked
linux-build:
runs-on: ubuntu-latest
env:
BUILD_TARGET: x86_64-unknown-linux-musl
# For E2E tests.
PORTIER_BIN: target/x86_64-unknown-linux-musl/debug/portier-broker
services:
redis:
image: redis:latest
ports:
- 6379:6379
steps:
- name: APT dependencies
run: sudo apt-get install gettext musl-tools
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ env.BUILD_TARGET }}
profile: minimal
components: rustfmt, clippy
default: true
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --locked --target $BUILD_TARGET
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Linux binary (debug)
path: target/${{ env.BUILD_TARGET }}/debug/portier-broker
- name: Test
run: cargo test --locked --target $BUILD_TARGET
- name: Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Rustfmt
run: cargo fmt -- --check
- name: Check translations
run: |
set -e
if [ -n "$(git status -s)" ]; then
echo "Working tree dirty before checking translations:"
echo
git status
exit 1
fi
./msgfmt.sh
if [ -n "$(git status -s)" ]; then
echo "Working tree dirty after checking translations."
echo "If this fails, the lang/*.mo files are out of date."
echo "To fix this, run: ./msgfmt.sh"
echo
git status
exit 1
fi
# Feature `insecure` is used so the broker can connect to
# the plain HTTP server created by the E2E test harness.
- name: Build insecure
run: cargo build --locked --target $BUILD_TARGET --features insecure
- name: E2E test deps
run: cd tests/e2e/ && yarn --frozen-lockfile
- name: E2E test Firefox
run: cd tests/e2e/ && SELENIUM_BROWSER=firefox ./main.js
- name: E2E test Chrome
run: cd tests/e2e/ && SELENIUM_BROWSER=chrome ./main.js
- name: E2E test Redis
run: cd tests/e2e/ && TEST_STORE=redis TEST_KEY_MANAGER=rotating ./main.js
- name: E2E test SQLite
run: cd tests/e2e/ && TEST_STORE=sqlite TEST_KEY_MANAGER=rotating ./main.js
- name: E2E test sendmail
run: cd tests/e2e/ && TEST_MAILER=sendmail ./main.js
- name: E2E test Postmark
run: cd tests/e2e/ && TEST_MAILER=postmark ./main.js
- name: E2E test Mailgun
run: cd tests/e2e/ && TEST_MAILER=mailgun ./main.js
- name: Deploy staging
if: github.repository == 'portier/portier-broker' && github.ref == 'refs/heads/main'
run: |
curl -X POST \
-H 'Authorization: token ${{ secrets.BOT_GITHUB_TOKEN }}' \
-H 'Accept: application/vnd.github.v3+json' \
https://api.github.com/repos/portier/public-infra/actions/workflows/update_testing_broker.yml/dispatches \
-d '{ "ref": "main" }'
macos-build:
runs-on: macos-latest
steps:
# Workaround for: https://github.com/actions/cache/issues/403
- name: Install GNU tar
run: |
brew install gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --locked
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: MacOS binary (debug)
path: target/debug/portier-broker
- name: Test
run: cargo test --locked
- name: E2E test deps
run: cd tests/e2e/ && yarn --frozen-lockfile
- name: E2E test Safari
run: cd tests/e2e/ && SELENIUM_BROWSER=safari ./main.js
# TODO: fails sporadically
continue-on-error: true
timeout-minutes: 1
windows-build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: v1-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --locked
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Windows binary (debug)
path: target/debug/portier-broker.exe
- name: Test
run: cargo test --locked