-
Notifications
You must be signed in to change notification settings - Fork 41
192 lines (189 loc) · 6.08 KB
/
solana-js-test.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Solana.js Tests
on:
workflow_dispatch:
push:
paths:
- "javascript/solana.js/src/**"
- "javascript/solana.js/test/**"
- "javascript/solana.js/package.json"
- "javascript/solana.js/package-lock.json"
jobs:
job1:
name: "Build JS SDK"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.6.0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: "pnpm"
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Setup Solana SDK Cache
id: cache-solana-sdk-build
uses: actions/cache@v3
with:
key:
${{ runner.os }}-Solana.js-${{
hashFiles('javascript/solana.js/src/**') }}
path: |
javascript/solana.js/lib
- name: Build solana.js
working-directory: javascript/solana.js
run: pnpm build
job2:
name: "Devnet JS SDK Tests"
needs: job1
timeout-minutes: 15
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.6.0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: "pnpm"
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Setup Solana SDK Cache
id: cache-solana-sdk-build
uses: actions/cache@v3
with:
key:
${{ runner.os }}-Solana.js-${{
hashFiles('javascript/solana.js/src/**') }}
path: |
javascript/solana.js/lib
- name: Build solana.js
if: steps.cache-solana-sdk-build.outputs.cache-hit != 'true'
working-directory: javascript/solana.js
run: pnpm build
- name: Start Local Validator
uses: switchboard-xyz/solana-local-validator@v0.1
with:
solana-version: v1.14.10
cluster: devnet
args:
"--url ${{ secrets.DEVNET_RPC_URL }} --clone
SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f --clone
7nYabs9dUhvxYwdTnrWVBL9MYviKSfrEbdWCUbcnwkpF --clone
Fi8vncGpNKbq62gPo56G4toCehWNy77GgqGkTaAF5Lkk --clone
sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx --clone
BzqtGXZPiDSinP4xMFgPf6FLgSa6iPufK4m4JJFgMnTK --clone
5ExuoQR69trmKQfB95fDsUGsUrrChbGq9PFgt8qouncz"
- name: Run Tests
working-directory: javascript/solana.js
env:
SOLANA_LOCALNET: 1
CI: true
run: pnpm test:localnet
job3:
name: "Mainnet JS SDK Tests"
needs: job1
timeout-minutes: 15
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.6.0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: "pnpm"
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Setup Solana SDK Cache
id: cache-solana-sdk-build
uses: actions/cache@v3
with:
key:
${{ runner.os }}-Solana.js-${{
hashFiles('javascript/solana.js/src/**') }}
path: |
javascript/solana.js/lib
- name: Build solana.js
if: steps.cache-solana-sdk-build.outputs.cache-hit != 'true'
working-directory: javascript/solana.js
run: pnpm build
- name: Start Local Validator
uses: switchboard-xyz/solana-local-validator@v0.1
with:
solana-version: v1.14.10
cluster: mainnet
args:
"--url ${{ secrets.MAINNET_RPC_URL }} --clone
SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f --clone
7nYabs9dUhvxYwdTnrWVBL9MYviKSfrEbdWCUbcnwkpF --clone
Fi8vncGpNKbq62gPo56G4toCehWNy77GgqGkTaAF5Lkk --clone
sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx --clone
BzqtGXZPiDSinP4xMFgPf6FLgSa6iPufK4m4JJFgMnTK --clone
5ExuoQR69trmKQfB95fDsUGsUrrChbGq9PFgt8qouncz"
- name: Run Tests
working-directory: javascript/solana.js
env:
SOLANA_CLUSTER: mainnet-beta
SOLANA_LOCALNET: 1
SWITCHBOARD_PROGRAM_ID: SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f
CI: true
run: |
export SOLANA_CLUSTER='mainnet-beta'
export SOLANA_LOCALNET=1
export SWITCHBOARD_PROGRAM_ID=SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f
pnpm test:localnet:mainnet