-
-
Notifications
You must be signed in to change notification settings - Fork 39
283 lines (269 loc) · 8.78 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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: sea-schema
on:
pull_request:
paths-ignore:
- '**.md'
- '.github/ISSUE_TEMPLATE/**'
push:
paths-ignore:
- '**.md'
- '.github/ISSUE_TEMPLATE/**'
branches:
- master
- 0.*.x
- pr/**/ci
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- run: cargo clippy --all-targets --all -- -D warnings
test:
name: Unit Test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --all
- run: cargo test
compile-mysql:
name: Compile MySQL
runs-on: ubuntu-20.04
strategy:
matrix:
project: [live/mysql, discovery/mysql, writer/mysql]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.project }}
- run: cargo build --manifest-path tests/${{ matrix.project }}/Cargo.toml
- run: cargo test --manifest-path tests/${{ matrix.project }}/Cargo.toml --no-run
compile-postgres:
name: Compile Postgres
runs-on: ubuntu-20.04
strategy:
matrix:
project: [live/postgres, discovery/postgres, writer/postgres]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-postgres-${{ matrix.project }}
- run: cargo build --manifest-path tests/${{ matrix.project }}/Cargo.toml
- run: cargo test --manifest-path tests/${{ matrix.project }}/Cargo.toml --no-run
compile-sqlite:
name: Compile SQLite
runs-on: ubuntu-20.04
strategy:
matrix:
project: [live/sqlite, discovery/sqlite, writer/sqlite]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-sqlite-${{ matrix.project }}
- run: cargo build --manifest-path tests/${{ matrix.project }}/Cargo.toml
- run: cargo test --manifest-path tests/${{ matrix.project }}/Cargo.toml --no-run
mysql:
name: MySQL
runs-on: ubuntu-20.04
needs: compile-mysql
env:
DATABASE_URL_SAKILA: "mysql://sea:sea@localhost/sakila"
DATABASE_URL_LIVE: "mysql://sea:sea@localhost"
strategy:
fail-fast: false
matrix:
version: [8.0, 5.7]
project: [live/mysql, discovery/mysql, writer/mysql]
services:
mysql:
image: mysql:${{ matrix.version }}
env:
MYSQL_HOST: 127.0.0.1
MYSQL_DB: mysql
MYSQL_USER: sea
MYSQL_PASSWORD: sea
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD:
ports:
- "3306:3306"
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.project }}
- run: mysql -uroot -h 127.0.0.1 mysql -e 'CREATE DATABASE `sakila`'
- run: mysql -uroot -h 127.0.0.1 mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'sea'@'%'"
- run: mysql -uroot -h 127.0.0.1 sakila < sakila-schema.sql
working-directory: ./tests/sakila/mysql
- run: mysql -uroot -h 127.0.0.1 sakila < sakila-data.sql
working-directory: ./tests/sakila/mysql
- run: cargo run --manifest-path tests/${{ matrix.project }}/Cargo.toml
- run: cargo test --manifest-path tests/${{ matrix.project }}/Cargo.toml
mariadb:
name: MariaDB
runs-on: ubuntu-20.04
needs: compile-mysql
env:
DATABASE_URL_SAKILA: "mysql://sea:sea@localhost/sakila"
DATABASE_URL_LIVE: "mysql://sea:sea@localhost"
strategy:
fail-fast: false
matrix:
version: [10.6]
project: [live/mysql, discovery/mysql, writer/mysql]
services:
mysql:
image: mariadb:${{ matrix.version }}
env:
MYSQL_HOST: 127.0.0.1
MYSQL_DB: mysql
MYSQL_USER: sea
MYSQL_PASSWORD: sea
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD:
ports:
- "3306:3306"
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.project }}
- run: mysql -uroot -h 127.0.0.1 mysql -e 'CREATE DATABASE `sakila`'
- run: mysql -uroot -h 127.0.0.1 mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'sea'@'%'"
- run: mysql -uroot -h 127.0.0.1 sakila < sakila-schema.sql
working-directory: ./tests/sakila/mysql
- run: mysql -uroot -h 127.0.0.1 sakila < sakila-data.sql
working-directory: ./tests/sakila/mysql
- run: cargo run --manifest-path tests/${{ matrix.project }}/Cargo.toml
- run: cargo test --manifest-path tests/${{ matrix.project }}/Cargo.toml
postgres:
name: Postgres
needs: compile-postgres
runs-on: ubuntu-20.04
env:
DATABASE_URL_SAKILA: "postgres://sea:sea@localhost/sakila"
DATABASE_URL_LIVE: "postgres://sea:sea@localhost"
strategy:
fail-fast: false
matrix:
version: [14.4]
project: [live/postgres, discovery/postgres, writer/postgres]
services:
postgres:
image: postgres:${{ matrix.version }}
env:
POSTGRES_HOST: 127.0.0.1
POSTGRES_USER: sea
POSTGRES_PASSWORD: sea
ports:
- "5432:5432"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-postgres-${{ matrix.project }}
- run: psql -q postgres://sea:sea@localhost/postgres -c 'CREATE DATABASE "sakila"'
- run: psql -q postgres://sea:sea@localhost/sakila < sakila-schema.sql
working-directory: ./tests/sakila/postgres
- run: psql -q postgres://sea:sea@localhost/sakila < sakila-data.sql
working-directory: ./tests/sakila/postgres
- run: cargo run --manifest-path tests/${{ matrix.project }}/Cargo.toml
- run: cargo test --manifest-path tests/${{ matrix.project }}/Cargo.toml
sqlite:
name: SQLite
needs: compile-sqlite
runs-on: ubuntu-20.04
env:
DATABASE_URL_SAKILA: "sqlite://tests/sakila/sqlite/sakila.db"
DATABASE_URL_LIVE: "sqlite::memory:"
strategy:
fail-fast: false
matrix:
project: [live/sqlite, discovery/sqlite, writer/sqlite]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
Cargo.lock
target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-sqlite-${{ matrix.project }}
- run: cargo run --manifest-path tests/${{ matrix.project }}/Cargo.toml
- run: cargo test --manifest-path tests/${{ matrix.project }}/Cargo.toml