Skip to content
Open
Changes from all 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
143 changes: 143 additions & 0 deletions .github/workflows/ci-uxd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: CI

on:
push:
branches: [ main, v.** ]
pull_request:
branches: [ main, v.** ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
contents: read
pull-requests: write

env:
solana_version: 1.8.11
anchor_version: 0.20.0
cluster: "devnet"
runner_wallet_path: "/home/runner/.config/solana/id.json"
mango_account_mm: "8fbL4156uoVYYyY9cvA6hVBBTdui9356tdKmFbkC6t6w"
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Checkout @UXDProtocol/UXD-Program, install dependencies
uses: actions/checkout@v2.4.0
with:
repository: UXDProtocol/uxd-program
ref: refs/heads/main
# GitHub's personal access token with access to repository
token: ${{ secrets.MANGO_CI_UXD }}
persist-credentials: false
path: ./uxd-program

- uses: actions/setup-node@v2.5.1
name: Node 14 setup
with:
node-version: "14"
cache: "yarn"
cache-dependency-path: ./uxd-program/yarn.lock
registry-url: 'https://npm.pkg.github.com'
scope: "@UXDProtocol"
always-auth: true

- uses: actions/cache@v2
name: Cache Cargo registry + index.
id: cache-anchor
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-${{ runner.os }}-v0000-${{ hashFiles('**/Cargo.lock') }}

- name: Add Solana to PATH
run: echo "/home/runner/.local/share/solana/install/active_release/bin:$PATH" >> $GITHUB_PATH

- uses: actions/cache@v2
name: Cache Solana Tool Suite
id: cache-solana
with:
path: |
~/.cache/solana/
~/.local/share/solana/
key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}

- uses: actions/cache@v2
name: Cache target folder
id: cache-programs
with:
path: |
./target/debug
./target/release
./target/bpfel-unknown-unknown
key: solana-${{ runner.os }}-v0000-${{ hashFiles('**/programs/**/*.rs') }}-${{ hashFiles('**/programs/**/*.toml') }}

- uses: actions-rs/toolchain@v1
name: Rust toolchain
with:
toolchain: nightly
override: true

- name: Install solana
if: steps.cache-solana.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config build-essential libudev-dev
sh -c "$(curl -sSfL https://release.solana.com/v${{ env.solana_version }}/install)"

- name: Setup Solana
run: |
solana --version
solana config set -u d
solana config get
solana-keygen new -o ${{ env.runner_wallet_path }}

- name: Checkout MangoClient-v3, install dependencies, and run MM bot devnet SOL perp + Keeper
uses: actions/checkout@v2.4.0
with:
repository: blockworks-foundation/mango-client-v3
path: ./mango-client-v3

- name: Install MangoClient-v3 dependencies then runs Mango Keeper and MM bot on devnet for SOL perp
run: |
cd ./mango-client-v3
yarn install
solana airdrop 1 -u d
solana airdrop 1 -u d
solana airdrop 1 -u d
solana airdrop 1 -u d
solana airdrop 1 -u d
solana airdrop 1 -u d
solana airdrop 1 -u d
solana airdrop 1 -u d
solana airdrop 1 -u d
solana airdrop 1 -u d
solana airdrop 1 -u d
solana airdrop 1 -u d
GROUP=devnet.2 CLUSTER=${{ env.cluster }} KEYPAIR=${{ env.runner_wallet_path }} yarn keeper &
GROUP=devnet.2 CLUSTER=${{ env.cluster }} KEYPAIR=${{ env.runner_wallet_path }} MANGO_ACCOUNT_PUBKEY=${{ env.mango_account_mm }} MARKET=SOL yarn mm &
cd -


- name: Create NPMRC
run: |
echo "@uxdprotocol:registry=https://npm.pkg.github.com" >> ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${{ env.NODE_AUTH_TOKEN }}" >> ~/.npmrc

- name: Yarn install + use local version of Mango-v3 + run tests
run: |
cd ./uxd-program
sed -i.bak 's/^mango.*/mango={path="..\/..\/..\/program\/",features=["no-entrypoint"]}/' ./programs/uxd/Cargo.toml
yarn install
chmod +x ./scripts/reset_program_id.sh
./scripts/reset_program_id.sh
npx @project-serum/anchor-cli@${{ env.anchor_version }} test --skip-local-validator