Skip to content

ci: add CI script for pop-api tests and integration tests #239

ci: add CI script for pop-api tests and integration tests

ci: add CI script for pop-api tests and integration tests #239

Workflow file for this run

name: ci
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: cargo +stable fmt --all -- --check
check:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/init"
- name: Check Build
run: |
cargo check --release --locked --features=runtime-benchmarks,try-runtime
clippy:
needs: lint
runs-on: ubuntu-latest
permissions:
checks: write
env:
SKIP_WASM_BUILD: 1
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/init"
- name: Annotate with Clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --release --locked --features=runtime-benchmarks
test:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/init"
- name: Run tests
run: cargo test --release --locked --workspace --features=runtime-benchmarks --exclude integration-tests
integration-tests:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/init"
- name: Run integration tests
run: cargo test --release --locked --package integration-tests
contract-integration-tests:
env:
SUBCONTRACT_DIRECTORIES: "create_token_in_constructor fungibles"
CONTRACT_INTEGRATION_TESTS: pop-api/integration-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/init"
- name: Install `cargo-contract` `master`
uses: baptiste0928/cargo-install@9f6037ed331dcf7da101461a20656273fa72abf0 # v3.1.0
with:
crate: cargo-contract
git: https://github.com/use-ink/cargo-contract.git
branch: master
- name: Output versions
run: |
cargo -vV
cargo contract --version
- name: Build contracts
working-directory: ${{env.CONTRACT_INTEGRATION_TESTS}}
run: |
for contract in ${SUBCONTRACT_DIRECTORIES}; do
echo "Processing contract: $contract";
cargo contract build --release --manifest-path contracts/${contract}/Cargo.toml;
done
- name: Run integration tests
working-directory: ${{env.CONTRACT_INTEGRATION_TESTS}}
run: cargo test --release
coverage:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/init"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --exclude integration-tests --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