oxc/.github/workflows/codecov.yml

70 lines
1.7 KiB
YAML

# Run cargo-llvm-cov and upload to codecov.io
name: Code Coverage
on:
schedule:
- cron: '0 16 * * *' # 0:00 am Beijing Time
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true # Pull submodules for `cargo coverage`
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install cargo-nextest
uses: taiki-e/install-action@cargo-nextest
- name: Install llvm-tools-preview for llvm-cov
run: rustup component add llvm-tools-preview
- name: Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: check
save-if: false
- name: Run
run: cargo llvm-cov nextest --all-features --workspace --ignore-filename-regex tasks --release --lcov --output-path lcov.info
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: codecov
path: lcov.info
# codecov often fails, use another workflow for retry
upload-codecov:
name: Upload coverage file
runs-on: ubuntu-latest
needs: coverage
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download coverage file
uses: actions/download-artifact@v3
with:
name: codecov
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: lcov.info