This repository has been archived by the owner on May 15, 2024. It is now read-only.
[Staking] Contract attributes and sniper check #1329
Workflow file for this run
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: Build | |
on: | |
pull_request: | |
branches: | |
- develop | |
paths: | |
- "**/*.rs" | |
- "**/Cargo.toml" | |
- "**/Cargo.lock" | |
- "rust-toolchain.toml" | |
- "rustfmt.toml" | |
- ".github/workflows/*.yml" | |
push: | |
branches: | |
- develop | |
# Ensures only one build is run per branch, unless pushing to develop | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/develop' && github.run_number || github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_ARGS: ${{ github.ref == 'refs/heads/develop' && '--release' || '' }} | |
CARGO_TERM_COLOR: always | |
SKIP_WASM_BUILD: 1 | |
jobs: | |
fmt: | |
if: ${{ !startsWith(github.head_ref, 'release/') }} | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
steps: | |
- uses: actions/checkout@v3 | |
- run: cargo fmt --all -- --check | |
lint: | |
if: ${{ !startsWith(github.head_ref, 'release/') }} | |
name: Clippy | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
steps: | |
- uses: actions/checkout@v3 | |
- run: ./.github/scripts/free_disk_space.sh | |
- run: sudo apt-get install -y protobuf-compiler | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo-lint- | |
- run: cargo clippy --all-features --all-targets ${{ env.CARGO_ARGS }} -- -D warnings | |
test-pallets: | |
if: ${{ !startsWith(github.head_ref, 'release/') }} | |
name: Test-Pallets | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
strategy: | |
matrix: | |
pallet: | |
- pallet-ajuna-awesome-avatars | |
- pallet-ajuna-awesome-avatars-benchmarking | |
- pallet-ajuna-nft-staking | |
- pallet-ajuna-nft-staking-benchmarking | |
- pallet-ajuna-nft-transfer | |
steps: | |
- uses: actions/checkout@v3 | |
- run: ./.github/scripts/free_disk_space.sh | |
- run: sudo apt-get install -y protobuf-compiler | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-test-${{ matrix.pallet }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo-test-${{ matrix.pallet }}- | |
- run: cargo test --all-features --all-targets ${{ env.CARGO_ARGS }} -p ${{ matrix.pallet }} | |
test-runtime: | |
if: ${{ !startsWith(github.head_ref, 'release/') }} | |
name: Test-Runtime | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
strategy: | |
matrix: | |
runtime: | |
- ajuna-solo-runtime | |
- ajuna-runtime | |
- bajun-runtime | |
steps: | |
- uses: actions/checkout@v3 | |
- run: ./.github/scripts/free_disk_space.sh | |
- run: sudo apt-get install -y protobuf-compiler | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-test-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo-test-${{ matrix.runtime }}- | |
- run: cargo test --all-features --all-targets ${{ env.CARGO_ARGS }} -p ${{ matrix.runtime }} | |
test-full: | |
if: github.ref == 'refs/heads/develop' | |
name: Test-Full | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
steps: | |
- uses: actions/checkout@v3 | |
- run: ./.github/scripts/free_disk_space.sh | |
- run: sudo apt-get install -y protobuf-compiler | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-test-full-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo-test-full- | |
- run: cargo test --workspace --all-features --all-targets ${{ env.CARGO_ARGS }} | |
coverage: | |
if: ${{ !startsWith(github.head_ref, 'release/') }} | |
name: Coverage | |
runs-on: ubuntu-latest | |
container: | |
image: xd009642/tarpaulin:0.22.0 | |
options: --security-opt seccomp=unconfined | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate code coverage | |
run: | | |
cargo tarpaulin --timeout 120 --no-fail-fast --workspace --out Xml \ | |
--exclude \ | |
ajuna-cli ajuna-node ajuna-primitives ajuna-rpc ajuna-service \ | |
ajuna-runtime ajuna-solo-runtime bajun-runtime \ | |
pallet-ajuna-awesome-avatars-benchmarking \ | |
pallet-ajuna-nft-staking-benchmarking \ | |
--exclude-files \ | |
node/* rpc/* runtime/* \ | |
pallets/ajuna-awesome-avatars/benchmarking/* \ | |
pallets/ajuna-nft-staking-benchmarking/* \ | |
benchmarking.rs weights.rs | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true |