Compare commits
1 Commits
main
...
cc19c1233f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc19c1233f |
119
.github/workflows/test.yml
vendored
119
.github/workflows/test.yml
vendored
@@ -374,15 +374,128 @@ jobs:
|
|||||||
|
|
||||||
echo "✓ Mixed PHP and Node.js modules verified"
|
echo "✓ Mixed PHP and Node.js modules verified"
|
||||||
|
|
||||||
|
# Test error handling for invalid inputs
|
||||||
|
test-error-handling:
|
||||||
|
name: Error Handling
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout action-module-install
|
||||||
|
uses: actions/checkout@v6.0.2
|
||||||
|
with:
|
||||||
|
path: action-module-install
|
||||||
|
|
||||||
|
- name: Checkout action-server-install
|
||||||
|
uses: actions/checkout@v6.0.2
|
||||||
|
with:
|
||||||
|
repository: Nodarx/action-server-install
|
||||||
|
ref: main
|
||||||
|
path: action-server-install
|
||||||
|
github-server-url: https://git.ktrix.dev
|
||||||
|
|
||||||
|
- name: Setup environment
|
||||||
|
uses: ./action-server-install
|
||||||
|
with:
|
||||||
|
install-php: 'true'
|
||||||
|
install-node: 'true'
|
||||||
|
server-path: './server'
|
||||||
|
|
||||||
|
- name: Test invalid JSON
|
||||||
|
id: test-invalid-json
|
||||||
|
continue-on-error: true
|
||||||
|
uses: ./action-module-install
|
||||||
|
with:
|
||||||
|
modules: 'invalid json string'
|
||||||
|
|
||||||
|
- name: Verify invalid JSON was caught
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.test-invalid-json.outcome }}" = "success" ]; then
|
||||||
|
echo "::error::Action should have failed with invalid JSON"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✓ Invalid JSON properly rejected"
|
||||||
|
|
||||||
|
- name: Test missing dependency
|
||||||
|
id: test-missing-dep
|
||||||
|
continue-on-error: true
|
||||||
|
uses: ./action-module-install
|
||||||
|
with:
|
||||||
|
modules: |
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "module-a",
|
||||||
|
"repo": "file:///tmp/fake",
|
||||||
|
"dependencies": ["non-existent-module"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
- name: Verify missing dependency was caught
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.test-missing-dep.outcome }}" = "success" ]; then
|
||||||
|
echo "::error::Action should have failed with missing dependency"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✓ Missing dependency properly detected"
|
||||||
|
|
||||||
|
- name: Test circular dependency
|
||||||
|
id: test-circular
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
# Create repos for circular dependency test
|
||||||
|
mkdir -p /tmp/test-repos/circle-a /tmp/test-repos/circle-b
|
||||||
|
|
||||||
|
cd /tmp/test-repos/circle-a
|
||||||
|
git init
|
||||||
|
git config user.email "test@example.com"
|
||||||
|
git config user.name "Test User"
|
||||||
|
echo '{"name": "circle-a"}' > package.json
|
||||||
|
git add . && git commit -m "Initial"
|
||||||
|
|
||||||
|
cd /tmp/test-repos/circle-b
|
||||||
|
git init
|
||||||
|
git config user.email "test@example.com"
|
||||||
|
git config user.name "Test User"
|
||||||
|
echo '{"name": "circle-b"}' > package.json
|
||||||
|
git add . && git commit -m "Initial"
|
||||||
|
|
||||||
|
- name: Run circular dependency test
|
||||||
|
id: test-circular-run
|
||||||
|
continue-on-error: true
|
||||||
|
uses: ./action-module-install
|
||||||
|
with:
|
||||||
|
modules: |
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "circle-a",
|
||||||
|
"repo": "file:///tmp/test-repos/circle-a",
|
||||||
|
"dependencies": ["circle-b"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "circle-b",
|
||||||
|
"repo": "file:///tmp/test-repos/circle-b",
|
||||||
|
"dependencies": ["circle-a"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
- name: Verify circular dependency was caught
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.test-circular-run.outcome }}" = "success" ]; then
|
||||||
|
echo "::error::Action should have failed with circular dependency"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✓ Circular dependency properly detected"
|
||||||
|
|
||||||
# Test summary
|
# Test summary
|
||||||
test-summary:
|
test-summary:
|
||||||
name: Test Summary
|
name: Test Summary
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- test-single-module
|
- test-single-module
|
||||||
|
- test-linear-dependencies
|
||||||
- test-php-module
|
- test-php-module
|
||||||
- test-node-module
|
- test-node-module
|
||||||
- test-mixed-modules
|
- test-mixed-modules
|
||||||
|
- test-error-handling
|
||||||
if: always()
|
if: always()
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -393,15 +506,19 @@ jobs:
|
|||||||
echo "| Test | Result |" >> $GITHUB_STEP_SUMMARY
|
echo "| Test | Result |" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
|
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "| Single Module | ${{ needs.test-single-module.result }} |" >> $GITHUB_STEP_SUMMARY
|
echo "| Single Module | ${{ needs.test-single-module.result }} |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Linear Dependencies | ${{ needs.test-linear-dependencies.result }} |" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "| PHP Module | ${{ needs.test-php-module.result }} |" >> $GITHUB_STEP_SUMMARY
|
echo "| PHP Module | ${{ needs.test-php-module.result }} |" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "| Node Module | ${{ needs.test-node-module.result }} |" >> $GITHUB_STEP_SUMMARY
|
echo "| Node Module | ${{ needs.test-node-module.result }} |" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "| Mixed Modules | ${{ needs.test-mixed-modules.result }} |" >> $GITHUB_STEP_SUMMARY
|
echo "| Mixed Modules | ${{ needs.test-mixed-modules.result }} |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Error Handling | ${{ needs.test-error-handling.result }} |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# Check if any test failed
|
# Check if any test failed
|
||||||
if [ "${{ needs.test-single-module.result }}" != "success" ] || \
|
if [ "${{ needs.test-single-module.result }}" != "success" ] || \
|
||||||
|
[ "${{ needs.test-linear-dependencies.result }}" != "success" ] || \
|
||||||
[ "${{ needs.test-php-module.result }}" != "success" ] || \
|
[ "${{ needs.test-php-module.result }}" != "success" ] || \
|
||||||
[ "${{ needs.test-node-module.result }}" != "success" ] || \
|
[ "${{ needs.test-node-module.result }}" != "success" ] || \
|
||||||
[ "${{ needs.test-mixed-modules.result }}" != "success" ]; then
|
[ "${{ needs.test-mixed-modules.result }}" != "success" ] || \
|
||||||
|
[ "${{ needs.test-error-handling.result }}" != "success" ]; then
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "❌ One or more tests failed" >> $GITHUB_STEP_SUMMARY
|
echo "❌ One or more tests failed" >> $GITHUB_STEP_SUMMARY
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user