mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-08-20 04:30:01 +00:00
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: run-unit-tests
|
|
|
|
on:
|
|
pull_request:
|
|
types: [review_requested, ready_for_review, synchronize, opened, reopened]
|
|
branches:
|
|
- main
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
pick-runner:
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
runner: ${{ steps.choose.outputs.use-runner }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- id: choose
|
|
uses: ./.github/actions/runner-fallback
|
|
with:
|
|
primary-runner: "self-hosted,ubuntu-latest"
|
|
fallback-runner: "ubuntu-latest"
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run-unit-tests:
|
|
needs: pick-runner
|
|
if: github.event.pull_request.draft == false
|
|
name: run-unit-tests
|
|
runs-on: ${{ fromJson(needs.pick-runner.outputs.runner) }}
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Rust
|
|
run: rustup update stable
|
|
- name: Install cargo-llvm-cov
|
|
uses: taiki-e/install-action@cargo-llvm-cov
|
|
|
|
- name: Run doctests
|
|
run: cargo test --lib --doc --all-features --workspace --release
|
|
|
|
- name: Run unit tests with code coverage
|
|
run: cargo llvm-cov --all-features --release --workspace --lcov --output-path lcov.info
|
|
|
|
- name: Test docs generation
|
|
run: cargo doc --no-deps --release
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: lcov.info
|
|
fail_ci_if_error: true
|
|
- name: Upload test results to Codecov
|
|
if: ${{ !cancelled() }}
|
|
uses: codecov/test-results-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|