|
| 1 | +# ******************************************************************************** |
| 2 | +# Copyright (c) 2024 Contributors to the Eclipse Foundation |
| 3 | +# |
| 4 | +# See the NOTICE file(s) distributed with this work for additional |
| 5 | +# information regarding copyright ownership. |
| 6 | +# |
| 7 | +# This program and the accompanying materials are made available under the |
| 8 | +# terms of the Apache License Version 2.0 which is available at |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# SPDX-License-Identifier: Apache-2.0 |
| 12 | +# *******************************************************************************/ |
| 13 | + |
| 14 | +name: Build checks and tests |
| 15 | + |
| 16 | +on: |
| 17 | + push: |
| 18 | + branches: [ main ] |
| 19 | + pull_request: |
| 20 | + paths: |
| 21 | + - "up-streamer/src/**" |
| 22 | + - "Cargo.*" |
| 23 | + workflow_call: |
| 24 | + workflow_dispatch: |
| 25 | + |
| 26 | +concurrency: |
| 27 | + group: ${{ github.ref }}-${{ github.workflow }} |
| 28 | + cancel-in-progress: true |
| 29 | + |
| 30 | +jobs: |
| 31 | + lint: |
| 32 | + name: Lint |
| 33 | + runs-on: ubuntu-latest |
| 34 | + |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + - name: cargo fmt |
| 38 | + working-directory: ${{github.workspace}} |
| 39 | + run: cargo fmt -- --check |
| 40 | + - name: cargo clippy |
| 41 | + working-directory: ${{github.workspace}} |
| 42 | + run: cargo clippy --all-targets -- -W warnings -D warnings |
| 43 | + |
| 44 | + test: |
| 45 | + name: Test |
| 46 | + runs-on: ubuntu-latest |
| 47 | + |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + - uses: dtolnay/rust-toolchain@stable |
| 51 | + - name: Install dependencies |
| 52 | + run: | |
| 53 | + cargo install cargo-all-features |
| 54 | + - name: Show toolchain information |
| 55 | + working-directory: ${{github.workspace}} |
| 56 | + run: | |
| 57 | + rustup toolchain list |
| 58 | + cargo --version |
| 59 | + - name: cargo-check all possible feature combinations |
| 60 | + run: | |
| 61 | + cargo check-all-features |
| 62 | + - name: cargo-test all possible feature combinations |
| 63 | + run: | |
| 64 | + cargo test-all-features |
| 65 | +
|
| 66 | + coverage: |
| 67 | + name: Collect coverage info |
| 68 | + runs-on: ubuntu-latest |
| 69 | + |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v4 |
| 72 | + - uses: dtolnay/rust-toolchain@stable |
| 73 | + - name: Install dependencies |
| 74 | + run: | |
| 75 | + cargo install cargo-tarpaulin |
| 76 | + - name: Show toolchain information |
| 77 | + working-directory: ${{github.workspace}} |
| 78 | + run: | |
| 79 | + rustup toolchain list |
| 80 | + cargo --version |
| 81 | + - name: Run tests to collect code coverage information |
| 82 | + run: | |
| 83 | + # enable nightly features so that we can also include Doctests |
| 84 | + RUSTC_BOOTSTRAP=1 cargo tarpaulin -o xml -o lcov -o html --doc --tests --all-features |
| 85 | + - name: Upload coverage report (xml) |
| 86 | + uses: actions/upload-artifact@v4 |
| 87 | + with: |
| 88 | + name: Test Coverage Results (xml) |
| 89 | + path: cobertura.xml |
| 90 | + - name: Upload coverage report (lcov) |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: Test Coverage Results (lcov) |
| 94 | + path: lcov.info |
| 95 | + - name: Upload coverage report (html) |
| 96 | + uses: actions/upload-artifact@v4 |
| 97 | + with: |
| 98 | + name: Test Coverage Results (html) |
| 99 | + path: tarpaulin-report.html |
| 100 | + |
| 101 | + build-docs: |
| 102 | + name: Build documentation |
| 103 | + runs-on: ubuntu-latest |
| 104 | + |
| 105 | + steps: |
| 106 | + - uses: actions/checkout@v4 |
| 107 | + - name: Create Documentation |
| 108 | + working-directory: ${{github.workspace}} |
| 109 | + run: RUSTDOCFLAGS=-Dwarnings cargo doc -p up-streamer --no-deps |
0 commit comments