xref: /tonic/.github/workflows/CI.yml (revision 4e5c0b29)
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@master
22      with:
23        rust-version: ${{ matrix.rust }}
24    - uses: actions/checkout@master
25    - name: Install rustfmt
26      run: rustup component add rustfmt
27    - name: Install cargo-hack
28      run: cargo install cargo-hack
29    - name: Install Protoc
30      uses: arduino/setup-protoc@v1
31      with:
32        repo-token: ${{ secrets.GITHUB_TOKEN }}
33    - uses: Swatinem/rust-cache@v1
34    - name: Check fmt
35      run: cargo fmt -- --check
36    - name: Check features
37      run: cargo hack check --all --ignore-private --each-feature --no-dev-deps
38    - name: Check all targets
39      run: cargo check --all --all-targets --all-features
40
41  clippy:
42    name: cargo clippy
43    runs-on: ubuntu-latest
44    steps:
45    - uses: actions/checkout@v3
46    - name: Install Rust and clippy
47      uses: actions-rs/toolchain@v1
48      with:
49        profile: minimal
50        toolchain: "1.60"
51        override: true
52        components: clippy
53    - name: Install Protoc
54      uses: arduino/setup-protoc@v1
55      with:
56        repo-token: ${{ secrets.GITHUB_TOKEN }}
57    - uses: Swatinem/rust-cache@v2
58    - name: Run cargo clippy
59      run: cargo clippy --workspace --all-targets --all-features -- --allow unknown_lints --deny warnings
60
61  deny-check:
62    name: cargo-deny check
63    runs-on: ubuntu-latest
64    steps:
65    - uses: actions/checkout@v3
66    - uses: EmbarkStudios/cargo-deny-action@v1
67
68  msrv:
69    name: Check MSRV
70    runs-on: ubuntu-latest
71    steps:
72      - name: Checkout
73        uses: actions/checkout@v1
74      - name: Install Rust
75        uses: actions-rs/toolchain@v1
76        with:
77          profile: minimal
78          toolchain: "1.60"
79          override: true
80      - name: Install Protoc
81        uses: arduino/setup-protoc@v1
82        with:
83          repo-token: ${{ secrets.GITHUB_TOKEN }}
84      - name: Check
85        run: cargo check --all --all-targets --all-features
86
87  test:
88    runs-on: ${{ matrix.os }}
89    strategy:
90      matrix:
91        os: [ubuntu-latest, macOS-latest, windows-latest]
92        rust: [stable]
93
94    env:
95      RUSTFLAGS: "-D warnings"
96      # run a lot of quickcheck iterations
97      QUICKCHECK_TESTS: 1000
98
99    steps:
100    - uses: hecrj/setup-rust-action@master
101      with:
102        rust-version: ${{ matrix.rust }}
103    - name: Install rustfmt
104      run: rustup component add rustfmt
105    - name: Install Protoc
106      uses: arduino/setup-protoc@v1
107      with:
108        repo-token: ${{ secrets.GITHUB_TOKEN }}
109    - uses: Swatinem/rust-cache@v1
110    - uses: actions/checkout@master
111    - name: Run tests
112      run: cargo test --all --all-features
113
114  interop:
115    name: Interop Tests
116    runs-on: ${{ matrix.os }}
117    strategy:
118      matrix:
119        os: [ubuntu-latest, macOS-latest, windows-latest]
120        rust: [stable]
121
122    env:
123      RUSTFLAGS: "-D warnings"
124
125    steps:
126    - uses: hecrj/setup-rust-action@master
127      with:
128        rust-version: ${{ matrix.rust }}
129    - name: Install rustfmt
130      run: rustup component add rustfmt
131    - uses: actions/checkout@master
132    - name: Install Protoc
133      uses: arduino/setup-protoc@v1
134      with:
135        repo-token: ${{ secrets.GITHUB_TOKEN }}
136    - uses: Swatinem/rust-cache@v1
137    - name: Run interop tests
138      run: ./interop/test.sh
139      shell: bash
140    - name: Run interop tests with Rustls
141      run: ./interop/test.sh --use_tls tls_rustls
142      shell: bash
143