Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ink_e2e] auto detect contracts to be built #1691

Merged
merged 16 commits into from
Mar 3, 2023
Merged

Conversation

ascjones
Copy link
Collaborator

@ascjones ascjones commented Feb 28, 2023

Currently the e2e test macro requires

  • that the root package itself is a contract
  • any other contracts are defined via additional_contracts

This PR:

  • Detects and builds all contracts which are a dependency of the package in which the e2e tests are defined. This can replace the usage of additional_contracts in the case where the contract manifests are already defined in the manifest.
  • Detects whether the root package itself is a contract, it is no longer required to be a contract.

The way it determines whether a package is a contract is if the ink-as-dependency feature is defined. If a contract does not define this feature then it will not be recognised as being a contract. If this feature is defined for a package which is not a contract then the build will fail.

If additional_contracts is specified it will behave as it currently does for backwards compatibility.

@paritytech-cicd-pr
Copy link

paritytech-cicd-pr commented Mar 1, 2023

🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑

These are the results when building the examples/* contracts from this branch with cargo-contract 2.0.2-755ea06 and comparing them to ink! master:

Δ Optimized Size Δ Used Gas Total Optimized Size Total Used Gas
accumulator 1.13 K
adder 1.75 K
call-runtime 1.79 K
contract-terminate 1.28 K 129_990
contract-transfer 1.44 K 129_990
custom-environment 2.55 K
custom_allocator 8.24 K
delegator 6.10 K 259_980
dns 8.84 K 389_970
erc1155 17.03 K 779_940
erc20 7.53 K 389_970
erc721 11.31 K 1_039_920
flipper 1.40 K 129_990
forward-calls 2.44 K 259_980
incrementer 1.23 K
mapping_integration_tests 3.35 K
mother 10.49 K
multisig 23.51 K 779_940
payment-channel 6.07 K
psp22-extension 7.02 K
rand-extension 2.93 K
set-code-hash 1.60 K
subber 1.77 K
trait-erc20 7.95 K 389_970
trait-flipper 1.18 K 129_990
trait-incrementer 1.34 K 259_980
updated-incrementer 1.60 K

Link to the run | Last update: Thu Mar 2 14:08:17 CET 2023

@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2023

Codecov Report

Merging #1691 (d7d6453) into master (fd0a45d) will decrease coverage by 0.28%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #1691      +/-   ##
==========================================
- Coverage   70.82%   70.54%   -0.28%     
==========================================
  Files         205      205              
  Lines        6409     6431      +22     
==========================================
- Hits         4539     4537       -2     
- Misses       1870     1894      +24     
Impacted Files Coverage Δ
crates/e2e/macro/src/codegen.rs 0.00% <0.00%> (ø)
crates/e2e/src/client.rs 0.00% <ø> (ø)
crates/metadata/src/layout/mod.rs 80.00% <0.00%> (-0.84%) ⬇️
crates/allocator/src/bump.rs 86.77% <0.00%> (-0.83%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ascjones ascjones changed the title [ink_e2e] detect and build all contracts in workspace [ink_e2e] auto detect contracts to be built Mar 2, 2023
@deuszx
Copy link

deuszx commented Mar 3, 2023

@ascjones , how do I write e2e test where I have a dependency on a contract in its separate crate/github repository? Can I do it?

@ascjones
Copy link
Collaborator Author

ascjones commented Mar 3, 2023

@ascjones , how do I write e2e test where I have a dependency on a contract in its separate crate/github repository? Can I do it?

Yes, it should work. As long as the code is available locally to build it should work.

I assume when using a crate or github reference the manifest_path should resolve to the locally checked out code...not tested though

crates/e2e/src/client.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@cmichi cmichi left a comment

Choose a reason for hiding this comment

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

Thank youuuu.

Edit: Changelog plz :-)

Co-authored-by: Michael Müller <mich@elmueller.net>
@ascjones ascjones requested a review from a team as a code owner March 3, 2023 17:09
@ascjones ascjones merged commit 4e56617 into master Mar 3, 2023
@ascjones ascjones deleted the aj/e2e-workspace branch March 3, 2023 17:38
@SkymanOne SkymanOne mentioned this pull request Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants