xref: /tonic/.github/workflows/CI.yml (revision 3387ef90)
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]
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: Check fmt
30      run: cargo fmt -- --check
31    - name: Check features
32      run: cargo hack check --all --ignore-private --each-feature --no-dev-deps
33    - name: Check all targets
34      run: cargo check --all --all-targets --all-features
35
36  deny-check:
37    name: cargo-deny check
38    runs-on: ubuntu-latest
39    steps:
40    - uses: actions/checkout@v1
41    - name: download cargo-deny
42      shell: bash
43      env:
44        DVS: "0.4.0"
45        DREPO: EmbarkStudios/cargo-deny
46        TARGET: x86_64-unknown-linux-musl
47      run: |
48        temp_archive=$(mktemp --suffix=.tar.gz)
49        curl -L --output "$temp_archive" https://github.com/$DREPO/releases/download/$DVS/cargo-deny-$DVS-$TARGET.tar.gz
50
51        tar -xzvf "$temp_archive" -C . --strip-components=1 --wildcards "*/cargo-deny"
52    - name: cargo-deny check licenses
53      run: ./cargo-deny -L debug check license
54    - name: cargo-deny check bans
55      run: ./cargo-deny -L debug check ban
56
57  test:
58    runs-on: ${{ matrix.os }}
59    strategy:
60      matrix:
61        os: [ubuntu-latest]
62        rust: [stable]
63
64    env:
65      RUSTFLAGS: "-D warnings"
66
67    steps:
68    - uses: hecrj/setup-rust-action@master
69      with:
70        rust-version: ${{ matrix.rust }}
71    - name: Install rustfmt
72      run: rustup component add rustfmt
73    - uses: actions/checkout@master
74    - name: Run tests
75      run: cargo test --all --all-features
76
77  interop:
78    name: Interop Tests
79    runs-on: ${{ matrix.os }}
80    strategy:
81      matrix:
82        os: [ubuntu-latest, macOS-latest, windows-latest]
83        rust: [stable]
84
85    env:
86      RUSTFLAGS: "-D warnings"
87
88    steps:
89    - uses: hecrj/setup-rust-action@master
90      with:
91        rust-version: ${{ matrix.rust }}
92    - name: Install rustfmt
93      run: rustup component add rustfmt
94    - uses: actions/checkout@master
95    - name: Run interop tests
96      run: ./tonic-interop/test.sh
97      shell: bash
98    - name: Run interop tests with Rustls
99      run: ./tonic-interop/test.sh --use_tls tls_rustls
100      shell: bash
101