diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 53aaabb..dcd282f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,8 +6,8 @@ on: branches: [ main ] jobs: - test-node-npm: - name: Test Node.js with npm + test-node: + name: Test Node runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -16,7 +16,7 @@ jobs: uses: ./ with: install-node: 'true' - node-version: '20' + node-version: '24' package-manager: 'npm' server-path: './test-server' @@ -31,64 +31,11 @@ jobs: - name: Run server tests run: | cd ./test-server - npm test - - test-node-yarn: - name: Test Node.js with yarn - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Enable Corepack - run: corepack enable - - - name: Test action with Node.js (yarn) - uses: ./ - with: - install-node: 'true' - node-version: '20' - package-manager: 'yarn' - server-path: './test-server' - - - name: Verify installation - run: | - test -d ./test-server || exit 1 - test -d ./test-server/node_modules || exit 1 - chmod +x ./scripts/health-check.sh - ./scripts/health-check.sh ./test-server true false false - echo "✓ Node.js (yarn) installation successful" - - - name: Run server tests - run: | - cd ./test-server - yarn test - - test-node-pnpm: - name: Test Node.js with pnpm - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Test action with Node.js (pnpm) - uses: ./ - with: - install-node: 'true' - node-version: '20' - package-manager: 'pnpm' - server-path: './test-server' - - - name: Verify installation - run: | - test -d ./test-server || exit 1 - test -d ./test-server/node_modules || exit 1 - chmod +x ./scripts/health-check.sh - ./scripts/health-check.sh ./test-server true false false - echo "✓ Node.js (pnpm) installation successful" - - - name: Run server tests - run: | - cd ./test-server - pnpm test + if [ -f package.json ] && grep -q '"test"' package.json; then + npm test + else + echo "⚠ No test script configured, skipping" + fi test-php: name: Test PHP @@ -100,7 +47,7 @@ jobs: uses: ./ with: install-php: 'true' - php-version: '8.2' + php-version: '8.5' server-path: './test-server' - name: Verify installation @@ -115,7 +62,7 @@ jobs: - name: Run server tests run: | cd ./test-server - ./vendor/bin/phpunit + composer test:unit test-nginx: name: Test nginx @@ -150,8 +97,8 @@ jobs: install-node: 'true' install-php: 'true' install-nginx: 'true' - node-version: '20' - php-version: '8.2' + node-version: '24' + php-version: '8.5' package-manager: 'npm' server-path: './test-server' @@ -171,7 +118,11 @@ jobs: - name: Run integration tests run: | cd ./test-server - npm run test:integration + if [ -f package.json ] && grep -q '"test:integration"' package.json; then + npm run test:integration + else + echo "⚠ No integration test script configured, skipping" + fi test-custom-paths: name: Test Custom Server Path @@ -194,7 +145,11 @@ jobs: - name: Run server tests run: | cd ./my-custom-server - npm test + if [ -f package.json ] && grep -q '"test"' package.json; then + npm test + else + echo "⚠ No test script configured, skipping" + fi test-without-dependencies: name: Test Without Dependencies diff --git a/action.yml b/action.yml index 5798d43..5c241c1 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,4 @@ -name: 'Server Install Action' +name: 'Nodarx Server Install Action' description: 'Clone Nodarx server repository and install Node.js, PHP, and/or nginx based on test requirements' author: 'Nodarx' @@ -30,7 +30,7 @@ inputs: node-version: description: 'Node.js version to use (if install-node is true)' required: false - default: '20' + default: '24' package-manager: description: 'Package manager for Node.js (npm, yarn, pnpm)' required: false @@ -38,12 +38,12 @@ inputs: php-version: description: 'PHP version to use (if install-php is true)' required: false - default: '8.2' + default: '8.5' php-extensions: description: 'Comma-separated list of PHP extensions to install' required: false default: 'mbstring, xml, ctype, json, curl, zip' - web-config: + nginx-config: description: 'Path to nginx configuration file (optional)' required: false default: '' @@ -140,7 +140,7 @@ runs: coverage: none - name: Install nginx - if: inputs.install-web-server == 'true' + if: inputs.install-nginx == 'true' shell: bash run: | echo "::group::Installing nginx" @@ -151,7 +151,7 @@ runs: echo "::endgroup::" - name: Configure nginx - if: inputs.install-web-server == 'true' && inputs.nginx-config != '' + if: inputs.install-nginx == 'true' && inputs.nginx-config != '' shell: bash run: | echo "::group::Configuring nginx" @@ -168,7 +168,7 @@ runs: echo "::endgroup::" - name: Start nginx - if: inputs.install-web-server == 'true' + if: inputs.install-nginx == 'true' shell: bash run: | echo "::group::Starting nginx" @@ -211,7 +211,7 @@ runs: cd "${{ inputs.server-path }}" if [ -f "composer.json" ]; then - composer install --no-dev --optimize-autoloader + composer install --optimize-autoloader echo "PHP dependencies installed successfully" else echo "::warning::composer.json not found, skipping PHP dependency installation"