fix(tests): finishing #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| # Run on all PRs and pushes | |
| fmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: rustup component add rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo fmt --check | |
| clippy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: rustup component add clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo clippy --all-targets -- -D warnings | |
| # Compile check (fast, cacheable) | |
| compile: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Check compilation | |
| run: cargo check --all-targets | |
| # Run tests separately | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: compile # Wait for compile to succeed first | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install cargo-tarpaulin | |
| run: cargo install cargo-tarpaulin | |
| - name: Run tests with coverage | |
| run: cargo tarpaulin --all-targets --out Xml --output-dir cobertura --timeout 900 --engine LLVM | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./cobertura/cobertura.xml | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| # Build and package only on release tags | |
| release-build: | |
| needs: [fmt, clippy, compile, test] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install cargo-deb | |
| run: cargo install cargo-deb | |
| - name: Build release binary | |
| run: cargo build --release | |
| - name: Build .deb package | |
| run: cargo deb --no-build | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: baco-deb-package | |
| path: target/debian/*.deb | |
| - name: Upload release assets | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| files: | | |
| target/debian/*.deb | |
| target/release/baco | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |