Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: split tests workflow into two and refactor them #351

Merged
merged 9 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/contract_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Contract Tests

on:
push:
branches:
- main
- 0.[0-9]+
pull_request:

jobs:
contract_build_and_test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
contract: [burner, crypto-verify, cyberpunk, hackatom, ibc-reflect, ibc-reflect-send, queue, query-queue, reflect, floaty, staking, voting-with-uuid, dynamic-callee-contract, dynamic-caller-contract, number, call-number, simple-callee, intermediate-number, events]
env:
working-directory: ./contracts/${{ matrix.contract }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
target: wasm32-unknown-unknown
profile: minimal
override: true
components: rustfmt, clippy
- name: Cache cargo
uses: actions/cache@v4
with:
path: ~/.cargo
key: cargocache-v2-${{ matrix.contract }}-rust:1.60.0-${{ hashFiles(format('contracts/{0}/Cargo.lock', matrix.contract)) }}
- name: Version information
run: rustc --version; cargo --version; rustup --version; rustup target list --installed
- name: Add wasm32 target
run: rustup target add wasm32-unknown-unknown && rustup target list --installed
- name: Build wasm binary
working-directory: ${{env.working-directory}}
run: cargo wasm --locked
- name: Unit tests
working-directory: ${{env.working-directory}}
run: cargo unit-test --locked
#
# If this contract requires other contracts for integration testing, please compile it here
#
- name: Build queue wasm binary for integration tests (query-queue)
if: matrix.contract == 'query-queue'
working-directory: ./contracts/queue
run: cargo wasm --locked
#
# Finish
#
- name: Integration tests (singlepass backend)
working-directory: ${{env.working-directory}}
run: cargo test --test integration --locked --no-default-features
- name: Documentation tests
working-directory: ${{env.working-directory}}
run: cargo test --doc --locked
- name: Build and run schema generator
working-directory: ${{env.working-directory}}
run: cargo schema --locked
- name: Ensure schemas are up-to-date
working-directory: ${{env.working-directory}}
run: |
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:"
git status && git --no-pager diff
exit 1
fi
- name: Check formatting
working-directory: ${{env.working-directory}}
run: cargo fmt -- --check
- name: Clippy linting on burner
170210 marked this conversation as resolved.
Show resolved Hide resolved
working-directory: ${{env.working-directory}}
run: cargo clippy --tests -- -D warnings
Loading
Loading