Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
52 lines
1.7 KiB
YAML
52 lines
1.7 KiB
YAML
name: Rust CI
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'veza-stream-server/**'
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- 'veza-stream-server/**'
|
|
|
|
jobs:
|
|
test-and-lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
|
|
with:
|
|
components: clippy
|
|
|
|
- name: Clippy lint
|
|
run: cargo clippy -- -D warnings
|
|
working-directory: veza-stream-server
|
|
|
|
- name: Run tests
|
|
run: cargo test --workspace --timeout 300
|
|
working-directory: veza-stream-server
|
|
|
|
- name: Install cargo-tarpaulin
|
|
run: cargo install cargo-tarpaulin
|
|
|
|
- name: Measure coverage
|
|
run: cargo tarpaulin --out json --output-dir target/coverage --timeout 300 --skip-clean
|
|
working-directory: veza-stream-server
|
|
|
|
- name: Enforce coverage threshold (>= 50%)
|
|
run: |
|
|
COVERAGE=$(cat target/coverage/tarpaulin-report.json | python3 -c "import sys,json; print(f'{json.load(sys.stdin).get(\"coverage\", 0):.1f}')")
|
|
echo "Rust coverage: ${COVERAGE}%"
|
|
COV_INT=$(echo "$COVERAGE" | cut -d. -f1)
|
|
if [ "$COV_INT" -lt 50 ]; then
|
|
echo "::error::Rust coverage ${COVERAGE}% is below the 50% threshold"
|
|
exit 1
|
|
fi
|
|
echo "::notice::Rust coverage ${COVERAGE}% meets the >= 50% threshold"
|
|
working-directory: veza-stream-server
|
|
|
|
- name: Upload coverage report
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
with:
|
|
name: rust-coverage
|
|
path: veza-stream-server/target/coverage/tarpaulin-report.json
|