Skip to content

Commit 73a511f

Browse files
committed
Add workflows
1 parent cbca70a commit 73a511f

File tree

2 files changed

+54
-21
lines changed

2 files changed

+54
-21
lines changed

action.yaml renamed to .github/workflows/reusable-build.yaml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -118,24 +118,15 @@ jobs:
118118
echo "MULTISIG_VAULT=${{ secrets.DEVNET_MULTISIG_VAULT }}" >> $GITHUB_ENV
119119
fi
120120
121-
- name: Extract Versions
122-
uses: Woody4618/solana-github-action-workflow/.github/actions/extract-versions@main
121+
- uses: Woody4618/solana-github-action-workflow/.github/actions/extract-versions@main
122+
id: versions
123123

124-
- name: Setup Environment
125-
uses: Woody4618/solana-github-action-workflow/.github/actions/setup@main
126-
127-
- name: Debug Environment Before Setup
128-
run: |
129-
echo "=== Environment Variables Before Setup ==="
130-
env | grep -E "SOLANA|ANCHOR"
131-
echo "==========================="
132-
133-
- name: Install Solana
134-
uses: Woody4618/solana-github-action-workflow/.github/actions/setup-solana@main
135-
136-
- name: Install Anchor
137-
uses: Woody4618/solana-github-action-workflow/.github/actions/setup-anchor@main
138-
if: steps.check-anchor.outputs.is_anchor == 'true'
124+
- uses: Woody4618/solana-github-action-workflow/.github/actions/setup-all@main
125+
id: setup
126+
with:
127+
solana_version: ${{ steps.versions.outputs.solana_version }}
128+
anchor_version: ${{ steps.versions.outputs.anchor_version }}
129+
verify_version: ${{ env.VERIFY_VERSION }}
139130

140131
- name: Set Program Variables from Anchor.toml
141132
if: steps.check-anchor.outputs.is_anchor == 'true'
@@ -154,8 +145,28 @@ jobs:
154145
- name: Set Program Variables from Cargo.toml
155146
if: steps.check-anchor.outputs.is_anchor == 'false'
156147
run: |
157-
# Use the program name directly from input
158-
PROGRAM_NAME="${{ inputs.program }}"
148+
PROGRAM="${{ inputs.program || 'transaction-example' }}"
149+
150+
if [ -f "Cargo.toml" ]; then
151+
echo "Found Cargo.toml, contents:"
152+
cat Cargo.toml
153+
154+
# Extract library name from [lib] section
155+
LIB_NAME=$(grep -A1 '^\[lib\]' Cargo.toml | grep 'name' | sed 's/.*= *"\(.*\)".*/\1/')
156+
echo "Extracted library name: ${LIB_NAME}"
157+
158+
if [ -z "$LIB_NAME" ]; then
159+
# Fallback to package name if no lib name found
160+
LIB_NAME=$(grep -A1 '^\[package\]' Cargo.toml | grep 'name' | sed 's/.*= *"\(.*\)".*/\1/')
161+
echo "No lib name found, using package name: ${LIB_NAME}"
162+
fi
163+
else
164+
LIB_NAME="$PROGRAM"
165+
echo "No Cargo.toml found, using program name: ${LIB_NAME}"
166+
fi
167+
168+
PROGRAM_NAME="$LIB_NAME"
169+
echo "Final program name: $PROGRAM_NAME"
159170
echo "PROGRAM_NAME=${PROGRAM_NAME}" >> $GITHUB_ENV
160171
161172
# Get program ID from keypair
@@ -238,7 +249,6 @@ jobs:
238249
uses: Woody4618/solana-github-action-workflow/.github/actions/build-verified@main
239250
id: build-verified
240251
with:
241-
verify-version: ${{ env.SOLANA_VERIFY_VERSION }}
242252
devnet: ${{ inputs.network == 'devnet' }}
243253
program: ${{ env.PROGRAM_NAME }}
244254
program-id: ${{ env.PROGRAM_ID }}
@@ -355,7 +365,6 @@ jobs:
355365
id: verify-build
356366
if: inputs.verify
357367
with:
358-
verify-version: ${{ env.SOLANA_VERIFY_VERSION }}
359368
program-id: ${{ env.PROGRAM_ID }}
360369
program: ${{ env.PROGRAM_NAME }}
361370
network: ${{ inputs.network }}

.github/workflows/test.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test Program
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
program:
7+
description: "Program to test"
8+
required: true
9+
type: string
10+
branch:
11+
description: "Branch to test"
12+
required: false
13+
type: string
14+
default: "*"
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: Woody4618/solana-github-action-workflow/.github/actions/run-tests@main
23+
with:
24+
program: ${{ inputs.program }}

0 commit comments

Comments
 (0)