-
Notifications
You must be signed in to change notification settings - Fork 55
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
CI optimization #45
Merged
Merged
CI optimization #45
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,34 +7,64 @@ on: | |
tags: | ||
- v* | ||
paths-ignore: | ||
- 'README.md' | ||
- '.gitlab-ci.yml' | ||
- '**.gitignore' | ||
- '.images/**' | ||
- '**README.md' | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**.gitignore' | ||
- '.images/**' | ||
- '**README.md' | ||
|
||
|
||
jobs: | ||
check: | ||
name: examples | ||
strategy: | ||
matrix: | ||
platform: | ||
- ubuntu_20_64_core | ||
- ubuntu-latest | ||
- macos-latest | ||
toolchain: | ||
- stable | ||
job: | ||
- contract build | ||
- test | ||
contract: | ||
- basic-contract-caller | ||
- call-runtime | ||
- conditional-compilation | ||
- contract-terminate | ||
- custom-allocator | ||
- custom-environment | ||
- dns | ||
- e2e-call-runtime | ||
- erc20 | ||
- erc721 | ||
- erc1155 | ||
- flipper | ||
- incrementer | ||
- multi-contract-caller | ||
- multi-contract-caller/accumulator | ||
- multi-contract-caller/adder | ||
- multi-contract-caller/subber | ||
- multisig | ||
- payment-channel | ||
- psp22-extension | ||
- rand-extension | ||
- trait-dyn-cross-contract-calls | ||
- trait-erc20 | ||
- trait-flipper | ||
- trait-incrementer | ||
- upgradeable-contracts/delegator | ||
- upgradeable-contracts/set-code-hash | ||
- vesting | ||
runs-on: ${{ matrix.platform }} | ||
env: | ||
MULTI_CONTRACT_CALLER_SUBCONTRACTS: "accumulator adder subber" | ||
UPGRADEABLE_CONTRACTS: "delegator set-code-hash" | ||
RUST_BACKTRACE: full | ||
steps: | ||
|
||
- name: Checkout sources & submodules | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
submodules: recursive | ||
|
@@ -49,22 +79,27 @@ jobs: | |
override: true | ||
|
||
- name: Rust Cache | ||
uses: Swatinem/[email protected] | ||
uses: Swatinem/[email protected] | ||
with: | ||
cache-on-failure: true | ||
workspaces: ${{ matrix.contract }} | ||
key: ${{ matrix.contract }} | ||
|
||
- name: Install `cargo-contract` `main` | ||
uses: actions-rs/cargo@v1 | ||
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2.2.0 | ||
with: | ||
command: install | ||
args: --git https://github.com/paritytech/cargo-contract.git | ||
crate: cargo-contract | ||
git: https://github.com/paritytech/cargo-contract.git | ||
cache-key: ${{ matrix.platform }} | ||
|
||
- name: Install cargo-dylint | ||
uses: baptiste0928/cargo-install@bf6758885262d0e6f61089a9d8c8790d3ac3368f # v1.3.0 | ||
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2.2.0 | ||
with: | ||
crate: cargo-dylint | ||
version: 1 | ||
|
||
- name: Install dylint-link | ||
uses: baptiste0928/cargo-install@bf6758885262d0e6f61089a9d8c8790d3ac3368f # v1.3.0 | ||
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2.2.0 | ||
with: | ||
crate: dylint-link | ||
version: 1 | ||
|
@@ -96,43 +131,10 @@ jobs: | |
cargo -vV | ||
cargo contract --version | ||
|
||
- name: ${{ matrix.job }} examples on ${{ matrix.platform }}-${{ matrix.toolchain }} | ||
if: runner.os == 'Windows' | ||
run: | | ||
$multi_contract_caller_subcontracts = "accumulator","adder","subber" | ||
foreach ($contract in $multi_contract_caller_subcontracts) { | ||
echo "Processing multi-contract-caller contract: $contract"; | ||
cargo ${{ matrix.job }} --verbose --manifest-path multi-contract-caller/${contract}/Cargo.toml; | ||
} | ||
|
||
$upgradeable_contracts = "delegator","set-code-hash" | ||
foreach ($contract in $upgradeable_contracts) { | ||
echo "Processing upgradeable contract: $contract"; | ||
cargo ${{ matrix.job }} --verbose --manifest-path upgradeable-contracts/${contract}/Cargo.toml; | ||
} | ||
|
||
foreach ($example in Get-ChildItem -Directory "\*") { | ||
if ($example -Match 'artifacts') { 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: Build ${{ matrix.contract }} on ${{ matrix.platform }}-${{ matrix.toolchain }} | ||
if: runner.os != 'Windows' | ||
run: | | ||
for contract in ${MULTI_CONTRACT_CALLER_SUBCONTRACTS}; do | ||
echo "Processing multi-contract-caller contract: $contract"; | ||
cargo ${{ matrix.job }} --verbose --manifest-path multi-contract-caller/${contract}/Cargo.toml; | ||
done | ||
|
||
for contract in ${UPGRADEABLE_CONTRACTS}; do | ||
echo "Processing upgradeable contract: $contract"; | ||
cargo ${{ matrix.job }} --verbose --manifest-path=upgradeable-contracts/$contract/Cargo.toml; | ||
done | ||
run: cargo contract build --verbose --manifest-path=${{ matrix.contract }}/Cargo.toml; | ||
|
||
for example in ./*/; do | ||
if [ "$example" = "./artifacts/" ] || [ "$example" = "./upgradeable-contracts/" ]; then continue; fi; | ||
echo "Processing example: $example"; | ||
cargo ${{ matrix.job }} --verbose --manifest-path=$example/Cargo.toml; | ||
done | ||
- name: Test ${{ matrix.contract }} on ${{ matrix.platform }}-${{ matrix.toolchain }} | ||
if: runner.os != 'Windows' | ||
run: cargo test --verbose --manifest-path=${{ matrix.contract }}/Cargo.toml; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only annoying thing here is that we have to remember to update this list when adding/removing examples.
In
ink
I have this script to solve that, although wouldn't be usable in this case because it may not work on OSX and obviously not on Windows.