Merge pull request #284 from r0gue-io/oz-evm-template #547
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: ci | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
GITHUB_ACTOR: pop-cli | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
profile: minimal | |
components: rustfmt | |
override: true | |
- name: Check formatting | |
run: cargo +nightly fmt --all -- --check | |
build: | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: "./.github/actions/init" | |
with: | |
git-user: ${{ env.GITHUB_ACTOR }} | |
- name: Check Feature Contracts Excl. | |
run: cargo check --no-default-features --features contract | |
- name: Check Features Parachain Excl. | |
run: cargo check --no-default-features --features parachain | |
- name: Build default features | |
run: cargo build | |
clippy: | |
needs: lint | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
env: | |
RUSTFLAGS: "-Wmissing_docs" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: "./.github/actions/init" | |
with: | |
git-user: ${{ env.GITHUB_ACTOR }} | |
- name: Annotate with Clippy warnings | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
deny: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/build-push-action@v5 | |
unit-tests: | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: "./.github/actions/init" | |
with: | |
git-user: ${{ env.GITHUB_ACTOR }} | |
- name: Run unit tests | |
run: cargo test --lib --bins | |
coverage: | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: "./.github/actions/init" | |
with: | |
git-user: ${{ env.GITHUB_ACTOR }} | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Generate code coverage | |
run: cargo llvm-cov --all-features --workspace --lib --bins --codecov --output-path codecov.json | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: codecov.json | |
fail_ci_if_error: true | |
documentation-tests: | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: "./.github/actions/init" | |
with: | |
git-user: ${{ env.GITHUB_ACTOR }} | |
- name: Run doc tests | |
run: cargo test --doc | |
contract-integration-tests: | |
needs: lint | |
strategy: | |
matrix: | |
os: [ "ubuntu-latest", "macos-latest" ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
default: true | |
target: wasm32-unknown-unknown | |
components: rust-src, clippy | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run integration tests | |
run: cargo test --no-default-features --features contract --test contract | |
parachain-integration-tests: | |
needs: lint | |
strategy: | |
matrix: | |
os: [ "ubuntu-latest", "macos-latest" ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
default: true | |
target: wasm32-unknown-unknown | |
components: rust-src, clippy | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install packages (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
uses: "./.github/actions/init" | |
with: | |
git-user: ${{ env.GITHUB_ACTOR }} | |
- name: Install packages (macOS) | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install protobuf | |
protoc --version | |
- name: Run integration tests | |
run: cargo test --no-default-features --features parachain --test parachain |