Skip to content

Commit

Permalink
feat: use llvm-cov for coverage (#478)
Browse files Browse the repository at this point in the history
* feat: use llvm-cov for coverage

* fix: ci

* bump: rust cache action

* fix: use nextest

* misc: seperate doctest

* fix: ci

* fix: rustfmt

* fix: windows incremental build

* fix: disable debug info to save disk space

* Update ci.yml

* misc: use C drive for target dir

* misc: updated CHANGELOG

* fix: test
  • Loading branch information
baszalmstra authored Dec 7, 2022
1 parent b475164 commit e14879c
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 78 deletions.
7 changes: 0 additions & 7 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,3 @@
gen-syntax = "run --package tools --bin tools -- gen-syntax"
gen-runtime-capi = "run --package tools --bin tools -- gen-runtime-capi"
gen-abi = "run --package tools --bin tools -- gen-abi"

[profile.min-artifact-size-debug]
inherits = "dev"

# disable debug symbols for all packages except this one
[profile.min-artifact-size-debug.package."*"]
debug = false
118 changes: 67 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,17 @@ jobs:
include:
- RUSTFLAGS: "-Dwarnings"
CARGO_INCREMENTAL: 1
CARGO_TARGET_DIR: "target"
- os: "windows-latest"
RUSTFLAGS: "-Dwarnings -Ctarget-feature=+crt-static"
CARGO_INCREMENTAL: 0
CARGO_TARGET_DIR: "C:\\cargo-target-dir"
env:
RUSTFLAGS: ${{ matrix.RUSTFLAGS }}
CARGO_INCREMENTAL: ${{ matrix.CARGO_INCREMENTAL }}
# Disable generating debug info, we don't need it here anyway and its only using disk space
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_TARGET_DIR: ${{ matrix.CARGO_TARGET_DIR }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -79,34 +87,75 @@ jobs:
with:
profile: minimal
override: true
components: rustfmt
components: rustfmt, llvm-tools-preview

- uses: Swatinem/rust-cache@v2
if: matrix.os != 'windows-latest'

- name: Doctests
uses: actions-rs/cargo@v1
env:
RUSTFLAGS: ${{ matrix.RUSTFLAGS }}
CARGO_INCREMENTAL: ${{ matrix.CARGO_INCREMENTAL }}
with:
command: test
args: --doc --all-features --profile min-artifact-size-debug
- name: Install latest llvm-cov release
uses: taiki-e/install-action@cargo-llvm-cov

- name: Install latest nextest release
uses: taiki-e/install-action@nextest

- run: Get-PSDrive
if: matrix.os == 'windows-latest'

- name: Test with latest nextest release
uses: actions-rs/cargo@v1
env:
RUSTFLAGS: ${{ matrix.RUSTFLAGS }}
CARGO_INCREMENTAL: ${{ matrix.CARGO_INCREMENTAL }}
with:
command: nextest
args: run --all-features --profile ci --cargo-profile min-artifact-size-debug
command: llvm-cov
args: nextest --all-features --workspace --lcov --output-path lcov.info --profile ci

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
name: ${{ matrix.os }}
fail_ci_if_error: true

doctest:
name: Doctest Rust
needs: check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "windows-latest", "macOS-latest" ]
include:
- RUSTFLAGS: "-Dwarnings"
CARGO_INCREMENTAL: 1
- os: "windows-latest"
RUSTFLAGS: "-Dwarnings -Ctarget-feature=+crt-static"
CARGO_INCREMENTAL: 0
env:
RUSTFLAGS: ${{ matrix.RUSTFLAGS }}
CARGO_INCREMENTAL: ${{ matrix.CARGO_INCREMENTAL }}
# Disable generating debug info, we don't need it here anyway and its only using disk space
CARGO_PROFILE_DEV_DEBUG: 0
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Install LLVM
uses: ./.github/actions/install-llvm

- name: Install packages
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install libasound2-dev libudev-dev
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal

- uses: Swatinem/rust-cache@v2

- name: Doctests
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --all-features

test-mdbook:
name: Test mdbook
Expand Down Expand Up @@ -248,37 +297,4 @@ jobs:
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features

tarpaulin:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Install packages
run: |
sudo apt-get update
sudo apt-get install libasound2-dev libudev-dev
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
components: rustfmt

- uses: Swatinem/rust-cache@v2

- name: Install LLVM
uses: ./.github/actions/install-llvm

- name: Run cargo-tarpaulin
uses: actions-rs/[email protected]

- uses: codecov/codecov-action@v3
with:
file: ${{ steps.coverage.outputs.report }}
name: ${{ matrix.os }}
args: --all-features
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Switch to LLVM code coverage instead of using Tarpaulin [#478](https://github.com/mun-lang/mun/pull/478)
- Bump LLVM from 12 to 13 [#491](https://github.com/mun-lang/mun/pull/491)
- Reduce workspace target folder size from 10.9 GB to 10.6 GB
- Reduce workspace build dependencies from 296 to 270
Expand Down
Loading

0 comments on commit e14879c

Please sign in to comment.