Skip to content

Merge pull request #123 from success-OG/feat/secrets #31

Merge pull request #123 from success-OG/feat/secrets

Merge pull request #123 from success-OG/feat/secrets #31

Workflow file for this run

name: Contract CI
on:
pull_request:
branches:
- main
paths:
- "contract/**"
- ".github/workflows/**"
push:
branches:
- main
paths:
- "contract/**"
jobs:
contract-ci:
name: Smart Contract Checks
runs-on: ubuntu-latest
defaults:
run:
working-directory: contract
steps:
# -----------------------------
# Checkout repository
# -----------------------------
- name: Checkout code
uses: actions/checkout@v4
# -----------------------------
# Set up Rust toolchain
# -----------------------------
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
# -----------------------------
# Cache cargo dependencies
# -----------------------------
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
contract/target
key: ${{ runner.os }}-cargo-${{ hashFiles('contract/**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
# -----------------------------
# Formatting check
# -----------------------------
- name: Cargo format check
run: cargo fmt --all -- --check
# -----------------------------
# Build contracts
# -----------------------------
- name: Cargo build
run: cargo build --locked
# -----------------------------
# Run tests
# -----------------------------
- name: Cargo test
run: cargo test --locked
# -----------------------------
# Clippy linting
# -----------------------------
- name: Cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings