-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
546b646
commit 545c7f1
Showing
5 changed files
with
89 additions
and
173 deletions.
There are no files selected for viewing
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
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,112 +1,82 @@ | ||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
push: | ||
branches: [main] | ||
paths: | ||
- '.github/workflows/code_test_coverage.yml' # Run when this workflow changes | ||
- '**/src/**' | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: # Run when manually triggered | ||
workflow_call: # Run when called by another workflow | ||
|
||
name: π Code Test Coverage | ||
name: π Code Test Coverage Workflow | ||
|
||
jobs: | ||
grcov: | ||
name: π grcov Code Coverage | ||
if: | | ||
!startsWith(github.event.head_commit.message, 'ci:') | ||
&& !startsWith(github.event.head_commit.message, 'ci(') | ||
&& !startsWith(github.event.head_commit.message, 'docs:') | ||
&& !startsWith(github.event.head_commit.message, 'docs(') | ||
&& !startsWith(github.event.head_commit.message, 'style:') | ||
&& !startsWith(github.event.head_commit.message, 'style(') | ||
coverage_job: | ||
name: π Code Test Coverage Job | ||
strategy: | ||
fail-fast: false | ||
fail-fast: true | ||
matrix: | ||
target: | ||
- x86_64-unknown-linux-gnu | ||
- x86_64-pc-windows-msvc | ||
- x86_64-apple-darwin | ||
# - aarch64-unknown-linux-gnu | ||
# - aarch64-apple-darwin | ||
platform: | ||
- linux | ||
# - windows | ||
# - apple | ||
cpu_architecture: [x86_64] | ||
include: | ||
- target: x86_64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
- target: x86_64-pc-windows-msvc | ||
os: windows-latest | ||
- target: x86_64-apple-darwin | ||
os: macos-latest | ||
# - target: aarch64-unknown-linux-gnu | ||
# os: ubuntu-latest | ||
# - target: aarch64-apple-darwin | ||
# os: macos-latest | ||
runs-on: ${{ matrix.os }} | ||
- platform: linux | ||
cicd_runner: ubuntu-latest | ||
# - platform: windows | ||
# cicd_runner: windows-latest | ||
# - platform: apple | ||
# cicd_runner: macos-latest | ||
- compilation_target: x86_64-unknown-linux-gnu | ||
cpu_architecture: x86_64 | ||
platform: linux | ||
toolchain: gnu | ||
# - compilation_target: x86_64-pc-windows-msvc | ||
# cpu_architecture: x86_64 | ||
# platform: windows | ||
# toolchain: msvc | ||
# - compilation_target: x86_64-apple-darwin | ||
# cpu_architecture: x86_64 | ||
# platform: apple | ||
# toolchain: darwin | ||
runs-on: ${{ matrix.cicd_runner }} | ||
if: | | ||
( | ||
github.event_name == 'push' | ||
&& github.ref == 'refs/heads/main' | ||
) || ( | ||
!startsWith(github.event.head_commit.message, 'style:') | ||
&& !startsWith(github.event.head_commit.message, 'style(') | ||
&& !startsWith(github.event.head_commit.message, 'chore:') | ||
&& !startsWith(github.event.head_commit.message, 'chore(') | ||
) | ||
steps: | ||
- name: π Checkout Git Repository | ||
id: checkout_repository_step | ||
uses: actions/checkout@v2 | ||
- name: π§° Install Rust Toolchain | ||
id: install_toolchain_step | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly # Required for -Zprofile | ||
override: true | ||
target: ${{ matrix.target }} | ||
- name: π Set up cargo cache | ||
id: setup_cache_step | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo- | ||
- name: π§ͺ Execute tests | ||
id: execute_tests_step | ||
uses: actions-rs/cargo@v1 | ||
env: | ||
CARGO_INCREMENTAL: 0 | ||
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests" | ||
- name: π Checkout Git Repository Step | ||
id: repository_checkout_step | ||
uses: actions/checkout@v4 | ||
- name: π§° Install Rust Toolchain Step | ||
id: toolchain_install_step | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
command: test | ||
args: --workspace --target ${{ matrix.target }} | ||
- name: π½ Pre-Installing grcov | ||
id: preinstall_grcov_step | ||
uses: actions-rs/[email protected] | ||
toolchain: nightly | ||
targets: ${{ matrix.compilation_target }} | ||
components: rustc, cargo | ||
- name: π Install Cross-Compilation Tools Step | ||
id: cross_install_step | ||
if: ${{ matrix.cpu_architecture != 'x86_64' }} | ||
uses: taiki-e/setup-cross-toolchain-action@v1 | ||
with: | ||
crate: grcov | ||
use-tool-cache: true | ||
- name: π Gather Coverage Data | ||
id: coverage_gather_step | ||
uses: actions-rs/[email protected] | ||
with: | ||
config: .github/actions-rs/grcov.yml | ||
coveralls-token: ${{ secrets.COVERALLS_TOKEN }} | ||
- name: β¬ Coveralls Upload | ||
id: coveralls_upload_step | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel: true | ||
path-to-lcov: ${{ steps.coverage_gather_step.outputs.report }} | ||
|
||
grcov_finalize: | ||
name: β Finalize grcov Code Coverage | ||
if: | | ||
!startsWith(github.event.head_commit.message, 'ci:') | ||
&& !startsWith(github.event.head_commit.message, 'ci(') | ||
&& !startsWith(github.event.head_commit.message, 'docs:') | ||
&& !startsWith(github.event.head_commit.message, 'docs(') | ||
&& !startsWith(github.event.head_commit.message, 'style:') | ||
&& !startsWith(github.event.head_commit.message, 'style(') | ||
runs-on: ubuntu-latest | ||
needs: grcov | ||
steps: | ||
- name: β Coveralls Finalization | ||
id: coveralls_finalization_step | ||
uses: coverallsapp/github-action@master | ||
targets: ${{ matrix.compilation_target }} | ||
- name: π Setup Cache Step | ||
id: cache_setup_step | ||
uses: Swatinem/rust-cache@v2 | ||
- name: π Generate Code Coverage Step | ||
id: coverage_generation_step | ||
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info | ||
- name: π Upload coverage to Codecov Step | ||
id: coverage_upload_step | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel-finished: true | ||
files: lcov.info | ||
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
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