Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,37 +102,37 @@ jobs:
$delegator_subcontracts = "accumulator","adder","subber"
foreach ($contract in $delegator_subcontracts) {
echo "Processing delegator contract: $contract";
cargo ${{ matrix.job }} --verbose --manifest-path examples/delegator/${contract}/Cargo.toml;
cargo ${{ matrix.job }} --verbose --manifest-path integration-tests/delegator/${contract}/Cargo.toml;
}
$upgradeable_contracts = "forward-calls","set-code-hash"
foreach ($contract in $upgradeable_contracts) {
echo "Processing upgradeable contract: $contract";
cargo ${{ matrix.job }} --verbose --manifest-path examples/upgradeable-contracts/${contract}/Cargo.toml;
cargo ${{ matrix.job }} --verbose --manifest-path integration-tests/upgradeable-contracts/${contract}/Cargo.toml;
}
cargo ${{ matrix.job }} --verbose --manifest-path examples/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml;
foreach ($example in Get-ChildItem -Directory "examples\*") {
cargo ${{ matrix.job }} --verbose --manifest-path integration-tests/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml;
foreach ($example in Get-ChildItem -Directory "integration-tests\*") {
if ($example -Match 'upgradeable-contracts') { continue }
if ($example -Match 'lang-err-integration-tests') { continue }
echo "Processing example: $example";
cargo ${{ matrix.job }} --verbose --manifest-path=$example/Cargo.toml;
cargo clean --manifest-path=$example/Cargo.toml;
}

- name: ${{ matrix.job }} examples on ${{ matrix.platform }}-${{ matrix.toolchain }}
- name: ${{ matrix.job }} integration-tests on ${{ matrix.platform }}-${{ matrix.toolchain }}
if: runner.os == 'macOS'
run: |
for contract in ${DELEGATOR_SUBCONTRACTS}; do
echo "Processing delegator contract: $contract";
cargo ${{ matrix.job }} --verbose --manifest-path examples/delegator/${contract}/Cargo.toml;
cargo ${{ matrix.job }} --verbose --manifest-path integration-tests/delegator/${contract}/Cargo.toml;
done
for contract in ${UPGRADEABLE_CONTRACTS}; do
echo "Processing upgradeable contract: $contract";
cargo ${{ matrix.job }} --verbose --manifest-path=examples/upgradeable-contracts/$contract/Cargo.toml;
cargo ${{ matrix.job }} --verbose --manifest-path=integration-tests/upgradeable-contracts/$contract/Cargo.toml;
done
cargo ${{ matrix.job }} --verbose --manifest-path=examples/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml;
for example in examples/*/; do
if [ "$example" = "examples/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "examples/lang-err-integration-tests/" ]; then continue; fi;
cargo ${{ matrix.job }} --verbose --manifest-path=integration-tests/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml;
for example in integration-tests/*/; do
if [ "$example" = "integration-tests/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "integration-tests/lang-err-integration-tests/" ]; then continue; fi;
echo "Processing example: $example";
cargo ${{ matrix.job }} --verbose --manifest-path=$example/Cargo.toml;
done
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/model/target/
/lang/target/
/primitives/target/
/examples/**/target/
/integration-tests/**/target/
/design/

# Ignore backup files creates by cargo fmt.
Expand Down
90 changes: 45 additions & 45 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spellcheck:
<<: *test-refs
script:
- cargo spellcheck check -v --cfg=.config/cargo_spellcheck.toml --checkers hunspell --code 1 -- recursive .
- cargo spellcheck check -v --cfg=.config/cargo_spellcheck.toml --checkers hunspell --code 1 -- recursive ./examples/*
- cargo spellcheck check -v --cfg=.config/cargo_spellcheck.toml --checkers hunspell --code 1 -- recursive ./integration-tests/*
allow_failure: true

fmt:
Expand All @@ -115,23 +115,23 @@ examples-fmt:
<<: *test-refs
script:
# Note that we disable the license header check for the examples, since they are unlicensed.
- for example in examples/*/; do
if [ "$example" = "examples/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "examples/lang-err-integration-tests/" ]; then continue; fi;
- for example in integration-tests/*/; do
if [ "$example" = "integration-tests/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "integration-tests/lang-err-integration-tests/" ]; then continue; fi;
cargo +nightly fmt --verbose --manifest-path ${example}/Cargo.toml -- --check;
done
- for contract in ${DELEGATOR_SUBCONTRACTS}; do
cargo +nightly fmt --verbose --manifest-path ./examples/delegator/${contract}/Cargo.toml -- --check;
cargo +nightly fmt --verbose --manifest-path ./integration-tests/delegator/${contract}/Cargo.toml -- --check;
done
- for contract in ${UPGRADEABLE_CONTRACTS}; do
cargo +nightly fmt --verbose --manifest-path ./examples/upgradeable-contracts/${contract}/Cargo.toml -- --check;
cargo +nightly fmt --verbose --manifest-path ./integration-tests/upgradeable-contracts/${contract}/Cargo.toml -- --check;
done
- for contract in ${LANG_ERR_INTEGRATION_CONTRACTS}; do
cargo +nightly fmt --verbose --manifest-path ./examples/lang-err-integration-tests/${contract}/Cargo.toml -- --check;
cargo +nightly fmt --verbose --manifest-path ./integration-tests/lang-err-integration-tests/${contract}/Cargo.toml -- --check;
done
- cargo +nightly fmt --verbose --manifest-path ./examples/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml -- --check
- cargo +nightly fmt --verbose --manifest-path ./integration-tests/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml -- --check
# This file is not a part of the cargo project, so it wouldn't be formatted the usual way
- rustfmt +nightly --verbose --check ./examples/psp22-extension/runtime/psp22-extension-example.rs
- rustfmt +nightly --verbose --check ./integration-tests/psp22-extension/runtime/psp22-extension-example.rs
allow_failure: true

clippy-std:
Expand All @@ -158,43 +158,43 @@ examples-clippy-std:
<<: *docker-env
<<: *test-refs
script:
- for example in examples/*/; do
if [ "$example" = "examples/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "examples/lang-err-integration-tests/" ]; then continue; fi;
- for example in integration-tests/*/; do
if [ "$example" = "integration-tests/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "integration-tests/lang-err-integration-tests/" ]; then continue; fi;
cargo clippy --verbose --all-targets --manifest-path ${example}/Cargo.toml -- -D warnings -A $CLIPPY_ALLOWED;
done
- for contract in ${DELEGATOR_SUBCONTRACTS}; do
cargo clippy --verbose --all-targets --manifest-path ./examples/delegator/${contract}/Cargo.toml -- -D warnings -A $CLIPPY_ALLOWED;
cargo clippy --verbose --all-targets --manifest-path ./integration-tests/delegator/${contract}/Cargo.toml -- -D warnings -A $CLIPPY_ALLOWED;
done
- for contract in ${UPGRADEABLE_CONTRACTS}; do
cargo clippy --verbose --all-targets --manifest-path ./examples/upgradeable-contracts/${contract}/Cargo.toml -- -D warnings -A $CLIPPY_ALLOWED;
cargo clippy --verbose --all-targets --manifest-path ./integration-tests/upgradeable-contracts/${contract}/Cargo.toml -- -D warnings -A $CLIPPY_ALLOWED;
done
- for contract in ${LANG_ERR_INTEGRATION_CONTRACTS}; do
cargo clippy --verbose --all-targets --manifest-path ./examples/lang-err-integration-tests/${contract}/Cargo.toml -- -D warnings -A $CLIPPY_ALLOWED;
cargo clippy --verbose --all-targets --manifest-path ./integration-tests/lang-err-integration-tests/${contract}/Cargo.toml -- -D warnings -A $CLIPPY_ALLOWED;
done
- cargo clippy --verbose --all-targets --manifest-path ./examples/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml -- -D warnings -A $CLIPPY_ALLOWED;
- cargo clippy --verbose --all-targets --manifest-path ./integration-tests/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml -- -D warnings -A $CLIPPY_ALLOWED;
allow_failure: true

examples-clippy-wasm:
stage: lint
<<: *docker-env
<<: *test-refs
script:
- for example in examples/*/; do
if [ "$example" = "examples/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "examples/lang-err-integration-tests/" ]; then continue; fi;
- for example in integration-tests/*/; do
if [ "$example" = "integration-tests/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "integration-tests/lang-err-integration-tests/" ]; then continue; fi;
cargo clippy --verbose --manifest-path ${example}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings -A $CLIPPY_ALLOWED;
done
- for contract in ${DELEGATOR_SUBCONTRACTS}; do
cargo clippy --verbose --manifest-path ./examples/delegator/${contract}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings -A $CLIPPY_ALLOWED;
cargo clippy --verbose --manifest-path ./integration-tests/delegator/${contract}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings -A $CLIPPY_ALLOWED;
done
- for contract in ${UPGRADEABLE_CONTRACTS}; do
cargo clippy --verbose --manifest-path ./examples/upgradeable-contracts/${contract}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings -A $CLIPPY_ALLOWED;
cargo clippy --verbose --manifest-path ./integration-tests/upgradeable-contracts/${contract}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings -A $CLIPPY_ALLOWED;
done
- for contract in ${LANG_ERR_INTEGRATION_CONTRACTS}; do
cargo clippy --verbose --manifest-path ./examples/lang-err-integration-tests/${contract}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings -A $CLIPPY_ALLOWED;
cargo clippy --verbose --manifest-path ./integration-tests/lang-err-integration-tests/${contract}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings -A $CLIPPY_ALLOWED;
done
- cargo clippy --verbose --manifest-path ./examples/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings -A $CLIPPY_ALLOWED;
- cargo clippy --verbose --manifest-path ./integration-tests/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings -A $CLIPPY_ALLOWED;
allow_failure: true


Expand Down Expand Up @@ -369,28 +369,28 @@ examples-test:
- job: clippy-std
artifacts: false
script:
- for example in examples/*/; do
if [ "$example" = "examples/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "examples/lang-err-integration-tests/" ]; then continue; fi;
- for example in integration-tests/*/; do
if [ "$example" = "integration-tests/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "integration-tests/lang-err-integration-tests/" ]; then continue; fi;
if grep -q "e2e-tests = \[\]" "${example}/Cargo.toml"; then
cargo test --verbose --manifest-path ${example}/Cargo.toml --features e2e-tests;
else
cargo test --verbose --manifest-path ${example}/Cargo.toml;
fi;
done
- for contract in ${DELEGATOR_SUBCONTRACTS}; do
cargo test --verbose --manifest-path ./examples/delegator/${contract}/Cargo.toml;
cargo test --verbose --manifest-path ./integration-tests/delegator/${contract}/Cargo.toml;
done
- for contract in ${UPGRADEABLE_CONTRACTS}; do
cargo test --verbose --manifest-path ./examples/upgradeable-contracts/${contract}/Cargo.toml;
cargo test --verbose --manifest-path ./integration-tests/upgradeable-contracts/${contract}/Cargo.toml;
done
# TODO (#1502): We need to clean before running, otherwise the CI fails with a
# linking error.
- for contract in ${LANG_ERR_INTEGRATION_CONTRACTS}; do
cargo clean --verbose --manifest-path ./examples/lang-err-integration-tests/${contract}/Cargo.toml;
cargo test --verbose --manifest-path ./examples/lang-err-integration-tests/${contract}/Cargo.toml --features e2e-tests;
cargo clean --verbose --manifest-path ./integration-tests/lang-err-integration-tests/${contract}/Cargo.toml;
cargo test --verbose --manifest-path ./integration-tests/lang-err-integration-tests/${contract}/Cargo.toml --features e2e-tests;
done
- cargo test --verbose --manifest-path ./examples/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml;
- cargo test --verbose --manifest-path ./integration-tests/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml;

examples-contract-build:
stage: examples
Expand All @@ -399,21 +399,21 @@ examples-contract-build:
script:
- rustup component add rust-src --toolchain stable
- cargo contract -V
- for example in examples/*/; do
if [ "$example" = "examples/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "examples/lang-err-integration-tests/" ]; then continue; fi;
- for example in integration-tests/*/; do
if [ "$example" = "integration-tests/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "integration-tests/lang-err-integration-tests/" ]; then continue; fi;
pushd $example &&
cargo +stable contract build &&
popd;
done
- pushd ./examples/delegator/ && ./build-all.sh && popd
- pushd ./integration-tests/delegator/ && ./build-all.sh && popd
- for contract in ${UPGRADEABLE_CONTRACTS}; do
cargo +stable contract build --manifest-path ./examples/upgradeable-contracts/${contract}/Cargo.toml;
cargo +stable contract build --manifest-path ./integration-tests/upgradeable-contracts/${contract}/Cargo.toml;
done
- for contract in ${LANG_ERR_INTEGRATION_CONTRACTS}; do
cargo +stable contract build --manifest-path ./examples/lang-err-integration-tests/${contract}/Cargo.toml;
cargo +stable contract build --manifest-path ./integration-tests/lang-err-integration-tests/${contract}/Cargo.toml;
done
- cargo +stable contract build --manifest-path ./examples/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml
- cargo +stable contract build --manifest-path ./integration-tests/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml

examples-docs:
stage: examples
Expand All @@ -426,21 +426,21 @@ examples-docs:
# puts the contract functions in a private module.
# Once https://github.com/paritytech/ink/issues/336 has been implemented we can get rid
# of this flag.
- for example in examples/*/; do
if [ "$example" = "examples/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "examples/lang-err-integration-tests/" ]; then continue; fi;
- for example in integration-tests/*/; do
if [ "$example" = "integration-tests/upgradeable-contracts/" ]; then continue; fi;
if [ "$example" = "integration-tests/lang-err-integration-tests/" ]; then continue; fi;
cargo doc --manifest-path ${example}/Cargo.toml --document-private-items --verbose --no-deps;
done
- for contract in ${DELEGATOR_SUBCONTRACTS}; do
cargo doc --manifest-path ./examples/delegator/${contract}/Cargo.toml --document-private-items --verbose --no-deps;
cargo doc --manifest-path ./integration-tests/delegator/${contract}/Cargo.toml --document-private-items --verbose --no-deps;
done
- for contract in ${UPGRADEABLE_CONTRACTS}; do
cargo doc --manifest-path ./examples/upgradeable-contracts/${contract}/Cargo.toml --document-private-items --verbose --no-deps;
cargo doc --manifest-path ./integration-tests/upgradeable-contracts/${contract}/Cargo.toml --document-private-items --verbose --no-deps;
done
- for contract in ${LANG_ERR_INTEGRATION_CONTRACTS}; do
cargo doc --manifest-path ./examples/lang-err-integration-tests/${contract}/Cargo.toml --document-private-items --verbose --no-deps;
cargo doc --manifest-path ./integration-tests/lang-err-integration-tests/${contract}/Cargo.toml --document-private-items --verbose --no-deps;
done
- cargo doc --manifest-path ./examples/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml --document-private-items --verbose --no-deps
- cargo doc --manifest-path ./integration-tests/upgradeable-contracts/set-code-hash/updated-incrementer/Cargo.toml --document-private-items --verbose --no-deps


#### stage: ink-waterfall
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ Verify the following locally, otherwise the CI will fail:
- `cargo clippy --all-targets --all-features` -- -D warnings;
1. Does the code still compile?
- `cargo check --all-features`
1. Do all the examples still compile?
- `cargo contract check --manifest-path ./examples/.../Cargo.toml`
1. Do all the integration tests/examples still compile?
- `cargo contract check --manifest-path ./integration-tests/.../Cargo.toml`
1. Is the `wasm32` target still compiling?
- `cargo check --no-default-features --target wasm32-unknown-unknown`
1. Are all the tests passing?
- `cargo test --all-features --workspace`
1. Are all the tests for the examples passing?
- `cargo test --manifest-path ./examples/.../Cargo.toml`
1. Are all the tests for the integration tests/examples passing?
- `cargo test --manifest-path ./integration-tests/.../Cargo.toml`

### Backwards Compatibility

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ members = [
"crates/storage/traits",
]
exclude = [
"examples/",
"integration-tests/",
]

[profile.release]
Expand Down
Loading