-
-
Notifications
You must be signed in to change notification settings - Fork 36
236 lines (236 loc) · 7.37 KB
/
tests.yaml
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: tests
'on':
pull_request:
paths-ignore:
- '**.md'
- .github/ISSUE_TEMPLATE/**
push:
paths-ignore:
- '**.md'
- .github/ISSUE_TEMPLATE/**
branches:
- main
- pr/**/ci
concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}'
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: '--workspace'
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- run: cargo clippy --all -- -D warnings
integration-sqlite:
name: SQLite integration tests
runs-on: ubuntu-latest
needs:
- check
- test
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Install sea-orm-cli
uses: baptiste0928/cargo-install@v2
with:
crate: sea-orm-cli
version: 1.0.0
- name: Remove generated folder
run: rm -rf ./examples/sqlite/src
- name: Copy sample database
run: cp ./examples/sqlite/sakila.db .
- name: Generate entities
run: >-
sea-orm-cli generate entity -o examples/sqlite/src/entities -u
sqlite://sakila.db --seaography
- name: Generate Seaography project
uses: actions-rs/cargo@v1
with:
command: run
args: >
--package seaography-cli -- ./examples/sqlite
./examples/sqlite/src/entities sqlite://sakila.db
seaography-sqlite-example -f actix
- name: Depends on local seaography
run: >-
sed -i '/^\[dependencies.seaography\]$/a \path = "..\/..\/"'
./examples/sqlite/Cargo.toml
- name: Build example
working-directory: ./examples/sqlite
run: cargo build
- name: Integration tests
working-directory: ./examples/sqlite
run: cargo test
integration-mysql:
name: MySQL integration tests
runs-on: ubuntu-latest
needs:
- check
- test
services:
mysql:
image: 'mysql:8.0'
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
- name: Install sea-orm-cli
uses: baptiste0928/cargo-install@v2
with:
crate: sea-orm-cli
version: 1.0.0
- name: Remove generated folder
run: rm -rf ./examples/mysql/src
- name: Create DB
run: mysql -uroot -h 127.0.0.1 mysql -e 'CREATE DATABASE `sakila`'
- name: Grant Privilege
run: >-
mysql -uroot -h 127.0.0.1 mysql -e "GRANT ALL PRIVILEGES ON *.* TO
'sea'@'%'"
- name: Import DB Schema
run: mysql -uroot -h 127.0.0.1 sakila < sakila-schema.sql
working-directory: ./examples/mysql
- name: Import DB Data
run: mysql -uroot -h 127.0.0.1 sakila < sakila-data.sql
working-directory: ./examples/mysql
- name: Generate entities
run: >-
sea-orm-cli generate entity -o ./examples/mysql/src/entities -u
mysql://sea:[email protected]/sakila --seaography
- name: Generate Seaography project
uses: actions-rs/cargo@v1
with:
command: run
args: >
--package seaography-cli -- ./examples/mysql
./examples/mysql/src/entities mysql://sea:[email protected]/sakila
seaography-mysql-example -f axum
- name: Depends on local seaography
run: >-
sed -i '/^\[dependencies.seaography\]$/a \path = "..\/..\/"'
./examples/mysql/Cargo.toml
- name: Fix Nullable not implemented for Vec<String> and tsvector
run: 'sed -i "24,28d" ./examples/mysql/src/entities/film.rs'
- name: Build example
working-directory: ./examples/mysql
run: cargo build
- name: Integration tests
working-directory: ./examples/mysql
run: cargo test
integration-postgres:
name: Postgres integration tests
runs-on: ubuntu-latest
needs:
- check
- test
services:
mysql:
image: 'postgres:14.4'
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
- name: Install sea-orm-cli
uses: baptiste0928/cargo-install@v2
with:
crate: sea-orm-cli
version: 1.0.0
- name: Remove generated folder
run: rm -rf ./examples/postgres/src
- name: Create DB
run: >-
psql -q postgres://sea:sea@localhost/postgres -c 'CREATE DATABASE
"sakila"'
- name: Import DB Schema
run: 'psql -q postgres://sea:sea@localhost/sakila < sakila-schema.sql'
working-directory: ./examples/postgres
- name: Import DB Data
run: 'psql -q postgres://sea:sea@localhost/sakila < sakila-data.sql'
working-directory: ./examples/postgres
- name: Generate entities
run: >-
sea-orm-cli generate entity -o ./examples/postgres/src/entities -u
postgres://sea:[email protected]/sakila?currentSchema=public --seaography
- name: Generate Seaography project
uses: actions-rs/cargo@v1
with:
command: run
args: >
--package seaography-cli -- ./examples/postgres
./examples/postgres/src/entities
postgres://sea:[email protected]/sakila?currentSchema=public
seaography-postgres-example -f poem
- name: Depends on local seaography
run: >-
sed -i '/^\[dependencies.seaography\]$/a \path = "..\/..\/"'
./examples/postgres/Cargo.toml
- name: Fix Nullable not implemented for Vec<String> and tsvector
run: 'sed -i "26,27d" ./examples/postgres/src/entities/film.rs'
- name: Build example
working-directory: ./examples/postgres
run: cargo build
- name: Integration tests
working-directory: ./examples/postgres
run: cargo test