Deposit limit #58
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: Anchor Localnet Tests | |
on: | |
pull_request: | |
branches: | |
- master | |
- dev | |
workflow_dispatch: | |
env: | |
RUST_TOOLCHAIN: 1.82.0 | |
SOLANA_CLI_VERSION: 2.1.1 | |
ANCHOR_CLI_VERSION: 0.30.1 | |
jobs: | |
tests-local: | |
name: Anchor Localnet Tests | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Checkout the repository and get the branch name | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Get the branch name | |
id: get_branch_name | |
run: | | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
echo "BRANCH_NAME=$(echo ${{ github.head_ref }})" >> $GITHUB_ENV | |
else | |
echo "BRANCH_NAME=$(echo ${{ github.ref_name }})" >> $GITHUB_ENV | |
fi | |
# 2. Install Rust Toolchain | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
profile: minimal | |
components: rustfmt, clippy | |
override: true | |
# 3. Cache Cargo registry and build | |
- name: Cache Cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-registry- | |
- name: Cache Cargo build | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-build- | |
# 4. Install Solana CLI | |
- name: Install Solana | |
run: | | |
sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_CLI_VERSION }}/install)" | |
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | |
- name: Verify Solana Installation | |
run: solana --version | |
# 5. Cache Anchor CLI installation | |
- name: Cache Anchor CLI | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/bin/anchor | |
key: ${{ runner.os }}-anchor-cli-${{ env.ANCHOR_CLI_VERSION }} | |
restore-keys: | | |
${{ runner.os }}-anchor-cli- | |
# 6. Install Anchor CLI using Cargo if not cached | |
- name: Install Anchor | |
run: | | |
if [ ! -f ~/.cargo/bin/anchor ]; then | |
cargo install --git https://github.com/coral-xyz/anchor --tag v${{ env.ANCHOR_CLI_VERSION }} anchor-cli; | |
fi | |
- name: Verify Anchor Installation | |
run: anchor --version | |
# 7. Use a keypair from GitHub Secrets | |
- name: Setup Keypair from Secret | |
run: | | |
echo "${{ secrets.SOLANA_KEYPAIR }}" > /home/runner/.config/solana/id.json | |
solana config set --keypair /home/runner/.config/solana/id.json | |
# 8. Install Node.js dependencies (using cache) | |
- name: Cache Node.js modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Node.js dependencies | |
run: yarn install | |
# 9. Run anchor keys sync 1 | |
- name: Run Anchor Keys Sync 1 | |
run: anchor keys sync | |
timeout-minutes: 1 | |
# 10. Run anchor keys sync 2 | |
- name: Run Anchor Keys Sync 2 | |
run: anchor keys sync | |
timeout-minutes: 1 | |
# 11. Run Anchor Tests (skip build step since we built earlier) | |
- name: Run Anchor Tests | |
run: anchor test | |
timeout-minutes: 15 | |
env: | |
QASE_MODE: testops | |
QASE_TESTOPS_API_TOKEN: ${{ secrets.QASE_TESTOPS_API_TOKEN }} | |
QASE_TESTOPS_PROJECT: SPLYCE | |
QASE_TESTOPS_RUN_TITLE: CI Automation Tests Run - Onchain Vault Integration Tests at branch ${{ env.BRANCH_NAME }} | |
QASE_TESTOPS_RUN_COMPLETE: true | |
QASE_CAPTURE_LOGS: true | |
QASE_ENVIRONMENT: local-tesnet |