[WIP] Vbrunet/2023 07 31 new credix pool #1152
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: Anchor Test | |
on: | |
pull_request: | |
branches: [main, develop] | |
push: | |
branches: [main, develop] | |
permissions: | |
contents: read | |
pull-requests: write | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_TOOLCHAIN: 1.66 | |
SOLANA_VERSION: 1.14.16 | |
ANCHOR_VERSION: 0.27.0 | |
CLUSTER: 'devnet' | |
DEVNET_RPC: https://api.devnet.solana.com | |
# Default wallet | |
RUNNER_WALLET_PATH: '/home/runner/.config/solana/id.json' | |
# Funding wallet | |
BANK_WALLET_PATH: './target/deploy/bank-keypair.json' | |
CI_DEPLOYMENT_AUTHORITY_WALLET_PATH: './target/deploy/ci-resident-upgrade-authority.json' | |
# This program stays deployed to test over time | |
RESIDENT_PROGRAM_KEYPAIR: ./target/deploy/ci-resident-keypair.json | |
# | |
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
# | |
DEPLOYMENT_FUNDING_AMOUNT: 10 | |
TRANSACTION_FEE_OFFSET: 0.005 | |
# Name of the tests files in the program repo. We use them for sed and swap the `anchor test` | |
TEST_DEV: 'test_development' | |
TEST_CI_SETUP: 'test_ci_setup' | |
TEST_CI_MERCURIAL: 'test_ci_mercurial' | |
TEST_CI_IDENTITY: 'test_ci_identity' | |
TEST_CI_CREDIX_LP: 'test_ci_credix_lp' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Build and deploy an updated program at 3kjnUzQgP8AruD7UpngGw2buFvRZdxXocAbrtqpeDdsW | |
anchor-build-and-deploy: | |
name: Upgrades CI Resident Program | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout | |
- uses: actions/checkout@v2 | |
# Install Rust | |
- name: Rust toolchain installation | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
override: true | |
profile: minimal | |
# Install solana | |
- name: Cache Solana Tool Suite | |
uses: actions/cache@v2 | |
id: cache-solana | |
with: | |
path: | | |
~/.cache/solana/ | |
~/.local/share/solana/ | |
key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_VERSION }} | |
- 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: Add Solana to PATH | |
run: echo "/home/runner/.local/share/solana/install/active_release/bin:$PATH" >> $GITHUB_PATH | |
- name: Setup solana | |
run: | | |
solana --version | |
solana config set -u d | |
solana config set --url ${{ env.DEVNET_RPC}} | |
- name: Node 14 installation | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
# Create Keypair | |
- name: Create Runner keypair and funds it | |
run: | | |
solana-keygen new -o ${{ env.RUNNER_WALLET_PATH }} --no-passphrase --silent | |
solana transfer --keypair ${{ env.BANK_WALLET_PATH }} $(solana-keygen pubkey ${{ env.RUNNER_WALLET_PATH }}) ${{ env.DEPLOYMENT_FUNDING_AMOUNT }} --allow-unfunded-recipient | |
solana balance | |
# Cargo caching | |
- name: Cache Cargo registry + index | |
uses: actions/cache@v2 | |
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: Cache target folder | |
uses: actions/cache@v2 | |
id: cache-programs | |
with: | |
path: | | |
./target/debug | |
./target/release | |
./target/bpfel-unknown-unknown | |
key: solana-${{ runner.os }}-v0000-${{ hashFiles('**/programs/**/*.rs') }}-${{ hashFiles('**/programs/**/*.toml') }} | |
- name: Upgrade resident program with latest code | |
run: | | |
npm ci --ignore-scripts | |
./scripts/swap_ci_resident_program_id.sh | |
npx @coral-xyz/anchor-cli@${{ env.ANCHOR_VERSION }} build | |
solana program deploy ./target/deploy/uxd.so --program-id ${{ env.RESIDENT_PROGRAM_KEYPAIR }} --upgrade-authority ${{ env.CI_DEPLOYMENT_AUTHORITY_WALLET_PATH }} | |
- name: Returning funded runner wallet SOLs to the bank | |
if: always() | |
run: | | |
solana transfer --keypair ${{ env.RUNNER_WALLET_PATH }} ${{ env.BANK_WALLET_PATH }} $(echo $(solana balance --keypair ${{ env.RUNNER_WALLET_PATH }} | awk '{print $1}') - ${{ env.TRANSACTION_FEE_OFFSET }} | bc) | |
anchor-test-setup: | |
name: Setup UXD Suite | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: [anchor-build-and-deploy] | |
steps: | |
# Checkout | |
- uses: actions/checkout@v2 | |
# Install Rust | |
- name: Rust toolchain installation | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
override: true | |
profile: minimal | |
# Install solana | |
- name: Cache Solana Tool Suite | |
uses: actions/cache@v2 | |
id: cache-solana | |
with: | |
path: | | |
~/.cache/solana/ | |
~/.local/share/solana/ | |
key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_VERSION }} | |
- 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: Add Solana to PATH | |
run: echo "/home/runner/.local/share/solana/install/active_release/bin:$PATH" >> $GITHUB_PATH | |
- name: Setup solana | |
run: | | |
solana --version | |
solana config set -u d | |
solana config set --url ${{ env.DEVNET_RPC}} | |
- name: Node 14 installation | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
# Create Keypair | |
- name: Create Runner keypair and funds it | |
run: | | |
solana-keygen new -o ${{ env.RUNNER_WALLET_PATH }} --no-passphrase --silent | |
solana transfer --keypair ${{ env.BANK_WALLET_PATH }} $(solana-keygen pubkey ${{ env.RUNNER_WALLET_PATH }}) 1 --allow-unfunded-recipient | |
solana balance | |
# Cargo caching | |
- name: Cache Cargo registry + index | |
uses: actions/cache@v2 | |
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: Cache target folder | |
uses: actions/cache@v2 | |
id: cache-programs | |
with: | |
path: | | |
./target/debug | |
./target/release | |
./target/bpfel-unknown-unknown | |
key: solana-${{ runner.os }}-v0000-${{ hashFiles('**/programs/**/*.rs') }}-${{ hashFiles('**/programs/**/*.toml') }} | |
- name: Anchor Test (skip build and deploy) | |
run: | | |
npm ci --ignore-scripts | |
./scripts/swap_ci_resident_program_id.sh | |
sed -i.bak "s/${{ env.TEST_DEV }}/${{ env.TEST_CI_SETUP }}/g" ./Anchor.toml | |
npx @coral-xyz/anchor-cli@${{ env.ANCHOR_VERSION }} test --skip-local-validator --skip-build --skip-deploy | |
- name: Returning funded runner wallet SOLs to the bank | |
if: always() | |
run: | | |
solana transfer --keypair ${{ env.RUNNER_WALLET_PATH }} ${{ env.BANK_WALLET_PATH }} $(echo $(solana balance --keypair ${{ env.RUNNER_WALLET_PATH }} | awk '{print $1}') - ${{ env.TRANSACTION_FEE_OFFSET }} | bc) | |
anchor-test-mercurial: | |
name: Mercurial mint/redeem and edit depository | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: [anchor-test-setup] | |
steps: | |
# Checkout | |
- uses: actions/checkout@v2 | |
# Install Rust | |
- name: Rust toolchain installation | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
override: true | |
profile: minimal | |
# Install solana | |
- name: Cache Solana Tool Suite | |
uses: actions/cache@v2 | |
id: cache-solana | |
with: | |
path: | | |
~/.cache/solana/ | |
~/.local/share/solana/ | |
key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_VERSION }} | |
- 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: Add Solana to PATH | |
run: echo "/home/runner/.local/share/solana/install/active_release/bin:$PATH" >> $GITHUB_PATH | |
- name: Setup solana | |
run: | | |
solana --version | |
solana config set -u d | |
solana config set --url ${{ env.DEVNET_RPC}} | |
- name: Node 14 installation | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
# Create Keypair | |
- name: Create Runner keypair and funds it | |
run: | | |
solana-keygen new -o ${{ env.RUNNER_WALLET_PATH }} --no-passphrase --silent | |
solana transfer --keypair ${{ env.BANK_WALLET_PATH }} $(solana-keygen pubkey ${{ env.RUNNER_WALLET_PATH }}) 1 --allow-unfunded-recipient | |
solana balance | |
# Cargo caching | |
- name: Cache Cargo registry + index | |
uses: actions/cache@v2 | |
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: Cache target folder | |
uses: actions/cache@v2 | |
id: cache-programs | |
with: | |
path: | | |
./target/debug | |
./target/release | |
./target/bpfel-unknown-unknown | |
key: solana-${{ runner.os }}-v0000-${{ hashFiles('**/programs/**/*.rs') }}-${{ hashFiles('**/programs/**/*.toml') }} | |
- name: Anchor Test (skip build and deploy) | |
run: | | |
npm ci --ignore-scripts | |
./scripts/swap_ci_resident_program_id.sh | |
sed -i.bak "s/${{ env.TEST_DEV }}/${{ env.TEST_CI_MERCURIAL }}/g" ./Anchor.toml | |
npx @coral-xyz/anchor-cli@${{ env.ANCHOR_VERSION }} test --skip-local-validator --skip-build --skip-deploy | |
- name: Returning funded runner wallet SOLs to the bank | |
if: always() | |
run: | | |
solana transfer --keypair ${{ env.RUNNER_WALLET_PATH }} ${{ env.BANK_WALLET_PATH }} $(echo $(solana balance --keypair ${{ env.RUNNER_WALLET_PATH }} | awk '{print $1}') - ${{ env.TRANSACTION_FEE_OFFSET }} | bc) | |
anchor-test-identity: | |
name: Identity mint/redeem and edit depository | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: [anchor-test-mercurial] | |
steps: | |
# Checkout | |
- uses: actions/checkout@v2 | |
# Install Rust | |
- name: Rust toolchain installation | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
override: true | |
profile: minimal | |
# Install solana | |
- name: Cache Solana Tool Suite | |
uses: actions/cache@v2 | |
id: cache-solana | |
with: | |
path: | | |
~/.cache/solana/ | |
~/.local/share/solana/ | |
key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_VERSION }} | |
- 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: Add Solana to PATH | |
run: echo "/home/runner/.local/share/solana/install/active_release/bin:$PATH" >> $GITHUB_PATH | |
- name: Setup solana | |
run: | | |
solana --version | |
solana config set -u d | |
solana config set --url ${{ env.DEVNET_RPC}} | |
- name: Node 14 installation | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
# Create Keypair | |
- name: Create Runner keypair and funds it | |
run: | | |
solana-keygen new -o ${{ env.RUNNER_WALLET_PATH }} --no-passphrase --silent | |
solana transfer --keypair ${{ env.BANK_WALLET_PATH }} $(solana-keygen pubkey ${{ env.RUNNER_WALLET_PATH }}) 1 --allow-unfunded-recipient | |
solana balance | |
# Cargo caching | |
- name: Cache Cargo registry + index | |
uses: actions/cache@v2 | |
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: Cache target folder | |
uses: actions/cache@v2 | |
id: cache-programs | |
with: | |
path: | | |
./target/debug | |
./target/release | |
./target/bpfel-unknown-unknown | |
key: solana-${{ runner.os }}-v0000-${{ hashFiles('**/programs/**/*.rs') }}-${{ hashFiles('**/programs/**/*.toml') }} | |
- name: Anchor Test (skip build and deploy) | |
run: | | |
npm ci --ignore-scripts | |
./scripts/swap_ci_resident_program_id.sh | |
sed -i.bak "s/${{ env.TEST_DEV }}/${{ env.TEST_CI_IDENTITY }}/g" ./Anchor.toml | |
npx @coral-xyz/anchor-cli@${{ env.ANCHOR_VERSION }} test --skip-local-validator --skip-build --skip-deploy | |
- name: Returning funded runner wallet SOLs to the bank | |
if: always() | |
run: | | |
solana transfer --keypair ${{ env.RUNNER_WALLET_PATH }} ${{ env.BANK_WALLET_PATH }} $(echo $(solana balance --keypair ${{ env.RUNNER_WALLET_PATH }} | awk '{print $1}') - ${{ env.TRANSACTION_FEE_OFFSET }} | bc) | |
anchor-test-credix-lp: | |
name: Credix lp mint and edit depository | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: [anchor-test-identity] | |
steps: | |
# Checkout | |
- uses: actions/checkout@v2 | |
# Install Rust | |
- name: Rust toolchain installation | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
override: true | |
profile: minimal | |
# Install solana | |
- name: Cache Solana Tool Suite | |
uses: actions/cache@v2 | |
id: cache-solana | |
with: | |
path: | | |
~/.cache/solana/ | |
~/.local/share/solana/ | |
key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_VERSION }} | |
- 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: Add Solana to PATH | |
run: echo "/home/runner/.local/share/solana/install/active_release/bin:$PATH" >> $GITHUB_PATH | |
- name: Setup solana | |
run: | | |
solana --version | |
solana config set -u d | |
solana config set --url ${{ env.DEVNET_RPC}} | |
- name: Node 14 installation | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
# Create Keypair | |
- name: Create Runner keypair and funds it | |
run: | | |
solana-keygen new -o ${{ env.RUNNER_WALLET_PATH }} --no-passphrase --silent | |
solana transfer --keypair ${{ env.BANK_WALLET_PATH }} $(solana-keygen pubkey ${{ env.RUNNER_WALLET_PATH }}) 1 --allow-unfunded-recipient | |
solana balance | |
# Cargo caching | |
- name: Cache Cargo registry + index | |
uses: actions/cache@v2 | |
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: Cache target folder | |
uses: actions/cache@v2 | |
id: cache-programs | |
with: | |
path: | | |
./target/debug | |
./target/release | |
./target/bpfel-unknown-unknown | |
key: solana-${{ runner.os }}-v0000-${{ hashFiles('**/programs/**/*.rs') }}-${{ hashFiles('**/programs/**/*.toml') }} | |
- name: Anchor Test (skip build and deploy) | |
run: | | |
npm ci --ignore-scripts | |
./scripts/swap_ci_resident_program_id.sh | |
sed -i.bak "s/${{ env.TEST_DEV }}/${{ env.TEST_CI_CREDIX_LP }}/g" ./Anchor.toml | |
npx @coral-xyz/anchor-cli@${{ env.ANCHOR_VERSION }} test --skip-local-validator --skip-build --skip-deploy | |
- name: Returning funded runner wallet SOLs to the bank | |
if: always() | |
run: | | |
solana transfer --keypair ${{ env.RUNNER_WALLET_PATH }} ${{ env.BANK_WALLET_PATH }} $(echo $(solana balance --keypair ${{ env.RUNNER_WALLET_PATH }} | awk '{print $1}') - ${{ env.TRANSACTION_FEE_OFFSET }} | bc) |