refactor sdk test package #422
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: test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
decimal: | |
name: Test decimal dependency | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Test decimal | |
working-directory: ./src/decimal | |
run: | | |
cargo test | |
- name: Test decimal core | |
working-directory: ./src/decimal/decimal_core | |
run: | | |
cargo test | |
linting: | |
name: Linting (fmt + clippy) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Add rustfmt clippy components | |
run: | | |
rustup component add rustfmt clippy | |
- name: Run cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Run clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-targets -- --no-deps -D warnings | |
tests_mock_vm: | |
name: Tests MockVM (uint + e2e) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Cache Crates | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: | | |
${{ runner.os }}-cargo-odra-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Install Rust toolchain | |
run: | | |
rustup install nightly-2023-04-20 | |
rustup target add wasm32-unknown-unknown | |
- name: Check if cargo odra exists | |
id: check-odra-exists | |
continue-on-error: true | |
run: cargo odra --version | |
- name: Install cargo odra | |
if: ${{ steps.check-odra-exists.outcome == 'failure' }} | |
run: | | |
cargo +nightly-2023-04-20 install cargo-odra --locked --version 0.0.10 | |
- name: Run unit tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: odra | |
args: test | |
e2e_casper: | |
name: Tests e2e Casper backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Cache Crates | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: | | |
${{ runner.os }}-cargo-odra-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Install WABT | |
run: | | |
sudo apt install wabt | |
- name: Add rustfmt component | |
run: | | |
rustup component add rustfmt | |
- name: Install Rust toolchain | |
run: | | |
rustup install nightly-2023-04-20 | |
rustup target add wasm32-unknown-unknown | |
- name: Check if cargo odra exists | |
id: check-odra-exists | |
continue-on-error: true | |
run: cargo odra --version | |
- name: Install cargo odra | |
if: ${{ steps.check-odra-exists.outcome == 'failure' }} | |
run: | | |
cargo +nightly-2023-04-20 install cargo-odra --locked --version 0.0.10 | |
- name: Run unit tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: odra | |
args: test -b casper -- --features base-e2e | |
e2e_time_consuming: | |
name: Time consuming e2e tests Casper backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Cache Crates | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: | | |
${{ runner.os }}-cargo-odra-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Install WABT | |
run: | | |
sudo apt install wabt | |
- name: Add rustfmt component | |
run: | | |
rustup component add rustfmt | |
- name: Install Rust toolchain | |
run: | | |
rustup install nightly-2023-04-20 | |
rustup target add wasm32-unknown-unknown | |
- name: Check if cargo odra exists | |
id: check-odra-exists | |
continue-on-error: true | |
run: cargo odra --version | |
- name: Install cargo odra | |
if: ${{ steps.check-odra-exists.outcome == 'failure' }} | |
run: | | |
cargo +nightly-2023-04-20 install cargo-odra --locked --version 0.0.10 | |
- name: Run unit tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: odra | |
args: test -b casper -- --features time-consuming-e2e | |
build: | |
name: Build contract | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Cache Crates | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: | | |
${{ runner.os }}-cargo-odra-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Install WABT | |
run: | | |
sudo apt install wabt | |
- name: Install Rust toolchain | |
run: | | |
rustup install nightly-2023-04-20 | |
rustup target add wasm32-unknown-unknown | |
- name: Add rustfmt component | |
run: | | |
rustup component add rustfmt | |
- name: Install cargo odra | |
run: | | |
cargo +nightly-2023-04-20 install cargo-odra --locked --version 0.0.10 | |
- name: Build contract with casper backend | |
uses: actions-rs/cargo@v1 | |
with: | |
command: odra | |
args: build -b casper | |
sdk-build: | |
name: Build and test SDK | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Install WABT | |
run: | | |
sudo apt install wabt | |
- name: Build SDK | |
working-directory: ./sdk | |
run: | | |
chmod +x build.sh | |
./build.sh | |
shell: bash | |
- name: Test SDK | |
working-directory: ./sdk | |
run: | | |
chmod +x tests.sh | |
./tests.sh | |
shell: bash |