1+ name : Test SVM Deploy Action
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ test_type :
7+ description : ' Type of test to run'
8+ required : true
9+ default : ' validation'
10+ type : choice
11+ options :
12+ - validation
13+ - integration
14+ - dry-run
15+
16+ jobs :
17+ validate-action-structure :
18+ runs-on : ubuntu-latest
19+
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v4
23+
24+ - name : Validate action.yml structure
25+ run : |
26+ echo "Validating GitHub Action structure..."
27+
28+ # Check if action.yml exists
29+ if [ ! -f ".github/actions/svm-deploy/action.yml" ]; then
30+ echo "❌ action.yml not found"
31+ exit 1
32+ fi
33+
34+ # Check if README exists
35+ if [ ! -f ".github/actions/svm-deploy/README.md" ]; then
36+ echo "❌ README.md not found"
37+ exit 1
38+ fi
39+
40+ # Validate YAML syntax
41+ python -c "import yaml; yaml.safe_load(open('.github/actions/svm-deploy/action.yml'))" || {
42+ echo "❌ Invalid YAML syntax in action.yml"
43+ exit 1
44+ }
45+
46+ echo "✅ Action structure validation passed"
47+
48+ - name : Validate reusable workflow
49+ run : |
50+ echo "Validating reusable workflow..."
51+
52+ # Check if reusable workflow exists
53+ if [ ! -f ".github/workflows/svm-deploy.yml" ]; then
54+ echo "❌ Reusable workflow not found"
55+ exit 1
56+ fi
57+
58+ # Validate YAML syntax
59+ python -c "import yaml; yaml.safe_load(open('.github/workflows/svm-deploy.yml'))" || {
60+ echo "❌ Invalid YAML syntax in reusable workflow"
61+ exit 1
62+ }
63+
64+ echo "✅ Reusable workflow validation passed"
65+
66+ - name : Validate examples
67+ run : |
68+ echo "Validating example workflows..."
69+
70+ EXAMPLE_DIR="examples/github-actions"
71+ if [ ! -d "$EXAMPLE_DIR" ]; then
72+ echo "❌ Examples directory not found"
73+ exit 1
74+ fi
75+
76+ # Check each example file
77+ for file in "$EXAMPLE_DIR"/*.yml; do
78+ if [ -f "$file" ]; then
79+ echo "Validating $file..."
80+ python -c "import yaml; yaml.safe_load(open('$file'))" || {
81+ echo "❌ Invalid YAML syntax in $file"
82+ exit 1
83+ }
84+ fi
85+ done
86+
87+ echo "✅ Examples validation passed"
88+
89+ dry-run-test :
90+ runs-on : ubuntu-latest
91+ if : github.event.inputs.test_type == 'dry-run' || github.event.inputs.test_type == 'integration'
92+
93+ steps :
94+ - name : Checkout repository
95+ uses : actions/checkout@v4
96+
97+ - name : Install system dependencies
98+ run : |
99+ sudo apt-get update
100+ sudo apt-get install -y libudev-dev pkg-config libssl-dev
101+
102+ - name : Dry run - Build OSVM CLI
103+ run : |
104+ echo "Building OSVM CLI for dry run test..."
105+ cargo build --release
106+
107+ # Verify the binary works
108+ ./target/release/osvm --version
109+ ./target/release/osvm --help
110+
111+ - name : Dry run - Test CLI commands
112+ run : |
113+ echo "Testing CLI commands that the action would use..."
114+
115+ # Test the help for svm install command
116+ ./target/release/osvm svm install --help
117+
118+ echo "✅ CLI commands are working correctly"
119+
120+ integration-test :
121+ runs-on : ubuntu-latest
122+ if : github.event.inputs.test_type == 'integration'
123+
124+ steps :
125+ - name : Checkout repository
126+ uses : actions/checkout@v4
127+
128+ - name : Setup test SSH key
129+ run : |
130+ # Generate a test SSH key pair for testing
131+ ssh-keygen -t ed25519 -C "test-key" -f ~/.ssh/test_key -N ""
132+ echo "Test SSH key generated"
133+
134+ - name : Setup test Solana keypair
135+ run : |
136+ # Create a test keypair (not for real use)
137+ mkdir -p ~/.config/solana
138+ echo '[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]' > ~/.config/solana/test.json
139+ echo "Test Solana keypair created"
140+
141+ - name : Test action inputs validation
142+ env :
143+ TEST_SSH_KEY : ${{ secrets.TEST_SSH_PRIVATE_KEY || 'test-key-placeholder' }}
144+ TEST_KEYPAIR : ' [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]'
145+ run : |
146+ echo "Testing action input validation..."
147+
148+ # Test that the action would accept valid inputs
149+ echo "✅ Input validation test would pass with proper secrets"
150+ echo "Note: Full integration test requires valid SSH host and credentials"
151+
152+ test-summary :
153+ needs : [validate-action-structure, dry-run-test, integration-test]
154+ runs-on : ubuntu-latest
155+ if : always()
156+
157+ steps :
158+ - name : Test Summary
159+ run : |
160+ echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY
161+ echo "| Test | Status |" >> $GITHUB_STEP_SUMMARY
162+ echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
163+ echo "| Action Structure | ${{ needs.validate-action-structure.result == 'success' && '✅ Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
164+ echo "| Dry Run | ${{ needs.dry-run-test.result == 'success' && '✅ Passed' || needs.dry-run-test.result == 'skipped' && '⏭️ Skipped' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
165+ echo "| Integration | ${{ needs.integration-test.result == 'success' && '✅ Passed' || needs.integration-test.result == 'skipped' && '⏭️ Skipped' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
166+
167+ echo "## Next Steps" >> $GITHUB_STEP_SUMMARY
168+ echo "- For full integration testing, set up test secrets (TEST_SSH_PRIVATE_KEY)" >> $GITHUB_STEP_SUMMARY
169+ echo "- Test with actual remote hosts in a safe environment" >> $GITHUB_STEP_SUMMARY
170+ echo "- Validate deployment results and error handling" >> $GITHUB_STEP_SUMMARY
0 commit comments