Skip to content

Conversation

@evilrobot-01
Copy link
Contributor

A follow up to #520, ensuring that tests can be run successfully with no/default/all features enabled. Also updates CI workflow to check these cases.

Note: ideally implementations should be refactored into separate tests depending on feature where practical, instead of sprinkling #[cfg(feature = "xx")] throughout. Hopefully this will come about organically over time now that the additional test checks are added to the CI workflow.

@codecov
Copy link

codecov bot commented Apr 10, 2025

Codecov Report

Attention: Patch coverage is 97.43590% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.08%. Comparing base (23c7b82) to head (428a89a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/pop-cli/src/commands/test/mod.rs 90.00% 0 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##             main     #522      +/-   ##
==========================================
+ Coverage   79.06%   79.08%   +0.02%     
==========================================
  Files         101      101              
  Lines       23689    23724      +35     
  Branches    23689    23724      +35     
==========================================
+ Hits        18729    18763      +34     
- Misses       2742     2743       +1     
  Partials     2218     2218              
Files with missing lines Coverage Δ
crates/pop-cli/src/cli.rs 66.58% <ø> (ø)
crates/pop-cli/src/commands/build/mod.rs 70.04% <100.00%> (+2.35%) ⬆️
crates/pop-cli/src/commands/call/mod.rs 100.00% <100.00%> (ø)
crates/pop-cli/src/commands/hash.rs 89.23% <ø> (ø)
crates/pop-cli/src/commands/mod.rs 68.85% <100.00%> (+0.41%) ⬆️
crates/pop-cli/src/commands/up/mod.rs 83.20% <100.00%> (+0.39%) ⬆️
crates/pop-cli/src/common/binary.rs 78.21% <ø> (ø)
crates/pop-cli/src/common/builds.rs 81.66% <ø> (ø)
crates/pop-cli/src/common/mod.rs 100.00% <100.00%> (ø)
crates/pop-cli/src/style.rs 95.12% <ø> (ø)
... and 1 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@evilrobot-01 evilrobot-01 requested a review from AlexD10S April 10, 2025 09:21
@evilrobot-01 evilrobot-01 added the ready-for-final-review The PR is ready for final review label Apr 14, 2025
Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this isn't introduced in this PR, I ran into errors when executing:

cargo test --lib --bins --no-default-features --features contract

or

cargo test --lib --bins --no-default-features --features parachain

Looks like there are some errors with the dependencies when running with individual features. Might be worth fixing that up and updating the CI to test individual features instead of:

- name: Run unit tests
        run: cargo test --lib --bins

@evilrobot-01 evilrobot-01 force-pushed the frank/test-no-default-features branch from 2b4987f to b30b596 Compare April 22, 2025 06:47
Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, LGTM!

@evilrobot-01 evilrobot-01 force-pushed the frank/test-no-default-features branch from b30b596 to db00599 Compare April 23, 2025 11:55
@evilrobot-01
Copy link
Contributor Author

Rebased on main, resolving conflict

@evilrobot-01 evilrobot-01 force-pushed the frank/test-no-default-features branch from d8bc3a5 to 5d433ca Compare April 24, 2025 13:50
@evilrobot-01
Copy link
Contributor Author

Rebased on main after ci test issue resolved.

@evilrobot-01
Copy link
Contributor Author

428a89a exposes the github token to those specific steps which need it only.

It is already used in the CI at

token: ${{ secrets.GITHUB_TOKEN }}

Additional context:

At the start of each workflow job, GitHub automatically creates a unique GITHUB_TOKEN secret to use in your workflow. You can use the GITHUB_TOKEN to authenticate in the workflow job. Source: https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#about-the-github_token-secret

https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#example-2-calling-the-rest-api also shows it being used in the same way as used within the ApiClient.

@evilrobot-01 evilrobot-01 merged commit 59926ba into main Apr 25, 2025
47 of 49 checks passed
@evilrobot-01 evilrobot-01 deleted the frank/test-no-default-features branch April 25, 2025 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-final-review The PR is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants