-
-
Notifications
You must be signed in to change notification settings - Fork 297
100 lines (93 loc) · 2.61 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
name: CI
on:
push:
branches:
- master
pull_request: {}
jobs:
check:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
package:
- name: poem-derive
path: poem-derive
- name: poem
path: poem
- name: poem-openapi-derive
path: poem-openapi-derive
- name: poem-openapi
path: poem-openapi
- name: poem-lambda
path: poem-lambda
- name: poem-grpc
path: poem-grpc
services:
redis:
image: redis:5.0.7
ports:
- 6379:6379
options: --entrypoint redis-server
mysql:
image: mysql:8.0
ports:
- 3306:3306
options: -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=test_poem_sessions
postgres:
image: postgres:14
ports:
- 5432:5432
options: -e POSTGRES_PASSWORD=123456 -e POSTGRES_DB=test_poem_sessions
steps:
- uses: actions/checkout@v3
# Use nightly Rust to check the format
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt, clippy
override: true
- name: Check Format
run: cargo fmt --all -- --check
# Switch to stable Rust
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Install Protoc
if: matrix.package.name == 'poem-grpc' || matrix.package.name == 'poem-openapi'
uses: arduino/setup-protoc@v1
# Do tests
- name: Check With Clippy
run: cargo clippy --all-features
working-directory: ${{ matrix.package.path }}
- name: Run Tests
run: cargo test --all-features
working-directory: ${{ matrix.package.path }}
check-examples:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install Protoc
uses: arduino/setup-protoc@v1
# Use nightly Rust to check the format
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt, clippy
- name: Check Format
run: cargo fmt --all -- --check
working-directory: examples
# Switch to stable Rust
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Check With Clippy
run: cargo clippy
working-directory: examples