Skip to content

Commit a9067c2

Browse files
committed
Build before installing deps in Anchor CI, use --skip-build for anchor test
1 parent 9e0c226 commit a9067c2

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

.github/workflows/anchor.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,25 +130,26 @@ jobs:
130130
echo "Building and Testing $project"
131131
cd "$project" || return 1
132132
133-
# Install dependencies first
134-
if ! pnpm install --frozen-lockfile; then
135-
echo "::error::pnpm install failed for $project"
136-
echo "$project: pnpm install failed" >> $GITHUB_WORKSPACE/failed_projects.txt
133+
# Build first — generates IDL and types that pnpm install/tests need
134+
if ! anchor build; then
135+
echo "::error::anchor build failed for $project"
136+
echo "$project: anchor build failed" >> $GITHUB_WORKSPACE/failed_projects.txt
137+
rm -rf target
137138
cd - > /dev/null
138139
return 1
139140
fi
140141
141-
# Run anchor build
142-
if ! anchor build; then
143-
echo "::error::anchor build failed for $project"
144-
echo "$project: anchor build failed" >> $GITHUB_WORKSPACE/failed_projects.txt
142+
# Install dependencies (after build so generated types are available)
143+
if ! pnpm install --frozen-lockfile; then
144+
echo "::error::pnpm install failed for $project"
145+
echo "$project: pnpm install failed" >> $GITHUB_WORKSPACE/failed_projects.txt
145146
rm -rf target
146147
cd - > /dev/null
147148
return 1
148149
fi
149150
150-
# Run anchor test
151-
if ! anchor test; then
151+
# Run anchor test (--skip-build since we already built above)
152+
if ! anchor test --skip-build; then
152153
echo "::error::anchor test failed for $project"
153154
echo "$project: anchor test failed" >> $GITHUB_WORKSPACE/failed_projects.txt
154155
rm -rf target node_modules

0 commit comments

Comments
 (0)