1name: Rust 2 3on: 4 push: 5 branches: [main] 6 pull_request: 7 8env: 9 CARGO_TERM_COLOR: always 10 grcov-version: 0.8.0 11 12jobs: 13 build: 14 runs-on: ubuntu-latest 15 steps: 16 - uses: actions/checkout@v2 17 - name: Build 18 run: cargo build 19 - name: Run tests 20 run: cargo test 21 - name: Run clippy 22 uses: actions-rs/clippy-check@v1 23 with: 24 token: ${{ secrets.GITHUB_TOKEN }} 25 args: --all-features 26 27 format: 28 runs-on: ubuntu-latest 29 steps: 30 - uses: actions/checkout@v2 31 - name: Format Rust code 32 run: cargo fmt --all -- --check 33 34 coverage: 35 runs-on: ubuntu-latest 36 env: 37 RUSTC_BOOTSTRAP: 1 38 steps: 39 - uses: actions/checkout@v2 40 - name: Install dependencies 41 run: sudo apt-get install libdbus-1-dev 42 - name: Install grcov 43 run: curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-linux-x86_64.tar.bz2 | tar jxf - 44 - name: Install llvm-tools 45 run: rustup component add llvm-tools-preview 46 - name: Build for coverage 47 run: cargo build --all-features 48 env: 49 RUSTFLAGS: "-Zinstrument-coverage" 50 - name: Run tests with coverage 51 run: cargo test --all-features 52 env: 53 RUSTFLAGS: "-Zinstrument-coverage" 54 LLVM_PROFILE_FILE: "test-coverage-%p-%m.profraw" 55 - name: Convert coverage 56 run: ./grcov . -s . --binary-path target/debug/ -t lcov --branch --ignore-not-existing -o target/debug/lcov.info 57 - name: Upload coverage to codecov.io 58 uses: codecov/codecov-action@v1 59 with: 60 directory: ./target/debug 61 fail_ci_if_error: true 62