Skip to content

Merge pull request #9 from SecretSaturn/test-fixes #53

Merge pull request #9 from SecretSaturn/test-fixes

Merge pull request #9 from SecretSaturn/test-fixes #53

name: Secret Gateway Tests
on:
workflow_dispatch:
push:
branches:
- main
- test-fixes
paths:
- "TNLS-Gateways/secret/**"
- ".github/workflows/Secret_gateway_tests.yml"
pull_request:
branches:
- main
paths:
- "TNLS-Gateways/secret/**"
- ".github/workflows/Secret_gateway_tests.yml"
defaults:
run:
working-directory: TNLS-Gateways/secret
env:
CARGO_TERM_COLOR: always
# RUSTFLAGS: -Dwarnings
# RUSTDOCFLAGS: -Dwarnings
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
target:
- x86_64-unknown-linux-gnu
- wasm32-unknown-unknown
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: mozilla-actions/[email protected]
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }} --no-default-features --release
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: mozilla-actions/[email protected]
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo test --release
integration_tests:
runs-on: ubuntu-latest
services:
secret:
image: ghcr.io/scrtlabs/localsecret:v1.13.3
ports:
- 1317:1317
- 5000:5000
- 9091:9091
- 26657:26657
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: mozilla-actions/[email protected]
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Install dependencies
run: npm --prefix tests/ install
# - name: Install wasm-opt
# run: sudo apt update && sudo apt install -y binaryen clang
- name: Install latest Binaryen
run: |
BINARYEN_VERSION=version_118
wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VERSION}/binaryen-${BINARYEN_VERSION}-x86_64-linux.tar.gz
tar -xzf binaryen-${BINARYEN_VERSION}-x86_64-linux.tar.gz
sudo mv binaryen-${BINARYEN_VERSION} /usr/local/binaryen
echo "/usr/local/binaryen/bin" >> $GITHUB_PATH
- name: Verify installation
run: wasm-opt --version
- name: Build wasm contract
run: make build-mainnet
- name: Run integration tests
run: make integration-test