Skip to content

swap logic generalize #2741

swap logic generalize

swap logic generalize #2741

Workflow file for this run

name: Build Quasar
on:
pull_request:
branches:
- main
- fix/*
push:
branches:
- main
- fix/*
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
# This workflow makes x86_64 binaries for linux.
# TODO: add darwin later
jobs:
build-go:
name: quasar-${{ matrix.targetos }}-${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ amd64, arm64 ]
targetos: [ linux ]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get git diff
uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.go
go.mod
go.sum
Makefile
.github/workflows/build.yml
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: 1.20.7
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}
- name: Display go version
if: env.GIT_DIFF
run: go version
- name: Build quasarnoded
if: env.GIT_DIFF
run: make build-reproducible-${{ matrix.arch }}
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
name: quasarnoded-${{ matrix.targetos }}-${{ matrix.arch }}
path: build/quasarnoded-${{ matrix.targetos }}-${{ matrix.arch }}
build-rust:
name: quasar-contracts-${{ matrix.targetos }}-${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ amd64, arm64 ]
targetos: [ linux ]
permissions:
contents: write
actions: write
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get git diff
uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.rs
Makefile
.github/workflows/build.yml
- name: Install just via cargo
run: cargo install just
- name: Download smart contracts dependencies
if: env.GIT_DIFF
run: |
cd smart-contracts
just download-deps
- name: Build smart contracts
if: env.GIT_DIFF
run: |
cd smart-contracts
just workspace-optimize
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
name: smart-contracts
path: |
smart-contracts/artifacts/basic_vault.wasm
smart-contracts/artifacts/lp_strategy.wasm
smart-contracts/artifacts/cl_vault.wasm
smart-contracts/artifacts/merkle_incentives.wasm
test-test-tube:
runs-on: ubuntu-latest
needs: build-rust
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get git diff
uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.rs
Makefile
.github/workflows/build.yml
- name: Download contracts
if: env.GIT_DIFF
uses: actions/download-artifact@v3
with:
name:
smart-contracts
- name: Install Rust
if: env.GIT_DIFF
uses: dtolnay/rust-toolchain@stable
- name: Install just via cargo
run: cargo install just
# This is the new one
- name: Move smart contracts
if: env.GIT_DIFF
run: |
find . -name "*.wasm" -exec bash -c 'file="{}"; contract_name=$(basename "$file" .wasm); dir_name=$(echo "$contract_name" | sed "s/_/-/g"); mkdir -p "smart-contracts/contracts/$dir_name/test-tube-build/wasm32-unknown-unknown/release"; mv "$file" "smart-contracts/contracts/$dir_name/test-tube-build/wasm32-unknown-unknown/release/$contract_name.wasm"' \;
- name: Download smart contracts dependencies
if: env.GIT_DIFF
run: |
cd smart-contracts
just download-deps
- name: Run test-tube tests
if: env.GIT_DIFF
run: cd smart-contracts && cargo test -- --include-ignored --test-threads=1
env:
PROPTEST_CASES: 10