Skip to content

feat: add Submarine UI / UX #87

feat: add Submarine UI / UX

feat: add Submarine UI / UX #87

Workflow file for this run

name: continuous-integration/examples
on:
push:
branches:
- main
tags:
- v*
paths-ignore:
- '**.gitignore'
- '.images/**'
- '**README.md'
- 'LICENSE'
pull_request:
branches:
- main
paths-ignore:
- '**.gitignore'
- '.images/**'
- '**README.md'
- 'LICENSE'
jobs:
prepare_matrix:
name:
runs-on: ubuntu-latest
env:
# constant values for matrix
platform: '[\"ubuntu-latest\", \"macos-latest\"]'
toolchain: '[\"stable\"]'
outputs:
MATRIX: ${{ steps.build_matrix.outputs.MATRIX }}
SKIP_CHECKS: ${{ steps.build_matrix.outputs.SKIP_CHECKS }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Look for changes in standalone contracts
id: CHANGED_CONTRACTS
uses: tj-actions/changed-files@v39
with:
dir_names: "true"
dir_names_exclude_current_dir: "true"
dir_names_max_depth: 1
files_ignore: |
.github/**
**/.gitignore
**/*.md
multi-contract-caller/**
upgradeable-contracts/**
ui/**
**/frontend/**
json: true
- name: Look for changes in multi and upgradable contracts
id: CHANGED_MULTI_AND_UPGRADEABLE_CONTRACTS
uses: tj-actions/changed-files@v39
with:
dir_names: "true"
dir_names_exclude_current_dir: "true"
dir_names_max_depth: 2
files: |
multi-contract-caller/**
upgradeable-contracts/**
files_ignore: |
**/.gitignore
**/*.md
json: true
- name: Build matrix
id: build_matrix
run: |
ALL_CHANGED_CONTRACTS=$(jq -s 'add' \
<(echo "${{ steps.CHANGED_CONTRACTS.outputs.all_changed_files }}") \
<(echo "${{ steps.CHANGED_MULTI_AND_UPGRADEABLE_CONTRACTS.outputs.all_changed_files }}"))
if [ $ALL_CHANGED_CONTRACTS = "[]" ]
then
echo "Nothing important changed. Checks job will be skipped."
echo "SKIP_CHECKS=true" >> $GITHUB_OUTPUT
else
echo "There are changes in following contracts: $ALL_CHANGED_CONTRACTS"
echo "SKIP_CHECKS=false" >> $GITHUB_OUTPUT
fi
echo "MATRIX={\"platform\":${{env.platform}},\
\"toolchain\":${{env.toolchain}},\
\"contract\":"$ALL_CHANGED_CONTRACTS"}"\
>> $GITHUB_OUTPUT
- name: Show resulting matrix
run: |
echo "Following matrix will be used to generate test jobs."
echo ${{ toJson(steps.build_matrix.outputs.MATRIX) }} | jq
check:
name: examples
needs: prepare_matrix
if: ${{ needs.prepare_matrix.outputs.SKIP_CHECKS == 'false' }}
env:
RUST_BACKTRACE: full
strategy:
matrix:
${{ fromJson(needs.prepare_matrix.outputs.MATRIX) }}
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout sources & submodules
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Install toolchain
id: toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
components: rust-src
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
with:
cache-on-failure: true
workspaces: ${{ matrix.contract }}
key: ${{ matrix.contract }}
- name: Install `cargo-contract` `main`
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2.2.0
with:
crate: cargo-contract
git: https://github.com/paritytech/cargo-contract.git
cache-key: ${{ matrix.platform }}
- name: Install cargo-dylint
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2.2.0
with:
crate: cargo-dylint
version: 1
- name: Install dylint-link
uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941 # v2.2.0
with:
crate: dylint-link
version: 1
- name: Download and run latest `substrate-contracts-node` binary
if: runner.os == 'Linux'
run: |
curl -L -o substrate-contracts-node.zip 'https://gitlab.parity.io/parity/mirrors/substrate-contracts-node/-/jobs/artifacts/main/download?job=build-linux' && \
unzip substrate-contracts-node.zip && \
chmod +x artifacts/substrate-contracts-node-linux/substrate-contracts-node &&
./artifacts/substrate-contracts-node-linux/substrate-contracts-node -linfo,runtime::contracts=debug 2>&1 | tee /tmp/contracts-node.log &
- name: Download and run latest `substrate-contracts-node` binary
if: runner.os == 'macOS'
run: |
curl -L -o substrate-contracts-node.zip 'https://gitlab.parity.io/parity/mirrors/substrate-contracts-node/-/jobs/artifacts/main/download?job=build-mac' && \
unzip substrate-contracts-node.zip && \
chmod +x artifacts/substrate-contracts-node-mac/substrate-contracts-node &&
./artifacts/substrate-contracts-node-mac/substrate-contracts-node -linfo,runtime::contracts=debug 2>&1 | tee /tmp/contracts-node.log &
- name: Install and run latest `substrate-contracts-node` binary
if: runner.os == 'Windows'
run: |
cargo install contracts-node --git https://github.com/paritytech/substrate-contracts-node.git --force --locked && \
substrate-contracts-node -lruntime::contracts=debug 2>&1 | tee /tmp/contracts-node.log &
- name: Output versions
run: |
cargo -vV
cargo contract --version
- name: Build ${{ matrix.contract }} on ${{ matrix.platform }}-${{ matrix.toolchain }}
if: runner.os != 'Windows'
run: cargo contract build --verbose --manifest-path=${{ matrix.contract }}/Cargo.toml;
- name: Test ${{ matrix.contract }} on ${{ matrix.platform }}-${{ matrix.toolchain }}
if: runner.os != 'Windows'
run: cargo test --verbose --manifest-path=${{ matrix.contract }}/Cargo.toml;