-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
ci: add code coverage
1 parent
bd26cf0
commit 1ab016e
Showing
5 changed files
with
122 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Initialize | ||
description: This action initializes a runner for use in other actions. | ||
inputs: | ||
cache-key: | ||
description: "The key to be used for the cache" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Ubuntu dependencies | ||
shell: bash | ||
run: sudo apt update && sudo apt install -y protobuf-compiler | ||
|
||
- name: Free up space on runner | ||
shell: bash | ||
run: | | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf "/usr/local/share/boost" | ||
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
- name: Rust Cache | ||
uses: Swatinem/[email protected] | ||
with: | ||
cache-on-failure: true | ||
cache-all-crates: true | ||
key: ${{ inputs.cache-key }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
types: [ opened, synchronize, reopened, ready_for_review ] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Check formatting | ||
run: cargo +stable fmt --all -- --check | ||
|
||
check: | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: "./.github/actions/init" | ||
|
||
- name: Check Build | ||
run: | | ||
cargo check --release --locked --features=runtime-benchmarks | ||
clippy: | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
permissions: | ||
checks: write | ||
env: | ||
SKIP_WASM_BUILD: 1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: "./.github/actions/init" | ||
|
||
- name: Annotate with Clippy warnings | ||
uses: actions-rs/clippy-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --release --locked --features=runtime-benchmarks | ||
|
||
test: | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: "./.github/actions/init" | ||
|
||
- name: Run tests | ||
run: cargo test --release --locked --verbose --all | ||
|
||
- name: Check try-runtime build | ||
run: cargo check --release --features=try-runtime | ||
|
||
coverage: | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: "./.github/actions/init" | ||
|
||
- name: Install cargo-llvm-cov | ||
uses: taiki-e/install-action@cargo-llvm-cov | ||
|
||
- name: Generate code coverage | ||
run: cargo llvm-cov --all-features --workspace --lib --bins --codecov --output-path codecov.json | ||
|
||
- name: Upload to codecov.io | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: codecov.json | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# https://docs.codecov.com/docs/common-recipe-list | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: auto | ||
threshold: 0% | ||
comment: | ||
layout: " diff, flags, files" | ||
behavior: default | ||
require_changes: false | ||
require_base: false | ||
require_head: true | ||
hide_project_coverage: false |