Compare commits
2 Commits
4ed81109e5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 09bdf5181b | |||
|
|
8463d16981 |
322
.github/workflows/test.yml
vendored
322
.github/workflows/test.yml
vendored
@@ -13,15 +13,17 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout action-module-install
|
- name: Checkout action-module-install
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6.0.2
|
||||||
with:
|
with:
|
||||||
path: action-module-install
|
path: action-module-install
|
||||||
|
|
||||||
- name: Clone action-server-install
|
- name: Checkout action-server-install
|
||||||
run: |
|
uses: actions/checkout@v6.0.2
|
||||||
git clone https://git.ktrix.dev/Nodarx/action-server-install action-server-install
|
with:
|
||||||
cd action-server-install
|
repository: Nodarx/action-server-install
|
||||||
git checkout main
|
ref: main
|
||||||
|
path: action-server-install
|
||||||
|
github-server-url: https://git.ktrix.dev
|
||||||
|
|
||||||
- name: Setup server environment
|
- name: Setup server environment
|
||||||
uses: ./action-server-install
|
uses: ./action-server-install
|
||||||
@@ -57,7 +59,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install single module
|
- name: Install single module
|
||||||
id: install
|
id: install
|
||||||
uses: ./
|
uses: ./action-module-install
|
||||||
with:
|
with:
|
||||||
modules: |
|
modules: |
|
||||||
[
|
[
|
||||||
@@ -83,9 +85,10 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check npm install ran
|
# Check npm install result (node_modules required only if production deps exist)
|
||||||
if [ ! -d "./modules/simple-module/node_modules" ]; then
|
DEP_COUNT=$(node -e 'const p=require("./modules/simple-module/package.json"); const c=Object.keys(p.dependencies||{}).length+Object.keys(p.optionalDependencies||{}).length; console.log(c);')
|
||||||
echo "::error::node_modules not found - npm install didn't run"
|
if [ "$DEP_COUNT" -gt 0 ] && [ ! -d "./modules/simple-module/node_modules" ]; then
|
||||||
|
echo "::error::node_modules not found for module with production dependencies"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -102,126 +105,6 @@ jobs:
|
|||||||
|
|
||||||
echo "✓ Single module installation verified"
|
echo "✓ Single module installation verified"
|
||||||
|
|
||||||
# Test modules with linear dependencies
|
|
||||||
test-linear-dependencies:
|
|
||||||
name: Linear Dependencies (A → B → C)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout action-module-install
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
path: action-module-install
|
|
||||||
|
|
||||||
- name: Clone action-server-install
|
|
||||||
run: |
|
|
||||||
git clone https://git.ktrix.dev/Nodarx/action-server-install action-server-install
|
|
||||||
cd action-server-install
|
|
||||||
git checkout main
|
|
||||||
|
|
||||||
- name: Setup server environment
|
|
||||||
uses: ./action-server-install
|
|
||||||
with:
|
|
||||||
install-php: 'true'
|
|
||||||
php-version: '8.5'
|
|
||||||
server-path: './server'
|
|
||||||
|
|
||||||
- name: Create test repositories
|
|
||||||
run: |
|
|
||||||
# Create module-a (no dependencies)
|
|
||||||
mkdir -p /tmp/test-repos/module-a
|
|
||||||
cd /tmp/test-repos/module-a
|
|
||||||
git init
|
|
||||||
git config user.email "test@example.com"
|
|
||||||
git config user.name "Test User"
|
|
||||||
cat > composer.json << 'EOF'
|
|
||||||
{
|
|
||||||
"name": "test/module-a",
|
|
||||||
"description": "Module A",
|
|
||||||
"require": {}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
git add . && git commit -m "Initial commit"
|
|
||||||
|
|
||||||
# Create module-b (depends on module-a)
|
|
||||||
mkdir -p /tmp/test-repos/module-b
|
|
||||||
cd /tmp/test-repos/module-b
|
|
||||||
git init
|
|
||||||
git config user.email "test@example.com"
|
|
||||||
git config user.name "Test User"
|
|
||||||
cat > composer.json << 'EOF'
|
|
||||||
{
|
|
||||||
"name": "test/module-b",
|
|
||||||
"description": "Module B",
|
|
||||||
"require": {}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
git add . && git commit -m "Initial commit"
|
|
||||||
|
|
||||||
# Create module-c (depends on module-b)
|
|
||||||
mkdir -p /tmp/test-repos/module-c
|
|
||||||
cd /tmp/test-repos/module-c
|
|
||||||
git init
|
|
||||||
git config user.email "test@example.com"
|
|
||||||
git config user.name "Test User"
|
|
||||||
cat > composer.json << 'EOF'
|
|
||||||
{
|
|
||||||
"name": "test/module-c",
|
|
||||||
"description": "Module C",
|
|
||||||
"require": {}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
git add . && git commit -m "Initial commit"
|
|
||||||
|
|
||||||
- name: Install modules with dependencies
|
|
||||||
id: install
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
modules: |
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": "module-c",
|
|
||||||
"repo": "file:///tmp/test-repos/module-c",
|
|
||||||
"dependencies": ["module-b"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "module-a",
|
|
||||||
"repo": "file:///tmp/test-repos/module-a"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "module-b",
|
|
||||||
"repo": "file:///tmp/test-repos/module-b",
|
|
||||||
"dependencies": ["module-a"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
- name: Verify dependency order
|
|
||||||
run: |
|
|
||||||
INSTALLED="${{ steps.install.outputs.installed-modules }}"
|
|
||||||
echo "Installation order: $INSTALLED"
|
|
||||||
|
|
||||||
# Verify all modules installed
|
|
||||||
for module in module-a module-b module-c; do
|
|
||||||
if [ ! -d "./modules/$module" ]; then
|
|
||||||
echo "::error::Module $module not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "./modules/$module/vendor" ]; then
|
|
||||||
echo "::error::Composer dependencies not installed for $module"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Verify order: module-a must come before module-b, module-b before module-c
|
|
||||||
echo "$INSTALLED" | grep -E "(module-a.*module-b.*module-c|module-a.*module-c)" || {
|
|
||||||
echo "::error::Installation order is incorrect: $INSTALLED"
|
|
||||||
echo "Expected: module-a installed before module-b and module-c"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "✓ Linear dependency installation verified"
|
|
||||||
|
|
||||||
# Test PHP module
|
# Test PHP module
|
||||||
test-php-module:
|
test-php-module:
|
||||||
name: PHP Module with Composer
|
name: PHP Module with Composer
|
||||||
@@ -229,15 +112,17 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout action-module-install
|
- name: Checkout action-module-install
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6.0.2
|
||||||
with:
|
with:
|
||||||
path: action-module-install
|
path: action-module-install
|
||||||
|
|
||||||
- name: Clone action-server-install
|
- name: Checkout action-server-install
|
||||||
run: |
|
uses: actions/checkout@v6.0.2
|
||||||
git clone https://git.ktrix.dev/Nodarx/action-server-install action-server-install
|
with:
|
||||||
cd action-server-install
|
repository: Nodarx/action-server-install
|
||||||
git checkout main
|
ref: main
|
||||||
|
path: action-server-install
|
||||||
|
github-server-url: https://git.ktrix.dev
|
||||||
|
|
||||||
- name: Setup PHP environment
|
- name: Setup PHP environment
|
||||||
uses: ./action-server-install
|
uses: ./action-server-install
|
||||||
@@ -284,7 +169,7 @@ jobs:
|
|||||||
git add . && git commit -m "Initial commit"
|
git add . && git commit -m "Initial commit"
|
||||||
|
|
||||||
- name: Install PHP module
|
- name: Install PHP module
|
||||||
uses: ./
|
uses: ./action-module-install
|
||||||
with:
|
with:
|
||||||
modules: |
|
modules: |
|
||||||
[
|
[
|
||||||
@@ -323,15 +208,17 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout action-module-install
|
- name: Checkout action-module-install
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6.0.2
|
||||||
with:
|
with:
|
||||||
path: action-module-install
|
path: action-module-install
|
||||||
|
|
||||||
- name: Clone action-server-install
|
- name: Checkout action-server-install
|
||||||
run: |
|
uses: actions/checkout@v6.0.2
|
||||||
git clone https://git.ktrix.dev/Nodarx/action-server-install action-server-install
|
with:
|
||||||
cd action-server-install
|
repository: Nodarx/action-server-install
|
||||||
git checkout main
|
ref: main
|
||||||
|
path: action-server-install
|
||||||
|
github-server-url: https://git.ktrix.dev
|
||||||
|
|
||||||
- name: Setup Node.js environment
|
- name: Setup Node.js environment
|
||||||
uses: ./action-server-install
|
uses: ./action-server-install
|
||||||
@@ -370,7 +257,7 @@ jobs:
|
|||||||
git add . && git commit -m "Initial commit"
|
git add . && git commit -m "Initial commit"
|
||||||
|
|
||||||
- name: Install Node.js module
|
- name: Install Node.js module
|
||||||
uses: ./
|
uses: ./action-module-install
|
||||||
with:
|
with:
|
||||||
modules: |
|
modules: |
|
||||||
[
|
[
|
||||||
@@ -388,9 +275,10 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check node_modules directory created
|
# Check npm install result (node_modules required only if production deps exist)
|
||||||
if [ ! -d "./modules/vue-module/node_modules" ]; then
|
DEP_COUNT=$(node -e 'const p=require("./modules/vue-module/package.json"); const c=Object.keys(p.dependencies||{}).length+Object.keys(p.optionalDependencies||{}).length; console.log(c);')
|
||||||
echo "::error::node_modules directory not found - npm install failed"
|
if [ "$DEP_COUNT" -gt 0 ] && [ ! -d "./modules/vue-module/node_modules" ]; then
|
||||||
|
echo "::error::node_modules directory not found for module with production dependencies"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -403,15 +291,17 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout action-module-install
|
- name: Checkout action-module-install
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6.0.2
|
||||||
with:
|
with:
|
||||||
path: action-module-install
|
path: action-module-install
|
||||||
|
|
||||||
- name: Clone action-server-install
|
- name: Checkout action-server-install
|
||||||
run: |
|
uses: actions/checkout@v6.0.2
|
||||||
git clone https://git.ktrix.dev/Nodarx/action-server-install action-server-install
|
with:
|
||||||
cd action-server-install
|
repository: Nodarx/action-server-install
|
||||||
git checkout main
|
ref: main
|
||||||
|
path: action-server-install
|
||||||
|
github-server-url: https://git.ktrix.dev
|
||||||
|
|
||||||
- name: Setup both PHP and Node.js
|
- name: Setup both PHP and Node.js
|
||||||
uses: ./action-server-install
|
uses: ./action-server-install
|
||||||
@@ -453,7 +343,7 @@ jobs:
|
|||||||
git add . && git commit -m "Initial commit"
|
git add . && git commit -m "Initial commit"
|
||||||
|
|
||||||
- name: Install mixed modules
|
- name: Install mixed modules
|
||||||
uses: ./
|
uses: ./action-module-install
|
||||||
with:
|
with:
|
||||||
modules: |
|
modules: |
|
||||||
[
|
[
|
||||||
@@ -475,134 +365,24 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify Node module
|
# Verify Node module (node_modules required only if production deps exist)
|
||||||
if [ ! -d "./modules/frontend/node_modules" ]; then
|
DEP_COUNT=$(node -e 'const p=require("./modules/frontend/package.json"); const c=Object.keys(p.dependencies||{}).length+Object.keys(p.optionalDependencies||{}).length; console.log(c);')
|
||||||
echo "::error::Frontend npm dependencies not installed"
|
if [ "$DEP_COUNT" -gt 0 ] && [ ! -d "./modules/frontend/node_modules" ]; then
|
||||||
|
echo "::error::Frontend module has production dependencies but node_modules is missing"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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@v4
|
|
||||||
with:
|
|
||||||
path: action-module-install
|
|
||||||
|
|
||||||
- name: Clone action-server-install
|
|
||||||
run: |
|
|
||||||
git clone https://git.ktrix.dev/Nodarx/action-server-install action-server-install
|
|
||||||
cd action-server-install
|
|
||||||
git checkout main
|
|
||||||
|
|
||||||
- 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: ./
|
|
||||||
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: ./
|
|
||||||
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: ./
|
|
||||||
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:
|
||||||
@@ -613,19 +393,15 @@ 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" ] || \
|
[ "${{ needs.test-mixed-modules.result }}" != "success" ]; then
|
||||||
[ "${{ 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
|
||||||
|
|||||||
31
action.yml
31
action.yml
@@ -153,12 +153,13 @@ runs:
|
|||||||
echo "$MODULES_JSON" | jq -r '.[].name' > "$NODES_FILE"
|
echo "$MODULES_JSON" | jq -r '.[].name' > "$NODES_FILE"
|
||||||
|
|
||||||
# Create dependency edges (dependent -> dependency)
|
# Create dependency edges (dependent -> dependency)
|
||||||
|
# For each module with dependencies, create "module dep" pairs
|
||||||
echo "$MODULES_JSON" | jq -r '
|
echo "$MODULES_JSON" | jq -r '
|
||||||
.[] |
|
.[] |
|
||||||
select(.dependencies != null and (.dependencies | length) > 0) |
|
select(.dependencies != null and (.dependencies | length) > 0) |
|
||||||
.name as $module |
|
. as $item |
|
||||||
.dependencies[] |
|
.dependencies[] |
|
||||||
"\($module) \(.)"
|
($item.name + " " + .)
|
||||||
' > "$EDGES_FILE"
|
' > "$EDGES_FILE"
|
||||||
|
|
||||||
# Perform topological sort
|
# Perform topological sort
|
||||||
@@ -211,26 +212,43 @@ runs:
|
|||||||
')
|
')
|
||||||
|
|
||||||
REPO_URL=$(echo "$MODULE_INFO" | jq -r '.repo')
|
REPO_URL=$(echo "$MODULE_INFO" | jq -r '.repo')
|
||||||
BRANCH=$(echo "$MODULE_INFO" | jq -r '.branch // "main"')
|
BRANCH=$(echo "$MODULE_INFO" | jq -r '.branch // empty')
|
||||||
MODULE_PATH="$INSTALL_PATH/$MODULE_NAME"
|
MODULE_PATH="$INSTALL_PATH/$MODULE_NAME"
|
||||||
|
|
||||||
echo "Repository: $REPO_URL"
|
echo "Repository: $REPO_URL"
|
||||||
|
if [ -n "$BRANCH" ]; then
|
||||||
echo "Branch: $BRANCH"
|
echo "Branch: $BRANCH"
|
||||||
|
else
|
||||||
|
echo "Branch: (repository default)"
|
||||||
|
fi
|
||||||
echo "Path: $MODULE_PATH"
|
echo "Path: $MODULE_PATH"
|
||||||
|
|
||||||
# Clone the repository
|
# Clone the repository
|
||||||
if [ -d "$MODULE_PATH" ]; then
|
if [ -d "$MODULE_PATH" ]; then
|
||||||
echo "::warning::Directory $MODULE_PATH already exists, pulling latest changes..."
|
echo "::warning::Directory $MODULE_PATH already exists, pulling latest changes..."
|
||||||
cd "$MODULE_PATH"
|
cd "$MODULE_PATH"
|
||||||
|
if [ -n "$BRANCH" ]; then
|
||||||
git pull origin "$BRANCH" || echo "::warning::Pull failed, continuing with existing code"
|
git pull origin "$BRANCH" || echo "::warning::Pull failed, continuing with existing code"
|
||||||
|
else
|
||||||
|
git pull || echo "::warning::Pull failed, continuing with existing code"
|
||||||
|
fi
|
||||||
cd - > /dev/null
|
cd - > /dev/null
|
||||||
else
|
else
|
||||||
|
if [ -n "$BRANCH" ]; then
|
||||||
if git clone --branch "$BRANCH" --depth 1 "$REPO_URL" "$MODULE_PATH"; then
|
if git clone --branch "$BRANCH" --depth 1 "$REPO_URL" "$MODULE_PATH"; then
|
||||||
echo "✓ Cloned $MODULE_NAME successfully"
|
echo "✓ Cloned $MODULE_NAME successfully"
|
||||||
else
|
else
|
||||||
echo "::error::Failed to clone $MODULE_NAME from $REPO_URL (branch: $BRANCH)"
|
echo "::error::Failed to clone $MODULE_NAME from $REPO_URL (branch: $BRANCH)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
if git clone --depth 1 "$REPO_URL" "$MODULE_PATH"; then
|
||||||
|
echo "✓ Cloned $MODULE_NAME successfully"
|
||||||
|
else
|
||||||
|
echo "::error::Failed to clone $MODULE_NAME from $REPO_URL"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -375,12 +393,17 @@ runs:
|
|||||||
|
|
||||||
# Verify npm installation
|
# Verify npm installation
|
||||||
if [ -f "$MODULE_PATH/package.json" ]; then
|
if [ -f "$MODULE_PATH/package.json" ]; then
|
||||||
|
NODE_DEP_COUNT=$(jq -r '((.dependencies // {}) | length) + ((.optionalDependencies // {}) | length)' "$MODULE_PATH/package.json" 2>/dev/null || echo "0")
|
||||||
|
if [ "$NODE_DEP_COUNT" -gt 0 ]; then
|
||||||
if [ -d "$MODULE_PATH/node_modules" ]; then
|
if [ -d "$MODULE_PATH/node_modules" ]; then
|
||||||
echo " ✓ Node dependencies installed (node_modules/ exists)"
|
echo " ✓ Node dependencies installed (node_modules/ exists)"
|
||||||
else
|
else
|
||||||
echo "::error::package.json exists but node_modules/ directory not found in $MODULE_NAME"
|
echo "::error::package.json has production dependencies but node_modules/ directory not found in $MODULE_NAME"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo " ✓ Node module has no production dependencies (node_modules/ not required)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " ✓ $MODULE_NAME verified"
|
echo " ✓ $MODULE_NAME verified"
|
||||||
|
|||||||
Reference in New Issue
Block a user