Skip to content

Commit

Permalink
Fix coverage CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pvshvp-oss committed Mar 11, 2024
1 parent 546b646 commit 545c7f1
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 173 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/actions-rs/grcov.yml

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/api_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,36 +38,36 @@ jobs:
- name: 🎟 Checkout Git Repository Step
id: repository_checkout_step
uses: actions/checkout@v4
- name: ↕️ Install Ubuntu Dependencies
- name: ↕️ Install Ubuntu Dependencies Step
id: dependencies_install_step
if: ${{ matrix.cicd_runner == 'ubuntu-latest' }}
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-4-dev
version: 1.0
- name: 🧰 Install Rust Toolchain
- name: 🧰 Install Rust Toolchain Step
id: toolchain_install_step
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
targets: ${{ matrix.compilation_target }}
components: rustc, cargo
- name: πŸ”„ Install Cross-Compilation Tools
- 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:
targets: ${{ matrix.compilation_target }}
- name: πŸ—‚ Setup Cache
- name: πŸ—‚ Setup Cache Step
id: cache_setup_step
uses: Swatinem/rust-cache@v2
- name: πŸ“œ Cargo Doc
- name: πŸ“œ Cargo Doc Step
id: cargo_doc_step
env:
RUSTDOCFLAGS: "--enable-index-page -Zunstable-options"
run: |
cargo doc --all-features --workspace --no-deps --document-private-items
- name: ⬆ Upload Docs Artifact
- name: ⬆ Upload Docs Artifact Step
id: documentation_upload_step
uses: actions/upload-pages-artifact@v3
with:
Expand All @@ -86,7 +86,7 @@ jobs:
name: github-pages
url: ${{ steps.deployment_step.outputs.page_url }}
steps:
- name: ✈ Deploy to GitHub Pages
- name: ✈ Deploy to GitHub Pages Step
id: deployment_step
uses: actions/deploy-pages@v4

166 changes: 68 additions & 98 deletions .github/workflows/code_test_coverage.yml
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/install@v0.1
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/grcov@v0.1
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
48 changes: 7 additions & 41 deletions .github/workflows/security_audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,8 @@ jobs:
strategy:
fail-fast: false
matrix:
platform:
- linux
- windows
- apple
cpu_architecture:
# - i686
- x86_64
# - aarch64
# - riscv64gc
platform: [linux, windows, apple]
cpu_architecture: [x86_64]
include:
- platform: linux
cicd_runner: ubuntu-latest
Expand All @@ -39,42 +32,14 @@ jobs:
cpu_architecture: x86_64
platform: linux
toolchain: gnu
# - compilation_target: x86_64-unknown-linux-musl
# cpu_architecture: x86_64
# platform: linux
# toolchain: musl
- compilation_target: x86_64-pc-windows-msvc
cpu_architecture: x86_64
platform: windows
toolchain: msvc
# - compilation_target: x86_64-pc-windows-gnu
# cpu_architecture: x86_64
# platform: windows
# toolchain: gnu
- compilation_target: x86_64-apple-darwin
cpu_architecture: x86_64
platform: apple
toolchain: darwin
# - compilation_target: aarch64-unknown-linux-gnu
# cpu_architecture: aarch64
# platform: linux
# toolchain: gnu
# - compilation_target: aarch64-unknown-linux-musl
# cpu_architecture: aarch64
# platform: linux
# toolchain: musl
# - compilation_target: aarch64-pc-windows-msvc
# cpu_architecture: aarch64
# platform: windows
# toolchain: msvc
# - compilation_target: aarch64-apple-darwin
# cpu_architecture: aarch64
# platform: apple
# toolchain: darwin
# - compilation_target: riscv64gc-unknown-linux-gnu
# cpu_architecture: riscv64gc
# platform: linux
# toolchain: gnu
permissions:
contents: read
issues: write
Expand All @@ -89,14 +54,15 @@ jobs:
with:
python-version: '3.11'
cache: 'pip'
- name: ↕️ Install dependencies
- name: ↕️ Install Dependencies Step
id: dependencies_install_step
run: |
python -m pip install --upgrade pip
pip install requests
- name: πŸ—‚ Setup Cache Step
id: cache_setup_step
uses: Swatinem/rust-cache@v2
- name: πŸ•΅οΈβ€β™‚οΈ Security Audit Step
id: audit_step
uses: actions-rust-lang/audit@v1
- name: πŸ—‚ Setup Cache
id: cache_setup_step
uses: Swatinem/rust-cache@v2

21 changes: 7 additions & 14 deletions .github/workflows/templates/multi_target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,36 +91,29 @@ jobs:
- name: 🎟 Checkout Git Repository Step
id: repository_checkout_step
uses: actions/checkout@v4
- name: ↕️ Install Ubuntu Dependencies
id: dependencies_install_step
if: ${{ matrix.cicd_runner == 'ubuntu-latest' }}
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-4-dev
version: 1.0
- name: 🧰 Install Rust Toolchain
- name: 🧰 Install Rust Toolchain Step
id: toolchain_install_step
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
targets: ${{ matrix.compilation_target }}
components: rustc, cargo
- name: πŸ”„ Install Cross-Compilation Tools
- 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:
targets: ${{ matrix.compilation_target }}
- name: πŸ—‚ Setup Cache
- name: πŸ—‚ Setup Cache Step
id: cache_setup_step
uses: Swatinem/rust-cache@v2
- name: πŸ“œ Cargo Doc
- name: πŸ“œ Cargo Doc Step
id: cargo_doc_step
env:
RUSTDOCFLAGS: "--enable-index-page -Zunstable-options"
run: |
cargo doc --all-features --workspace --no-deps --document-private-items
- name: ⬆ Upload Docs Artifact
- name: ⬆ Upload Docs Artifact Step
id: documentation_upload_step
uses: actions/upload-pages-artifact@v3
with:
Expand All @@ -139,6 +132,6 @@ jobs:
name: github-pages
url: ${{ steps.deployment_step.outputs.page_url }}
steps:
- name: ✈ Deploy to GitHub Pages
- name: ✈ Deploy to GitHub Pages Step
id: deployment_step
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4

0 comments on commit 545c7f1

Please sign in to comment.