-
-
Notifications
You must be signed in to change notification settings - Fork 25
253 lines (196 loc) · 6.6 KB
/
rust.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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: Test and Build Rust
on:
push:
pull_request:
types: [opened, reopened]
schedule:
# Check if it works with current dependencies (weekly on Wednesday 2:32 UTC)
- cron: '32 2 * * 3'
jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/checkout@v3
- name: Setup Rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Run clippy
run: cargo clippy --verbose --all-targets --all-features -- -D warnings
test_postgres_blocking:
name: Test blocking
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/checkout@v3
- name: Setup Rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Install diesel-cli
run: cargo install diesel_cli --no-default-features --features postgres
- name: Setup Postgres db
working-directory: ./fang/postgres_migrations
run: diesel setup --database-url "postgres://postgres:postgres@localhost/fang"
- name: Run blocking tests
run: cargo test "blocking::queue::postgres" --verbose --features blocking --color always -- --nocapture
- name: Run blocking dirty tests
run: cargo test "blocking::worker" --verbose --features blocking -- --ignored
test_fang_derive_error:
name: Test fang_derive_error
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/checkout@v3
- name: Setup Rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Run fang derive error tests
run: cargo test "fang_derive_error" --verbose --color always -- --nocapture
test_postgres:
name: Test postgres
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres:postgres@localhost/fang
CARGO_TERM_COLOR: always
strategy:
matrix:
toolchain:
- stable
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Setup Rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Install diesel-cli
run: cargo install diesel_cli --no-default-features --features postgres
- name: Setup Postgres db
working-directory: ./fang/postgres_migrations
run: diesel setup --database-url "postgres://postgres:postgres@localhost/fang"
- name: Run tests
run: cargo test "asynk::async_queue::postgres" --verbose --features asynk-postgres --color always -- --nocapture
- name: Run worker tests
run: cargo test "asynk::async_worker::async_worker_tests" --verbose --features asynk-postgres --color always -- --nocapture
test_sqlite:
name: Test sqlite
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/checkout@v3
- name: Setup Rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Install sqlite3
run: |
sudo apt install -y sqlite3
sqlite3 fang.db "VACUUM;"
mkdir tests_sqlite
- name: Install diesel-cli
run: cargo install diesel_cli --no-default-features --features sqlite
- name: Setup Sqlite db
working-directory: ./fang/sqlite_migrations
run: diesel setup --database-url "sqlite3://../../../fang.db"
- name: Run tests
run: cargo test "asynk::async_queue::sqlite" --verbose --features asynk-sqlite -- --nocapture
release:
name: Release x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/checkout@v3
- name: Setup Rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Build release
run: cargo build --release --verbose --all-features --target x86_64-unknown-linux-gnu
test_mysql:
name: Test mysql
runs-on: ubuntu-latest
env:
DATABASE_URL: mysql://root:mysql@localhost/fang
CARGO_TERM_COLOR: always
strategy:
matrix:
toolchain:
- stable
services:
# Label used to access the service container
mysql:
# Docker Hub image
image: mysql:8.1
# Provide the password for postgres
env:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: fang
# here we should check if mysql is ready, but this does not work
options: >-
--health-cmd "mysqladmin ping -h localhost -u root -pmysql"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306
steps:
- uses: actions/checkout@v3
- name: Setup Rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Install diesel-cli
run: cargo install diesel_cli --no-default-features --features mysql
- name: Setup MySQL db
working-directory: ./fang/mysql_migrations
run: diesel setup --database-url "mysql://root:[email protected]/fang"
- name: Run tests
run: cargo test "asynk::async_queue::mysql" --verbose --features asynk-mysql --color always -- --nocapture