musichoard/.gitea/workflows/gitea-ci.yaml

62 lines
1.7 KiB
YAML
Raw Normal View History

name: Cargo CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
2024-01-06 18:26:59 +01:00
CARGO_TERM_COLOR: always
2024-01-06 18:32:58 +01:00
CARGO_TERM_VERBOSE: true
jobs:
build_and_test:
name: Build and Test
container: docker.io/drrobot/musichoard-ci:rust-1.75
2024-01-06 18:32:58 +01:00
env:
BEETSDIR: ./
LLVM_PROFILE_FILE: target/debug/profraw/musichoard-%p-%m.profraw
RUSTFLAGS: -C instrument-coverage
steps:
- uses: actions/checkout@v3
2024-01-06 18:32:58 +01:00
- run: cargo build --all-features --all-targets
- run: cargo test --all-features --all-targets --no-fail-fast
2024-01-06 19:25:19 +01:00
- uses: actions/upload-artifact@v3
with:
name: cargo-target
path: ./target
code_coverage:
name: Code Coverage
container: docker.io/drrobot/musichoard-ci:rust-1.75
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: cargo-target
path: ./target
2024-01-06 18:26:59 +01:00
- run: >-
2024-01-06 18:30:12 +01:00
grcov target/debug/profraw
2024-01-06 19:04:11 +01:00
--binary-path target/debug/
--output-types html
--source-dir .
--ignore-not-existing
--ignore "tests/*"
--ignore "src/main.rs"
--excl-start "GRCOV_EXCL_START|mod tests \{"
--excl-stop "GRCOV_EXCL_STOP"
--output-path ./target/debug/coverage/
2024-01-06 18:26:59 +01:00
- run: >-
python3 .gitea/scripts/coverage.py
2024-01-06 19:04:11 +01:00
--coverage-file ./target/debug/coverage/coverage.json
--fail-under 100.00
lint:
name: Lint
container: docker.io/drrobot/musichoard-ci:rust-1.75
steps:
- uses: actions/checkout@v3
2024-01-06 18:32:58 +01:00
- run: cargo clippy --all-features --all-targets -- -D warnings
- run: cargo fmt -- --check