Skip to content

Commit

Permalink
Code coverage (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejressel authored Sep 29, 2024
1 parent 1b981a8 commit da2e3eb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[profile.ci.junit] # this can be some other profile, too
path = "junit.xml"
17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,23 @@ jobs:
run: just test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get code coverage
run: just test-coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage data to codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
files: target/nextest/ci/junit.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- run: git add . && git diff
- run: git diff --cached
- name: Ensure no files have changed
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ target
.idea/

output.log
*.wasm
*.wasm
lcov.info
10 changes: 9 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ NEXTEST_VERSION := "0.9.72"
CARGO_COMPONENT_VERSION := "0.16.0"
# renovate: datasource=crate depName=sd packageName=sd
SD_VERSION := "1.0.0"
# renovate: datasource=crate depName=cargo-llvm-cov packageName=cargo-llvm-cov
CARGO_LLVM_COV_VERSION := "0.6.13"

FORMATTABLE_PROJECTS := "-p pulumi_wasm -p pulumi_wasm_common -p pulumi_wasm_generator -p pulumi_wasm_generator_lib \
-p pulumi_wasm_runner -p pulumi_wasm_runner_component_creator -p pulumi_wasm_rust -p pulumi_wasm_rust_macro \
Expand All @@ -28,9 +30,11 @@ package-language-plugin VERSION:

install-requirements:
rustup component add rustfmt
rustup component add llvm-tools-preview
cargo binstall --no-confirm cargo-nextest@{{NEXTEST_VERSION}}
cargo binstall --no-confirm cargo-component@{{CARGO_COMPONENT_VERSION}}
cargo binstall --no-confirm sd@{{SD_VERSION}}
cargo binstall --no-confirm cargo-llvm-cov@{{CARGO_LLVM_COV_VERSION}}

# Compiling everything together causes linking issues
build-wasm-components:
Expand Down Expand Up @@ -118,7 +122,11 @@ publish-providers:
# DO NOT EDIT - PUBLISH-PROVIDERS - END

test:
cargo nextest run --workspace --timings
cargo nextest run --profile ci --workspace --timings

test-coverage:
cargo llvm-cov --no-report -p pulumi_wasm_core
cargo llvm-cov report --lcov --output-path lcov.info

docs:
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
Expand Down

0 comments on commit da2e3eb

Please sign in to comment.