-
Notifications
You must be signed in to change notification settings - Fork 30
91 lines (77 loc) · 2.3 KB
/
CI.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
on: [push, pull_request]
name: CI
jobs:
build:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.65
services:
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
mysql:
image: mysql
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: test
steps:
- name: Install dependencies
run: sudo apt install -y libpq-dev libsqlite3-dev libmysqlclient-dev
- name: Checkout
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Test Postgres
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path tests/Cargo.toml --features postgres
env:
PG_TEST_DATABASE_URL: "postgres://postgres:postgres@localhost:5432"
RUST_TEST_THREADS: 1
- name: Create MySQL database
run: mysql -h 127.0.0.1 --port 3306 -u root -pmysql -e 'CREATE DATABASE IF NOT EXISTS test;'
- name: Test MySQL
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path tests/Cargo.toml --features mysql
env:
MYSQL_TEST_DATABASE_URL: "mysql://root:[email protected]:3306/test"
RUST_TEST_THREADS: 1
- name: Test sqlite
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path tests/Cargo.toml --features sqlite
- name: Install Diesel-CLI
run: |
cargo install --features postgres --no-default-features diesel_cli
diesel --help
- name: Run Diesel-CLI tests
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432
run: |
cd tests_with_diesel_cli
# with default schema
diesel setup
diesel migration run
cargo test
diesel migration revert
rm src/schema.rs diesel.toml
# create a custom schema
diesel migration run --config-file custom.diesel.toml
cargo test --features custom
rm -rf src/custom_schema.rs