-
Notifications
You must be signed in to change notification settings - Fork 129
203 lines (190 loc) · 5.93 KB
/
ci.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
on: [push, pull_request]
name: "CI"
jobs:
ci-pass:
name: CI is green
runs-on: ubuntu-latest
needs:
- cargo-fmt-clippy-and-test-macros-and-cli
- test-sqlite
- test-postgres
- test-tokio-postgres
- test-mysql
- test-mysql-async
- test-tiberius
- doc
steps:
- run: exit 0
setup-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setup-matrix.outputs.matrix }}
steps:
- id: get-msrv
run: |
pwd
echo "MSRV=$(grep -oP 'rust-version\s*=\s*"\K[^"]+' Cargo.toml)" >> "$GITHUB_ENV"
- id: setup-matrix
uses: druzsan/setup-matrix@v2
with:
# Use | to preserve valid YAML syntax
matrix: |
rust: [stable, nightly, ${{ steps.get-msrv.outputs.MSRV }}]
cargo-fmt-clippy-and-test-macros-and-cli:
name: Cargo fmt/clippy/test-macros-and-cli
needs: setup-matrix
runs-on: [windows-latest, ubuntu-latest]
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: rustup self update
- run: rustup component add clippy
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check
- run: cargo clippy --all-targets --all-features
- run: cd refinery_core && cargo test --all-features -- --test-threads 1
- run: cd refinery && cargo build --all-features
- run: cd refinery_macros && cargo test
- run: cd refinery_cli && cargo test
test-sqlite:
name: Test Sqlite
needs: setup-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cargo install --path ./refinery_cli --no-default-features --features=sqlite-bundled
- run: cd refinery && cargo test --features rusqlite --test rusqlite
test-postgres:
name: Test postgres
needs: setup-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
services:
postgres:
image: postgres:9.6.13-alpine
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cargo install --path ./refinery_cli --no-default-features --features=postgresql
- run: cd refinery && cargo test --features postgres --test postgres -- --test-threads 1
test-tokio-postgres:
name: Test tokio-postgres
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
services:
postgres:
image: postgres:9.6.13-alpine
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cd refinery && cargo test --features tokio-postgres --test tokio_postgres -- --test-threads 1
test-mysql:
name: Test mysql
needs: setup-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
services:
postgres:
image: mysql:latest
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: refinery
MYSQL_PASSWORD: root
MYSQL_DATABASE: refinery_test
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cargo install --path ./refinery_cli --no-default-features --features=mysql
- run: cd refinery && cargo test --features mysql --test mysql -- --test-threads 1
test-mysql-async:
name: Test mysql-async
needs: setup-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
services:
postgres:
image: mysql:latest
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: refinery
MYSQL_PASSWORD: root
MYSQL_DATABASE: refinery_test
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cd refinery && cargo test --features mysql_async --test mysql_async -- --test-threads 1
test-tiberius:
name: Test tiberius
needs: setup-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
services:
mssql:
image: mcr.microsoft.com/mssql/server:2017-latest
ports:
- 1433:1433
env:
ACCEPT_EULA: yes
SA_PASSWORD: Passw0rd
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cargo install --path ./refinery_cli --no-default-features --features=mssql
- run: cd refinery && cargo test --features tiberius-config --test tiberius -- --test-threads 1
doc:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: cd refinery && cargo rustdoc --all-features -- -D rustdoc::broken_intra_doc_links
audit:
name: cargo-audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Rust
# actions-rs/audit seems to be unmaintained and it's output doesn't give interverted tree dependencies
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: cargo install cargo-audit
- run: cargo audit