use prebuilt binaries for CI #1116
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
name: Unit and e2e tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
checks: | |
name: Uint and e2e tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Cache Crates | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: ${{ runner.os }}-substrate-contracts-node-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Check if substrate-contracts-node exists | |
id: check-substrate-contracts-node | |
continue-on-error: true | |
run: substrate-contracts-node --version | |
- name: Install Protobuf | |
run: | | |
sudo apt-get install -y protobuf-compiler libprotobuf-dev | |
- name: Install cargo-dylint | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --version 3.0.0 --locked cargo-dylint | |
- name: Install dylint-link | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --version 3.0.0 --locked dylint-link | |
- name: Install substrate-contracts-node | |
run: | | |
chmod +x ./node.sh | |
./node.sh | |
substrate-contracts-node | |
cd ./target/tmp | |
echo $(pwd) >> $GITHUB_PATH | |
- name: Run unit tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --features e2e-tests | |
build: | |
name: Release build the contract + lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Cache Crates | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: | | |
${{ runner.os }}-contract-build-env-${{ hashFiles('rust-toolchain.toml') }} | |
${{ runner.os }}-substrate-contracts-node-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Check if substrate-contracts-node exists | |
id: check-substrate-contracts-node | |
continue-on-error: true | |
run: substrate-contracts-node --version | |
- name: Install Protobuf | |
run: | | |
sudo apt-get install -y protobuf-compiler libprotobuf-dev | |
- name: Install cargo-dylint | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --version 3.0.0 --locked cargo-dylint | |
- name: Install dylint-link | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --version 3.0.0 --locked dylint-link | |
- name: Install substrate-contracts-node | |
run: | | |
chmod +x ./node.sh | |
./node.sh | |
substrate-contracts-node | |
cd ./target/tmp | |
echo $(pwd) >> $GITHUB_PATH | |
- name: Install cargo contract | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --version 4.0.2 --locked cargo-contract | |
- name: Run cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Run clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-targets -- --no-deps -D warnings | |
- name: Build contract | |
uses: actions-rs/cargo@v1 | |
with: | |
command: contract | |
args: build --release | |
sdk-build: | |
name: Build and test SDK | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Cache Crates | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: | | |
${{ runner.os }}-contract-build-env-${{ hashFiles('rust-toolchain.toml') }} | |
${{ runner.os }}-substrate-contracts-node-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Check if substrate-contracts-node exists | |
id: check-substrate-contracts-node | |
continue-on-error: true | |
run: substrate-contracts-node --version | |
- name: Install Protobuf | |
run: | | |
sudo apt-get install -y protobuf-compiler libprotobuf-dev | |
- name: Install cargo-dylint | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --version 3.0.0 --locked cargo-dylint | |
- name: Install dylint-link | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --version 3.0.0 --locked dylint-link | |
- name: Install substrate-contracts-node | |
run: | | |
chmod +x ./node.sh | |
./node.sh | |
substrate-contracts-node | |
cd ./target/tmp | |
echo $(pwd) >> $GITHUB_PATH | |
- name: Install cargo contract | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --version 4.0.2 --locked cargo-contract | |
- name: Install wasm-bindgen-cli | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --locked wasm-bindgen-cli | |
- name: Install jq (required for SDK building) | |
run: sudo apt-get install -y jq | |
- name: Build SDK | |
working-directory: ./sdk | |
run: | | |
chmod +x build.sh | |
./build.sh | |
shell: bash | |
- name: Test SDK | |
working-directory: ./sdk | |
run: | | |
chmod +x tests.sh | |
./tests.sh | |
shell: bash |