Skip to content

add wf for contracts tests #2

add wf for contracts tests

add wf for contracts tests #2

name: Contracts CI - Tests
on:
workflow_dispatch:
pull_request:
paths-ignore:
- 'contracts/**'
- 'docker/**'
push:
paths-ignore:
- 'contracts/**'
- 'docker/**'
branches: [master]
env:
CARGO_TERM_COLOR: always
GEAR_VERSION: 1.4.1
defaults:
run:
working-directory: contracts
permissions:
contents: write
id-token: write
pages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
all:
name: Tests
runs-on: self-hosted
container:
image: ghcr.io/gear-foundation/dapps/ci-rust:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
targets: wasm32-unknown-unknown
components: clippy, rustfmt
- name: Prepare Gear Binary
run: |
mkdir -p target/tmp
wget -qO- https://get.gear.rs/gear-v${{ env.GEAR_VERSION }}-x86_64-unknown-linux-gnu.tar.xz| tar xJ -C target/tmp
# mandatory tasks
- name: Fmt
run: 'cargo +nightly fmt --all -- --config imports_granularity=Crate,edition=2021'
- name: Clippy
run: 'cargo clippy --release --workspace --all-targets --all-features -- -D warnings'
# Only on push to master
- name: On Push to master
if: github.ref != 'refs/heads/master'
run: |
cargo test --release --workspace
cargo test --workspace
# Only on push to PR
- name: On Push to Pull Request
if: github.ref != 'refs/heads/master'
run: cargo test --release --workspace