-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): include coverage in test workflow (#1537)
Move coverage workflow under test workflow and change the trigger to allow users to trigger coverage run directly in GH Actions. Update sanity workflow step names to show what's run there.
- Loading branch information
1 parent
4adba54
commit 4de0a86
Showing
3 changed files
with
38 additions
and
43 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 |
---|---|---|
@@ -1,31 +1,22 @@ | ||
name: coverage | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- '**/*.rs' | ||
- '**/Cargo.toml' | ||
- '**/Cargo.lock' | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**/*.rs' | ||
- '**/Cargo.toml' | ||
- '**/Cargo.lock' | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
GITHUB_BOT_CONTEXT_STRING: "coveralls coverage reporting job" | ||
|
||
jobs: | ||
coverage: | ||
name: Code coverage | ||
runs-on: ubuntu-latest | ||
env: | ||
CARGO_TERM_COLOR: always | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache cargo & target directories | ||
uses: Swatinem/rust-cache@v2 | ||
|
@@ -34,7 +25,7 @@ jobs: | |
|
||
- name: Install gnome-keyring and keyutils on Linux | ||
run: | | ||
sudo apt-get update --yes && sudo apt-get install --yes gnome-keyring keyutils | ||
sudo apt-get update --yes && sudo apt-get install --yes gnome-keyring keyutils lcov | ||
rm -f $HOME/.local/share/keyrings/* | ||
echo -n "test" | gnome-keyring-daemon --unlock | ||
|
@@ -50,27 +41,13 @@ jobs: | |
- name: Generate code coverage | ||
run: source <(cargo llvm-cov show-env --export-prefix) && cargo llvm-cov report --lcov --output-path coverage.lcov --ignore-filename-regex '(bench\/|integration\/|tools\/|tpc\/)' | ||
|
||
- name: Display code coverage | ||
run: lcov --summary coverage.lcov | ||
|
||
- name: Upload code to Coveralls | ||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-coverage') }} | ||
# Do not upload coverage for user triggered workflows | ||
if: github.event_name == 'workflow_call' | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
fail-on-error: false | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
finalize_coverage: | ||
runs-on: ubuntu-latest | ||
needs: coverage | ||
if: always() | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Everything is fine | ||
if: ${{ !(contains(needs.*.result, 'failure')) }} | ||
run: exit 0 | ||
- name: Something went wrong | ||
if: ${{ contains(needs.*.result, 'failure') && github.event_name == 'push' }} | ||
uses: JasonEtco/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_BOT_CONTEXT_STRING: "coveralls coverage reporting job" | ||
with: | ||
filename: .github/BOT_ISSUE_TEMPLATE.md |
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
|
||
jobs: | ||
check: | ||
name: Check | ||
name: cargo check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -14,7 +14,7 @@ jobs: | |
with: | ||
command: check | ||
fmt: | ||
name: Rustfmt | ||
name: cargo fmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -25,7 +25,7 @@ jobs: | |
command: fmt | ||
args: --all -- --check | ||
clippy: | ||
name: Clippy | ||
name: cargo clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -36,7 +36,7 @@ jobs: | |
args: --all-targets --all-features -- -D warnings | ||
|
||
sort: | ||
name: Sort dependencies | ||
name: cargo sort | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -45,22 +45,22 @@ jobs: | |
- run: cargo sort --check --workspace | ||
|
||
doctest: | ||
name: Test documentation | ||
name: cargo test docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- run: cargo test --doc | ||
|
||
unused_dependencies: | ||
name: Unused dependencies | ||
name: cargo machete | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: bnjbvr/[email protected] | ||
|
||
check-commit-message: | ||
name: Validate commit messages | ||
name: commit messages | ||
runs-on: ubuntu-latest | ||
# This action isn't working with workflow_dispatch, skip it | ||
if: github.event_name != 'workflow_dispatch' | ||
|
@@ -74,6 +74,7 @@ jobs: | |
accessToken: ${{ secrets.GITHUB_TOKEN }} # needed only when checkAllCommitMessages is true | ||
pattern: '^.{0,80}(\n.*)*$' | ||
error: "Subject of all commits in the PR and PR body/title has to be shorter than 80 characters." | ||
|
||
# Uncomment this when we have a proper release - 1.0.0 | ||
# semver-checks: | ||
# name: SemVer SDK | ||
|
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