1+ name : Publish Client SDK
2+ on :
3+ release :
4+ types : [published]
5+ env :
6+ solana_version : v1.14.18
7+ anchor_version : 0.27.0
8+
9+ jobs :
10+ install :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v3
14+
15+ - uses : actions/cache@v3
16+ name : cache solana cli
17+ id : cache-solana
18+ with :
19+ path : |
20+ ~/.cache/solana/
21+ ~/.local/share/solana/
22+ key : solana-${{ runner.os }}-v0000-${{ env.solana_version }}
23+
24+ - uses : actions/setup-node@v3
25+ with :
26+ node-version : ' 16'
27+
28+ - name : Cache node dependencies
29+ uses : actions/cache@v3
30+ with :
31+ path : ' **/node_modules'
32+ key : ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
33+
34+ - name : install node_modules
35+ run : |
36+ export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
37+ yarn --frozen-lockfile --network-concurrency 2
38+
39+ - uses : dtolnay/rust-toolchain@stable
40+ with :
41+ toolchain : stable
42+
43+ - name : Cache rust
44+ uses : Swatinem/rust-cache@v2
45+
46+ - name : install essentials
47+ run : |
48+ sudo apt-get update
49+ sudo apt-get install -y pkg-config build-essential libudev-dev
50+
51+ - name : install solana
52+ if : steps.cache-solana.outputs.cache-hit != 'true'
53+ run : |
54+ sh -c "$(curl -sSfL https://release.solana.com/${{ env.solana_version }}/install)"
55+ export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
56+ solana --version
57+
58+ clippy-lint :
59+ needs : install
60+ runs-on : ubuntu-latest
61+
62+ steps :
63+ - uses : actions/checkout@v3
64+ - name : Cache rust
65+ uses : Swatinem/rust-cache@v2
66+ - name : Run fmt
67+ run : cargo fmt -- --check
68+ - name : Run clippy
69+ run : cargo clippy -- --deny=warnings
70+
71+ yarn-lint :
72+ needs : install
73+ runs-on : ubuntu-latest
74+ steps :
75+ - uses : actions/checkout@v3
76+ - name : Use Node ${{ matrix.node }}
77+ uses : actions/setup-node@v3
78+ with :
79+ node-version : ' 16'
80+
81+ - name : Cache node dependencies
82+ uses : actions/cache@v3
83+ with :
84+ path : ' **/node_modules'
85+ key : ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
86+
87+ - name : Run lint
88+ run : yarn lint
89+
90+ test-and-publish :
91+ needs : [clippy-lint, yarn-lint]
92+ runs-on : ubuntu-latest
93+
94+ steps :
95+ - uses : actions/checkout@v3
96+
97+ - name : Use Node ${{ matrix.node }}
98+ uses : actions/setup-node@v3
99+ with :
100+ node-version : ' 16'
101+
102+ - name : Cache node dependencies
103+ uses : actions/cache@v3
104+ with :
105+ path : ' **/node_modules'
106+ key : ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
107+ - name : install node_modules
108+ run : |
109+ export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
110+ yarn --frozen-lockfile
111+
112+ - uses : actions/cache@v3
113+ name : cache solana cli
114+ id : cache-solana
115+ with :
116+ path : |
117+ ~/.cache/solana/
118+ ~/.local/share/solana/
119+ key : solana-${{ runner.os }}-v0000-${{ env.solana_version }}
120+
121+ - name : setup solana
122+ run : |
123+ export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
124+ solana --version
125+ solana-keygen new --silent --no-bip39-passphrase
126+
127+ - name : run tests
128+ run : |
129+ export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
130+ ls node_modules/.bin
131+ npm i -g @coral-xyz/anchor-cli@${{ env.anchor_version }} ts-mocha typescript
132+ anchor test
133+
134+ - run : npm run lint:fix && npm publish -w client/sdk/
135+ env :
136+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments