1
1
name : Setup and build
2
2
description : Checkout sources, install dependencies, build and prepare for tests
3
3
4
+ inputs :
5
+ skip-components :
6
+ description : ' Comma-separated list of components to skip (e.g., "redis,go"). If not specified, all components are installed.'
7
+ required : false
8
+ default : " "
9
+
4
10
runs :
5
11
using : " composite"
6
12
steps :
@@ -22,67 +28,186 @@ runs:
22
28
path : |
23
29
.local
24
30
prover/server/proving-keys
25
- key : ${{ runner.os }}-local-${{ hashFiles('scripts/install.sh', 'prover/server/scripts/download_keys.sh') }}
31
+ key : ${{ runner.os }}-local-v3-${{ hashFiles('scripts/install.sh', 'prover/server/scripts/download_keys.sh') }}
32
+ restore-keys : |
33
+ ${{ runner.os }}-local-v3-
34
+ ${{ runner.os }}-local-v2-
26
35
27
- - name : Install dependencies
36
+ - name : Install system dependencies
28
37
shell : bash
29
38
run : |
30
39
sudo apt-get update
31
- sudo apt-get install -y libudev-dev pkg-config
40
+ sudo apt-get install -y libudev-dev pkg-config build-essential
32
41
33
42
- name : Install dependencies
34
43
if : steps.restore-local-cache.outputs.cache-hit != 'true'
35
44
shell : bash
36
45
run : |
37
- ./scripts/install.sh
46
+ if [ -n "${{ inputs.skip-components }}" ]; then
47
+ ./scripts/install.sh --skip-components "${{ inputs.skip-components }}"
48
+ else
49
+ ./scripts/install.sh
50
+ fi
51
+
52
+ - name : Verify and repair installation
53
+ shell : bash
54
+ run : |
55
+ # Even if cache was restored, run install script to check and install missing components
56
+ # The install script now checks for actual file existence, so it will only install what's missing
57
+ echo "=== Verifying installation integrity ==="
58
+ if [ -n "${{ inputs.skip-components }}" ]; then
59
+ ./scripts/install.sh --no-reset --skip-components "${{ inputs.skip-components }}"
60
+ else
61
+ ./scripts/install.sh --no-reset
62
+ fi
63
+
64
+ - name : Validate environment setup
65
+ shell : bash
66
+ run : |
67
+ echo "=== Validating environment setup ==="
68
+ source ./scripts/devenv.sh
69
+
70
+ # Check critical binaries exist
71
+ echo "Checking Go installation..."
72
+ if [ -f "$GOROOT/bin/go" ]; then
73
+ echo "✓ Go found at: $GOROOT/bin/go"
74
+ $GOROOT/bin/go version || echo "⚠ Go binary exists but failed to run"
75
+ else
76
+ echo "✗ Go not found at expected location: $GOROOT/bin/go"
77
+ exit 1
78
+ fi
79
+
80
+ echo "Checking Rust installation..."
81
+ if [ -f "$CARGO_HOME/bin/cargo" ]; then
82
+ echo "✓ Cargo found at: $CARGO_HOME/bin/cargo"
83
+ $CARGO_HOME/bin/cargo --version || echo "⚠ Cargo binary exists but failed to run"
84
+ else
85
+ echo "✗ Cargo not found at expected location: $CARGO_HOME/bin/cargo"
86
+ exit 1
87
+ fi
88
+
89
+ echo "Checking Node installation..."
90
+ which node && node --version || echo "⚠ Node not in PATH"
91
+
92
+ echo "Checking pnpm installation..."
93
+ which pnpm && pnpm --version || echo "⚠ pnpm not in PATH"
94
+
95
+ echo "Checking Solana installation..."
96
+ which solana && solana --version || echo "⚠ Solana not in PATH"
97
+
98
+ echo "Checking Anchor installation..."
99
+ which anchor && anchor --version || echo "⚠ Anchor not in PATH"
100
+
101
+ # Check proving keys
102
+ if [ -d "prover/server/proving-keys" ] && [ -n "$(ls -A prover/server/proving-keys 2>/dev/null)" ]; then
103
+ echo "✓ Proving keys found: $(ls prover/server/proving-keys | wc -l) files"
104
+ else
105
+ echo "✗ Proving keys directory missing or empty"
106
+ exit 1
107
+ fi
108
+
109
+ echo "=== Environment validation complete ==="
38
110
39
111
- name : Set local environment
40
112
shell : bash
41
113
run : |
42
114
source ./scripts/devenv.sh
115
+ # Export critical environment variables for subsequent steps
116
+ echo "GOROOT=$GOROOT" >> $GITHUB_ENV
117
+ echo "CARGO_HOME=$CARGO_HOME" >> $GITHUB_ENV
118
+ echo "RUSTUP_HOME=$RUSTUP_HOME" >> $GITHUB_ENV
119
+ echo "PATH=$PATH" >> $GITHUB_ENV
120
+ echo "CARGO_FEATURES=$CARGO_FEATURES" >> $GITHUB_ENV
121
+ echo "REDIS_URL=$REDIS_URL" >> $GITHUB_ENV
43
122
44
123
- name : Rust cache
45
124
uses : swatinem/rust-cache@v2
125
+ with :
126
+ cache-all-crates : true
127
+ cache-on-failure : true
128
+ # Add workspace target directory
129
+ workspaces : |
130
+ . -> target
131
+ cli -> cli/target
132
+ examples -> examples/target
46
133
47
134
- name : Setup pnpm
48
135
uses : pnpm/action-setup@v4
49
136
with :
50
- run_install : true
137
+ run_install : false
51
138
52
139
- name : Get pnpm store directory
140
+ id : pnpm-store
53
141
shell : bash
54
142
run : |
55
- echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
143
+ # Get the store path before any pnpm operations
144
+ STORE_PATH=$(pnpm store path --silent)
145
+ echo "STORE_PATH=${STORE_PATH}" >> $GITHUB_ENV
146
+ echo "path=${STORE_PATH}" >> $GITHUB_OUTPUT
56
147
57
- - uses : actions/cache@v4
58
- name : Setup pnpm cache
148
+ - name : Setup pnpm cache
149
+ id : pnpm-cache
150
+ uses : actions/cache@v4
59
151
with :
60
- path : ${{ env.STORE_PATH }}
61
- key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/ pnpm-lock.yaml') }}
152
+ path : ${{ steps.pnpm-store.outputs.path }}
153
+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
62
154
restore-keys : |
63
155
${{ runner.os }}-pnpm-store-
64
156
157
+ - name : Install dependencies
158
+ shell : bash
159
+ run : |
160
+ # Install dependencies with frozen lockfile for consistency
161
+ pnpm install --frozen-lockfile
162
+
163
+ # Validate node_modules was created
164
+ if [ ! -d "node_modules" ] || [ -z "$(ls -A node_modules 2>/dev/null)" ]; then
165
+ echo "Error: node_modules not created after pnpm install"
166
+ exit 1
167
+ fi
168
+
169
+ - name : Save pnpm cache
170
+ # Save cache even on failure to speed up retries
171
+ if : steps.pnpm-cache.outputs.cache-hit != 'true'
172
+ uses : actions/cache/save@v4
173
+ with :
174
+ path : ${{ steps.pnpm-store.outputs.path }}
175
+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
176
+
65
177
- name : Generate Solana keypair
66
178
shell : bash
67
179
run : |
68
180
source ./scripts/devenv.sh
69
181
mkdir -p /home/runner/.config/solana/
70
- solana-keygen new --no-bip39-passphrase -o /home/runner/.config/solana/id.json
182
+ if [ ! -f /home/runner/.config/solana/id.json ]; then
183
+ solana-keygen new --no-bip39-passphrase -o /home/runner/.config/solana/id.json
184
+ fi
71
185
72
186
- name : Copy spl_noop.so to target/deploy
73
187
shell : bash
74
188
run : |
75
189
mkdir -p ./target/deploy
76
190
cp ./third-party/solana-program-library/spl_noop.so ./target/deploy/spl_noop.so
77
191
78
- - name : Cache .local directory
192
+ - name : Build Rust programs
193
+ shell : bash
194
+ run : |
195
+ source ./scripts/devenv.sh
196
+ echo "Building Rust programs..."
197
+ npx nx build @lightprotocol/programs || {
198
+ echo "Failed to build programs, retrying with verbose output..."
199
+ npx nx build @lightprotocol/programs --verbose
200
+ exit 1
201
+ }
202
+
203
+ - name : Save .local directory cache
79
204
if : steps.restore-local-cache.outputs.cache-hit != 'true'
80
- uses : actions/cache@v4
205
+ uses : actions/cache/save @v4
81
206
with :
82
207
path : |
83
208
.local
84
209
prover/server/proving-keys
85
- key : ${{ runner.os }}-local-${{ hashFiles('scripts/install.sh', 'prover/server/scripts/download_keys.sh') }}
210
+ key : ${{ runner.os }}-local-v3- ${{ hashFiles('scripts/install.sh', 'prover/server/scripts/download_keys.sh') }}
86
211
87
212
- name : Check for git changes
88
213
shell : bash
0 commit comments