Merge pull request #719 from Levana-Protocol/mpa-max-notify #2436
Workflow file for this run
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: [develop] | |
tags: | |
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | |
pull_request: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
RUST_BACKTRACE: short | |
RUSTUP_MAX_RETRIES: 10 | |
jobs: | |
rust_tests: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ci-test-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: [email protected] | |
- uses: dorny/paths-filter@v3 | |
id: contracts | |
with: | |
filters: | | |
contracts: | |
- 'contracts/**' | |
- 'packages/msg/**' | |
- 'packages/shared/**' | |
- 'packages/multi_test/**' | |
- 'packages/fuzz/**' | |
- '.ci/**' | |
- name: Check commit | |
run: just check-commits | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.75.0 | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: | | |
. | |
- name: Cache contract builds | |
if: ${{ (steps.contracts.outputs.contracts == 'true' || github.ref == 'refs/heads/develop') }} | |
uses: actions/cache@v4 | |
with: | |
key: contracts-${{ hashFiles('Cargo.toml') }}-${{hashFiles('Cargo.lock')}}-new${{ hashFiles('./.ci/osmolocal.Dockerfile')}}-${{ hashFiles('./.ci/contracts.sh')}} } | |
restore-keys: | | |
contracts-${{ hashFiles('Cargo.toml') }} | |
contracts | |
path: | | |
wasm | |
- name: Compile | |
run: just cargo-compile | |
# - name: Run tests (with prop tests) | |
# if: github.ref == 'refs/heads/develop' | |
# run: just cargo-test-with-prop | |
- name: Run tests (without prop tests) | |
# if: github.ref != 'refs/heads/develop' | |
run: just cargo-test-check | |
- name: Clippy | |
run: just cargo-clippy-check | |
- name: Rustfmt | |
run: just cargo-fmt-check | |
- name: Cache docker images | |
run: just cache-docker-images | |
- name: Typescript check | |
run: just typescript-check | |
- name: Build contracts | |
if: ${{ (steps.contracts.outputs.contracts == 'true' || github.ref == 'refs/heads/develop') }} | |
run: just build-contracts | |
- name: Print contract sizes | |
if: ${{ (steps.contracts.outputs.contracts == 'true' || github.ref == 'refs/heads/develop') }} | |
run: ls -l wasm/artifacts/*.wasm | |
- name: On Chain tests (Rust) | |
if: ${{ (steps.contracts.outputs.contracts == 'true' || github.ref == 'refs/heads/develop') }} | |
run: just contracts-test | |
- name: Deploy to Osmosis testnet | |
if: github.ref == 'refs/heads/develop' | |
run: COSMOS_WALLET="${{ secrets.DEPLOYER_PHRASE }}" just deploy-osmosis-testnet || echo "Ignoring failed deployment" | |
- name: Migrate contracts (osmoci) | |
if: github.ref == 'refs/heads/develop' | |
run: COSMOS_WALLET="${{ secrets.DEPLOYER_PHRASE }}" just migrate-osmoci || echo "Ignoring failed migration" | |
- name: Configure AWS Credentials | |
if: github.ref == 'refs/heads/develop' | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Build and Deploy documentation | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
just build-docs | |
aws s3 sync ./.output/temp s3://levana-dev-docs/levana-perps-multichain/docs --acl public-read --delete | |
macos-binary: | |
runs-on: macos-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: de-vri-es/setup-git-credentials@v2 | |
with: | |
credentials: "https://levana-bot:${{secrets.GH_BOT_PAT}}@github.com" | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: [email protected] | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.75.0 | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: | | |
. | |
- name: Compile | |
run: just cargo-compile | |
- name: Run tests | |
run: just cargo-test-check | |
- name: Clippy | |
run: just cargo-clippy-check | |
- name: Rustfmt | |
run: just cargo-fmt-check | |
- name: Release builds | |
run: | | |
just cargo-release | |
cp target/release/perps-qa target/release/perps-qa-apple-darwin | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: target/release/perps-qa-apple-darwin | |
generate_release_notes: true |