-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (78 loc) · 2.7 KB
/
ci_test.yaml
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
name: Run tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: read
packages: read
jobs:
solana-tests:
name: Run Solana SDK tests
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max-old-space-size=2500"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.17.0"
registry-url: "https://npm.pkg.github.com"
cache: "yarn"
cache-dependency-path: |
./yarn.lock
- name: Read relayer-infra-contracts commit hash
id: relayer-infra-contracts-commit
shell: bash
run: |
submodule_status=$(git submodule status --cached | grep relayer-infra-contracts)
# we discard the first character which represents working tree summary diff
echo "commit=${submodule_status:1:40}" >> $GITHUB_OUTPUT
- name: Checkout relayer-infra-contracts
uses: actions/checkout@v4
with:
repository: xlabs/relayer-infra-contracts
path: lib/relayer-infra-contracts
ssh-key: '${{ secrets.RELAYER_INFRA_CONTRACTS }}'
ref: ${{ steps.relayer-infra-contracts-commit.outputs.commit }}
# Taken from https://github.com/metaDAOproject/setup-anchor/blob/main/action.yml#L25-L40
- name: Cache Solana CLI tools
uses: actions/cache@v4
with:
path: |
~/.cache/solana/
~/.local/share/solana/
key: solana-cli-${{ runner.os }}-build-1.28.23
- name: Install Solana CLI tools
run: sh -c "$(curl -sSfL https://release.anza.xyz/v1.18.23/install)"
shell: bash
- name: Update PATH
run: echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
shell: bash
- name: Install Anchor
run: npm i -g @coral-xyz/[email protected]
shell: bash
- name: Create keypair
run: solana-keygen new --no-bip39-passphrase
shell: bash
- name: Setup private package access
run: |
yarn config set npmScopes.xlabs.npmAlwaysAuth true
yarn config set npmScopes.xlabs.npmAuthToken ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: yarn install --immutable --immutable-cache
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Solana programs
run: anchor build
working-directory: ./solana
shell: bash
- name: Run Solana SDK tests
run: |
yarn ./sdk/common build:ts && yarn ./sdk/solana build:ts && yarn ./solana build:ts
anchor run setup-test
anchor test
shell: bash