xref: /tonic/.github/workflows/CI.yml (revision 63f2e95b)
1name: CI
2
3on:
4  push:
5    branches:
6    - master
7  pull_request: {}
8
9jobs:
10  check:
11    runs-on: ${{ matrix.os }}
12    strategy:
13      matrix:
14        os: [ubuntu-latest, macOS-latest, windows-latest]
15        rust: [stable]
16
17    env:
18      RUSTFLAGS: "-D warnings"
19
20    steps:
21    - uses: hecrj/setup-rust-action@v1
22      with:
23        rust-version: ${{ matrix.rust }}
24        components: rustfmt
25    - uses: actions/checkout@v3
26    - name: Install cargo-hack
27      uses: baptiste0928/cargo-install@v1
28      with:
29        crate: cargo-hack
30    - name: Install Protoc
31      uses: arduino/setup-protoc@v1
32      with:
33        repo-token: ${{ secrets.GITHUB_TOKEN }}
34    - uses: Swatinem/rust-cache@v2
35    - name: Check fmt
36      run: cargo fmt -- --check
37    - name: Check features
38      run: cargo hack check --all --ignore-private --each-feature --no-dev-deps
39    - name: Check all targets
40      run: cargo check --all --all-targets --all-features
41
42  check-docs:
43    name: check docs
44    runs-on: ubuntu-latest
45
46    env:
47      RUSTFLAGS: "-D warnings"
48
49    steps:
50    - uses: actions/checkout@v3
51    - name: Install Protoc
52      uses: arduino/setup-protoc@v1
53      with:
54        repo-token: ${{ secrets.GITHUB_TOKEN }}
55    - uses: hecrj/setup-rust-action@v1
56      with:
57        rust-version: "1.60"
58    - uses: Swatinem/rust-cache@v2
59    - name: cargo doc
60      run: cargo doc --workspace --no-deps --exclude examples
61
62  clippy:
63    name: cargo clippy
64    runs-on: ubuntu-latest
65
66    env:
67      RUSTFLAGS: "-A unknown_lints -D warnings"
68
69    steps:
70    - uses: actions/checkout@v3
71    - uses: hecrj/setup-rust-action@v1
72      with:
73        rust-version: "1.60"
74        components: clippy
75    - name: Install Protoc
76      uses: arduino/setup-protoc@v1
77      with:
78        repo-token: ${{ secrets.GITHUB_TOKEN }}
79    - uses: Swatinem/rust-cache@v2
80    - name: Run cargo clippy
81      run: cargo clippy --workspace --all-targets --all-features
82
83  deny-check:
84    name: cargo-deny check
85    runs-on: ubuntu-latest
86    steps:
87    - uses: actions/checkout@v3
88    - uses: EmbarkStudios/cargo-deny-action@v1
89
90  msrv:
91    name: Check MSRV
92    runs-on: ubuntu-latest
93    steps:
94    - name: Checkout
95      uses: actions/checkout@v3
96    - uses: hecrj/setup-rust-action@v1
97      with:
98        rust-version: "1.60"
99    - name: Install Protoc
100      uses: arduino/setup-protoc@v1
101      with:
102        repo-token: ${{ secrets.GITHUB_TOKEN }}
103    - name: Check
104      run: cargo check --all --all-targets --all-features
105
106  test:
107    runs-on: ${{ matrix.os }}
108    strategy:
109      matrix:
110        os: [ubuntu-latest, macOS-latest, windows-latest]
111        rust: [stable]
112
113    env:
114      RUSTFLAGS: "-D warnings"
115      # run a lot of quickcheck iterations
116      QUICKCHECK_TESTS: 1000
117
118    steps:
119    - uses: hecrj/setup-rust-action@v1
120      with:
121        rust-version: ${{ matrix.rust }}
122        components: rustfmt
123    - name: Install Protoc
124      uses: arduino/setup-protoc@v1
125      with:
126        repo-token: ${{ secrets.GITHUB_TOKEN }}
127    - uses: Swatinem/rust-cache@v2
128    - uses: actions/checkout@v3
129    - name: Run tests
130      run: cargo test --all --all-features
131
132  interop:
133    name: Interop Tests
134    runs-on: ${{ matrix.os }}
135    strategy:
136      matrix:
137        os: [ubuntu-latest, macOS-latest, windows-latest]
138        rust: [stable]
139
140    env:
141      RUSTFLAGS: "-D warnings"
142
143    steps:
144    - uses: hecrj/setup-rust-action@v1
145      with:
146        rust-version: ${{ matrix.rust }}
147        components: rustfmt
148    - uses: actions/checkout@v3
149    - name: Install Protoc
150      uses: arduino/setup-protoc@v1
151      with:
152        repo-token: ${{ secrets.GITHUB_TOKEN }}
153    - uses: Swatinem/rust-cache@v2
154    - name: Run interop tests
155      run: ./interop/test.sh
156      shell: bash
157    - name: Run interop tests with Rustls
158      run: ./interop/test.sh --use_tls tls_rustls
159      shell: bash
160