-
Notifications
You must be signed in to change notification settings - Fork 5
96 lines (82 loc) · 2.28 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
name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: '*'
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.nightly }}
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/diesel_testing
RUST_TEST_THREADS: 1
SCHEMA_REGISTRY_PASSWORD: silly_password
strategy:
fail-fast: false
matrix:
toolchain: [ 'stable' ]
nightly: [false]
include:
- toolchain: 'nightly'
nightly: true
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: rust_${{ matrix.toolchain }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install diesel
uses: actions-rs/cargo@v1
with:
command: install
args: diesel_cli --no-default-features --features postgres
- name: Run migrations
run: |
diesel setup
diesel migration run
- name: Run cargo fmt
uses: actions-rs/cargo@v1
if: matrix.toolchain == 'nightly' # NOTE: We run in nightly because `cargo fmt` in stable doesn't support ignoring certain files, including @generated tagged ones.
with:
command: fmt
args: --all --check -- --config format_generated_files=false
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --all-targets --verbose
- name: Run doc tests
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --verbose
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features -- -Dunused_imports