Skip to content

add token to codecov #12

add token to codecov

add token to codecov #12

Workflow file for this run

name: coverage
# This CI is run manually on-demand and performs a simple calculation of
# unit tests coverage and reports it to CodeCov
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- 'polkadot-v1.10.0-coverage'
# env:
# RUSTC_WRAPPER: sccache
# SCCACHE_GHA_ENABLED: 'true'
jobs:
coverage:
runs-on: ubuntu-latest
name: Code Coverage
steps:
# The build artifacts generated by Polkadot projects are already large
# and even larger when using llvm-cov. This GH task helps removing some large
# files on the host and maximizing disk space(https://github.com/easimon/maximize-build-space)
# - name: Maximize build space
# uses: easimon/maximize-build-space@master
# with:
# remove-dotnet: 'true'
# remove-android: 'true'
# remove-haskell: 'true'
- name: Free disk space
run: |
echo "Freeing up disk space..."
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo apt-get clean
docker rmi $(docker image ls -aq)
df -h
- uses: actions/checkout@v4
with:
submodules: true
- name: Cache cargo registry & git sources
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-unittest-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-unittest-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-unittest-
${{ runner.os }}-cargo-
- name: Run sccache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install protoc
uses: arduino/setup-protoc@v3
- name: Generate lockfile if it doesn't exist
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: Generate coverage report
# Follow the `test-release`command in the Makefile
# but without release mode to avoid long build times
run: cargo llvm-cov --lib --all --locked --lcov --output-path lcov.info
- name: Record Rust version
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
env_vars: OS,RUST
token: ${{ secrets.CODECOV_TOKEN }}