mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-04-21 23:47:56 +00:00
Enable Coverage Uploading (#392)
* enable coverage on generic * add evm, add flags * separate coverage into separate pipeline * debugging coverage * rename pipeline * fix template
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
name: "coverage generation"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- "evm-template/**"
|
||||
- "**.md"
|
||||
- "**.adoc"
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "evm-template/**"
|
||||
- "**.md"
|
||||
- "**.adoc"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
test-macos:
|
||||
description: "run tests on macOS"
|
||||
required: true
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
# If new code is pushed to a PR branch, then cancel in progress workflows for
|
||||
# that PR. Ensures that we don't waste CI time, and returns results quicker.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# Not needed in CI, should make things a bit faster
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_TERM_COLOR: always
|
||||
# Remove unnecessary WASM build artifacts
|
||||
WASM_BUILD_CLEAN_TARGET: 1
|
||||
# stripping symbols and optimizing for binary size
|
||||
RUSTFLAGS: -C strip=symbols -C opt-level=s
|
||||
# Enable sscache
|
||||
RUSTC_WRAPPER: "sccache"
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
SCCACHE_CACHE_SIZE: "50GB"
|
||||
|
||||
jobs:
|
||||
clippy-fmt-test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-22.04
|
||||
- macos-12
|
||||
run-all:
|
||||
- ${{ inputs.test-macos == true || github.ref == 'refs/heads/main' }}
|
||||
exclude: # exclude macos-12 when the condition is false
|
||||
- run-all: false
|
||||
os: macos-12
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./
|
||||
steps:
|
||||
- name: git checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run sccache
|
||||
uses: mozilla-actions/sccache-action@v0.0.4
|
||||
|
||||
- name: Install Protoc
|
||||
uses: arduino/setup-protoc@9b1ee5b22b0a3f1feb8c2ff99b32c89b3c3191e9 # v2.0.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: install rust toolchain
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
components: clippy, rustfmt
|
||||
|
||||
- name: "Install cargo-llvm-cov"
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-llvm-cov
|
||||
|
||||
- name: Generate generic runtime coverage
|
||||
run: |
|
||||
ls -l
|
||||
cd generic-template/runtime
|
||||
cargo llvm-cov --all-features --ignore-filename-regex ".*(weights|benchmark).*" --codecov --output-path lcov.info
|
||||
|
||||
- name: Generate EVM runtime coverage
|
||||
run: |
|
||||
cd evm-template/runtime
|
||||
cargo llvm-cov --all-features --ignore-filename-regex ".*(weights|benchmark).*" --codecov --output-path lcov.info
|
||||
|
||||
- name: Upload coverage reports to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./generic-template/runtime/lcov.info,./evm-template/runtime/lcov.info
|
||||
fail_ci_if_error: true
|
||||
@@ -111,10 +111,3 @@ jobs:
|
||||
run: cargo doc --release --locked --all --no-deps
|
||||
env:
|
||||
RUSTDOCFLAGS: "-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links"
|
||||
|
||||
# Will enable the below back again once we tackle #260
|
||||
# FIXME: Calculate coverage and define how to upload all template coverage reports
|
||||
# - name: Upload coverage reports to Codecov
|
||||
# uses: codecov/codecov-action@v3
|
||||
# env:
|
||||
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
@@ -111,10 +111,3 @@ jobs:
|
||||
run: cargo doc --release --locked --all --no-deps
|
||||
env:
|
||||
RUSTDOCFLAGS: "-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links"
|
||||
|
||||
# Will enable the below back again once we tackle #260
|
||||
# FIXME: Calculate coverage and define how to upload all template coverage reports
|
||||
# - name: Upload coverage reports to Codecov
|
||||
# uses: codecov/codecov-action@v3
|
||||
# env:
|
||||
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user