Project import generated by Copybara. #451
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: 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 |