forked from diesel-rs/diesel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
252 lines (238 loc) · 8.89 KB
/
azure-pipelines.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
trigger: ["master"]
pr: ["master"]
jobs:
- template: _build/azure-pipelines-template.yml
parameters:
name: macOS_sqlite
displayName: macOS SQLite
vmImage: macOS-10.13
variables:
BACKEND: sqlite
SQLITE_DATABASE_URL: /tmp/test.db
setup:
- bash: |
brew update &&
brew install sqlite
displayName: Install sqlite
- template: _build/azure-pipelines-template.yml
parameters:
name: macOS_postgres
displayName: macOS PostgreSQL
vmImage: macOS-10.13
variables:
BACKEND: postgres
PG_DATABASE_URL: postgres://postgres@localhost/
PG_EXAMPLE_DATABASE_URL: postgres://postgres@localhost/diesel_example
setup:
- bash: |
brew update &&
brew install postgres &&
brew services start postgres &&
sleep 3 &&
/usr/local/opt/postgres/bin/createuser -s postgres
displayName: Install postgresql
- template: _build/azure-pipelines-template.yml
parameters:
name: macOS_mysql
displayName: macOS MySQL
vmImage: macOS-10.13
variables:
BACKEND: mysql
MYSQL_DATABASE_URL: mysql://root@localhost/diesel_test
MYSQL_EXAMPLE_DATABASE_URL: mysql://root@localhost/diesel_example
MYSQL_UNIT_TEST_DATABASE_URL: mysql://root@localhost/diesel_unit_test
RUST_TEST_THREADS: 1
MYSQLCLIENT_LIB_DIR: /usr/local/Cellar/mysql/8.0.19/lib
setup:
- bash: |
brew update &&
brew install mysql &&
brew services start mysql &&
brew services stop mysql;sleep 3;brew services start mysql &&
sleep 2 &&
/usr/local/Cellar/mysql/8.0.19/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot
displayName: Install mysql
- template: _build/azure-pipelines-template.yml
parameters:
name: Linux_sqlite
displayName: Linux SQLite
vmImage: ubuntu-16.04
variables:
BACKEND: sqlite
SQLITE_DATABASE_URL: /tmp/test.db
setup:
- bash: |
sudo apt-get update &&
sudo apt-get -y install sqlite3 libsqlite3-dev
displayName: Install sqlite
- template: _build/azure-pipelines-template.yml
parameters:
name: Linux_postgres
displayName: Linux PostgreSQL
vmImage: ubuntu-16.04
variables:
BACKEND: postgres
PG_DATABASE_URL: postgres://postgres:postgres@localhost/
PG_EXAMPLE_DATABASE_URL: postgres://postgres:postgres@localhost/diesel_example
setup:
- bash: |
sudo apt-get update &&
sudo apt-get -y install postgresql libpq-dev &&
echo "host all all 127.0.0.1/32 md5" > sudo tee -a /etc/postgresql/9.5/main/pg_hba.conf &&
sudo service postgresql restart && sleep 3 &&
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" &&
sudo service postgresql restart && sleep 3
displayName: Install postgresql
- template: _build/azure-pipelines-template.yml
parameters:
name: Linux_mysql
displayName: Linux MySQL
vmImage: ubuntu-16.04
variables:
BACKEND: mysql
MYSQL_DATABASE_URL: mysql://root:root@localhost/diesel_test
MYSQL_EXAMPLE_DATABASE_URL: mysql://root:root@localhost/diesel_example
MYSQL_UNIT_TEST_DATABASE_URL: mysql://root:root@localhost/diesel_unit_test
RUST_TEST_THREADS: 1
setup:
- bash: |
sudo apt-get update &&
sudo apt-get -y install mysql-server libmysqlclient-dev &&
mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot -proot
displayName: Install mysql
- template: _build/azure-pipelines-template.yml
parameters:
name: Windows_sqlite
displayName: Windows SQLite
vmImage: vs2017-win2016
variables:
BACKEND: sqlite
SQLITE_DATABASE_URL: C:\test.db
SQLITE3_LIB_DIR: C:\sqlite
setup:
- script: |
choco install 7zip
mkdir C:\sqlite
CD /D C:\sqlite
curl -fsS --retry 3 --retry-connrefused -o sqlite3.zip https://sqlite.org/2017/sqlite-dll-win64-x64-3160200.zip
7z e sqlite3.zip -y
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
lib /machine:x64 /def:sqlite3.def /out:sqlite3.lib
set PATH=%PATH%;C:\sqlite
echo "##vso[task.setvariable variable=PATH;]%PATH%;C:\sqlite"
displayName: Install sqlite
- template: _build/azure-pipelines-template.yml
parameters:
name: Windows_postgres
displayName: Windows PostgreSQL
vmImage: vs2017-win2016
variables:
BACKEND: postgres
PG_DATABASE_URL: postgres://postgres:password@localhost/
PG_EXAMPLE_DATABASE_URL: postgres://postgres:password@localhost/diesel_example
PQ_LIB_DIR: C:\Program Files\PostgreSQL\10\lib
setup:
- script: |
choco install postgresql10 --force --params '/Password:password'
set PATH=%PATH%;C:\Program Files\PostgreSQL\10\bin;C:\Program Files\PostgreSQL\10\lib"
echo "##vso[task.setvariable variable=PATH;]%PATH%;C:\Program Files\PostgreSQL\10\bin;C:\Program Files\PostgreSQL\10\lib"
displayName: Install postgresql
- template: _build/azure-pipelines-template.yml
parameters:
name: Windows_mysql
displayName: Windows MySQL
vmImage: vs2017-win2016
variables:
BACKEND: mysql
MYSQL_DATABASE_URL: mysql://root:password@localhost/diesel_test
MYSQL_EXAMPLE_DATABASE_URL: mysql://root:password@localhost/diesel_example
MYSQL_UNIT_TEST_DATABASE_URL: mysql://root:password@localhost/diesel_unit_test
RUST_TEST_THREADS: 1
MYSQLCLIENT_LIB_DIR: C:\Program Files\MySQL\MySQL Server 8.0\lib
setup:
- script: |
choco install 7zip
mkdir C:\mysql
CD /D C:\mysql
curl -fsS --retry 3 --retry-connrefused -o mysql.msi https://cdn.mysql.com/archives/mysql-installer/mysql-installer-community-8.0.11.0.msi
msiexec /q /log install.txt /i mysql.msi datadir=C:\mysql installdir=C:\mysql
call "C:\Program Files (x86)\MySQL\MySQL Installer for Windows\MySQLInstallerConsole.exe" community install server;8.0.11;x64:*:port=3306;rootpasswd=password;servicename=MySQL -silent
netsh advfirewall firewall add rule name="Allow mysql" dir=in action=allow edge=yes remoteip=any protocol=TCP localport=80,8080,3306
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql" -e "create database diesel_test; create database diesel_unit_test; grant all on diesel_test.* to 'root'@localhost; grant all on diesel_unit_test.* to 'root'@localhost;" -uroot -ppassword
displayName: Install mysql
- job: COMPILE_TESTS
displayName: Compiletests
pool:
vmImage: ubuntu-16.04
steps:
- template: _build/install-rust.yml
parameters:
platform: Linux
rust_version: nightly-2019-08-01
- bash: |
sudo apt-get update &&
sudo apt-get -y install libsqlite3-dev libpq-dev libmysqlclient-dev
displayName: Install build dependencies
- bash: |
(cd diesel_compile_tests && cargo test)
env:
RUSTFLAGS: '--cap-lints=warn'
displayName: Run compile tests
- job: RUSTFMT_AND_CLIPPY
displayName: Check rustfmt style && run clippy
pool:
vmImage: ubuntu-16.04
steps:
- template: _build/install-rust.yml
parameters:
platform: Linux
rust_version: 1.36.0
- bash: |
sudo apt-get update &&
sudo apt-get -y install libsqlite3-dev libpq-dev libmysqlclient-dev
displayName: Install build dependencies
- bash: |
rustup component add rustfmt
displayName: Install rustfmt
- bash: |
rustup component add clippy
displayName: Install clippy
- bash: |
cargo clippy
displayName: Run clippy
- bash: |
cargo fmt --all -- --check
displayName: Check style
- job: SQLITE_BUNDLED
displayName: Check sqlite bundled
pool:
vmImage: ubuntu-16.04
steps:
- template: _build/install-rust.yml
parameters:
platform: Linux
rust_version: stable
- bash: |
sudo apt-get update &&
sudo apt-get -y install sqlite3 libsqlite3-dev
- bash: |
(cd diesel_cli && cargo test --no-default-features --features "sqlite-bundled")
env:
SQLITE_DATABASE_URL: /tmp/test.db
displayName: Check sqlite bundled
- job: MINIMAL_RUST_VERSION
displayName: Check minimal supported rust version
pool:
vmImage: ubuntu-16.04
steps:
- template: _build/install-rust.yml
parameters:
platform: Linux
rust_version: 1.36.0
- bash: |
sudo apt-get update &&
sudo apt-get -y install libsqlite3-dev libpq-dev libmysqlclient-dev
displayName: Install build dependencies
- bash: |
cargo check --all
displayName: Check building with rust 1.36.0