-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (108 loc) · 3.86 KB
/
tests-local.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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