-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaction.yml
More file actions
171 lines (153 loc) · 5.36 KB
/
action.yml
File metadata and controls
171 lines (153 loc) · 5.36 KB
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
name: Setup Environment
description: Setup Rust, Solana CLI, and optionally Node.js for testing
inputs:
example:
description: "Example directory path"
required: true
node-version:
description: "Node.js version to install (optional)"
required: false
default: ""
node-version-default:
description: "Default Node.js version for Light CLI"
required: false
default: "22"
solana-cli-version:
description: "Solana CLI version"
required: false
default: "2.3.11"
rust-toolchain:
description: "Rust toolchain version"
required: false
default: "1.90.0"
anchor-version:
description: "Anchor CLI version (for TypeScript tests)"
required: false
default: "0.31.1"
photon-indexer:
description: "Install Photon indexer (required for TypeScript tests)"
required: false
default: "false"
circom-version:
description: "Circom version for ZK circuits"
required: false
default: "v2.2.2"
install-circom:
description: "Whether to install circom and snarkjs"
required: false
default: "false"
runs:
using: composite
steps:
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ inputs.rust-toolchain }}
cache-workspaces: ${{ inputs.example }}
- name: Setup Node.js
if: inputs.node-version != ''
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- name: Setup Node.js (for Light CLI)
if: inputs.node-version == ''
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version-default }}
- name: Cache Solana CLI tools
uses: actions/cache@v4
with:
path: |
~/.cache/solana/
~/.local/share/solana/
key: solana-cli-${{ runner.os }}-build-${{ inputs.solana-cli-version }}
- name: Cache AVM and Anchor
if: inputs.node-version != ''
id: cache-avm
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/avm
~/.avm
key: avm-anchor-${{ runner.os }}-${{ inputs.anchor-version }}
- name: Cache Photon indexer
if: inputs.photon-indexer == 'true'
id: cache-photon
uses: actions/cache@v4
with:
path: ~/.cargo/bin/photon
key: photon-${{ runner.os }}-1a785036de52896b68d06413e3b0231122d6aa4a
- name: Install Solana CLI tools
shell: bash
run: |
if [[ "${{ inputs.solana-cli-version }}" == 1* ]]; then
cd $HOME
wget -q https://github.com/solana-labs/solana/releases/download/v${{ inputs.solana-cli-version }}/solana-release-x86_64-unknown-linux-gnu.tar.bz2
tar jxf solana-release-x86_64-unknown-linux-gnu.tar.bz2
echo "$HOME/solana-release/bin" >> $GITHUB_PATH
else
sh -c "$(curl -sSfL https://release.anza.xyz/v${{ inputs.solana-cli-version }}/install)"
echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
fi
- name: Install Anchor CLI
if: inputs.node-version != '' && steps.cache-avm.outputs.cache-hit != 'true'
shell: bash
run: |
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
avm install ${{ inputs.anchor-version }}
avm use ${{ inputs.anchor-version }}
- name: Set Anchor version
if: inputs.node-version != '' && steps.cache-avm.outputs.cache-hit == 'true'
shell: bash
run: avm use ${{ inputs.anchor-version }}
- name: Install Light CLI
shell: bash
run: npm install -g @lightprotocol/zk-compression-cli@0.27.1-alpha.2
- name: Cache Powers of Tau file
if: inputs.install-circom == 'true'
uses: actions/cache@v4
with:
path: ${{ inputs.example }}/pot/powersOfTau28_hez_final_16.ptau
key: ptau-powersOfTau28_hez_final_16-v1
- name: Cache circom installation
if: inputs.install-circom == 'true'
id: cache-circom
uses: actions/cache@v4
with:
path: ~/.cargo/bin/circom
key: circom-${{ runner.os }}-${{ inputs.circom-version }}
- name: Install circom
if: inputs.install-circom == 'true' && steps.cache-circom.outputs.cache-hit != 'true'
shell: bash
run: |
wget -q https://github.com/iden3/circom/releases/download/${{ inputs.circom-version }}/circom-linux-amd64
chmod +x circom-linux-amd64
mv circom-linux-amd64 ~/.cargo/bin/circom
- name: Install snarkjs
if: inputs.install-circom == 'true'
shell: bash
run: npm install -g snarkjs
- name: Install Photon indexer
if: inputs.photon-indexer == 'true' && steps.cache-photon.outputs.cache-hit != 'true'
shell: bash
env:
RUSTFLAGS: "-A dead-code"
run: cargo install --git https://github.com/lightprotocol/photon.git --rev 1a785036de52896b68d06413e3b0231122d6aa4a --locked --force
- name: Generate keypair
shell: bash
run: solana-keygen new --no-bip39-passphrase
- name: Display versions
shell: bash
run: |
rustc --version
cargo --version
solana --version
light --version
if [ -n "${{ inputs.node-version }}" ]; then
node --version
npm --version
fi
if [ "${{ inputs.install-circom }}" == "true" ]; then
circom --version
snarkjs --help | head -1 || true
fi