From 58cd5d025e0b4fa31cd7377a44833740c8b0c08e Mon Sep 17 00:00:00 2001 From: Sebastian Krupinski Date: Sat, 14 Feb 2026 16:35:27 -0500 Subject: [PATCH] chore: update name Signed-off-by: Sebastian Krupinski --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 109 +++++++------------------ QUICK_START.md | 149 ---------------------------------- README.md | 127 ++++------------------------- action.yml | 102 +++++++---------------- 5 files changed, 75 insertions(+), 414 deletions(-) delete mode 100644 QUICK_START.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e5abc0..c48d1fb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6.0.2 with: fetch-depth: 0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 53aaabb..9f83280 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,18 +6,17 @@ 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 + - uses: actions/checkout@v6.0.2 - name: Test action with Node.js (npm) uses: ./ with: install-node: 'true' - node-version: '20' - package-manager: 'npm' + node-version: '24' server-path: './test-server' - name: Verify installation @@ -31,76 +30,19 @@ 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 + npm run test:unit test-php: name: Test PHP runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 - name: Test action with PHP uses: ./ with: install-php: 'true' - php-version: '8.2' + php-version: '8.5' server-path: './test-server' - name: Verify installation @@ -115,13 +57,13 @@ jobs: - name: Run server tests run: | cd ./test-server - ./vendor/bin/phpunit + composer test:unit test-nginx: name: Test nginx runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 - name: Test action with nginx uses: ./ @@ -133,7 +75,8 @@ jobs: run: | test -d ./test-server || exit 1 nginx -v - sudo systemctl status nginx --no-pager + # Verify nginx is running + pgrep nginx || exit 1 chmod +x ./scripts/health-check.sh ./scripts/health-check.sh ./test-server false false true echo "✓ nginx installation successful" @@ -142,7 +85,7 @@ jobs: name: Test All Components runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 - name: Test action with all components uses: ./ @@ -150,9 +93,8 @@ jobs: install-node: 'true' install-php: 'true' install-nginx: 'true' - node-version: '20' - php-version: '8.2' - package-manager: 'npm' + node-version: '24' + php-version: '8.5' server-path: './test-server' - name: Verify installation @@ -171,13 +113,17 @@ 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 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 - name: Test action with custom path uses: ./ @@ -194,13 +140,17 @@ 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 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 - name: Test action without installing dependencies uses: ./ @@ -224,7 +174,7 @@ jobs: name: Test Build Command runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 - name: Test action with build command uses: ./ @@ -235,6 +185,5 @@ jobs: - name: Verify build run: | - test -f ./test-server/build.log || exit 1 - grep -q "Build complete" ./test-server/build.log || exit 1 - echo "✓ Build command executed successfully" + cd ./test-server + npm run dev diff --git a/QUICK_START.md b/QUICK_START.md deleted file mode 100644 index 2cd0c0a..0000000 --- a/QUICK_START.md +++ /dev/null @@ -1,149 +0,0 @@ -# Quick Start Guide - -Get started with the Server Install Action in minutes! - -## 1. Choose Your Components - -The action installs the Nodarx server and can set up Node.js, PHP, and/or nginx based on your needs. - -## 2. Basic Examples - -### Node.js Only (Unit Tests) - -```yaml -name: Node.js Tests -on: [push] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: Nodarx/action-server-install@v2 - with: - install-node: 'true' -``` - -### PHP Only (Unit Tests) - -```yaml -name: PHP Tests -on: [push] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: Nodarx/action-server-install@v2 - with: - install-php: 'true' -``` - -### All Components (Integration Tests) - -```yaml -name: Integration Tests -on: [push] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: Nodarx/action-server-install@v2 - with: - install-node: 'true' - install-php: 'true' - install-nginx: 'true' -``` - -## 3. Customize Components - -### Node.js with Specific Version - -```yaml -- uses: Nodarx/action-server-install@v2 - with: - install-node: 'true' - node-version: '20' - package-manager: 'pnpm' # or 'npm', 'yarn' -``` - -### PHP with Custom Extensions - -```yaml -- uses: Nodarx/action-server-install@v2 - with: - install-php: 'true' - php-version: '8.2' - php-extensions: 'mbstring, xml, pdo, pdo_mysql' -``` - -### nginx with Custom Config - -```yaml -- uses: Nodarx/action-server-install@v2 - with: - install-nginx: 'true' - nginx-config: './config/nginx.conf' -``` - -## 4. Component Combinations - -You can enable any combination of components: - -```yaml -# Node.js + nginx (for frontend tests) -install-node: 'true' -install-nginx: 'true' - -# PHP + nginx (for backend tests) -install-php: 'true' -install-nginx: 'true' - -# All three (full integration) -install-node: 'true' -install-php: 'true' -install-nginx: 'true' -``` - -## 5. Common Options - -```yaml -- uses: Nodarx/action-server-install@v2 - with: - # Components (at least one required) - install-node: 'true' # Install Node.js - install-php: 'true' # Install PHP - install-nginx: 'true' # Install nginx - - # Server configuration - server-path: './server' # Where to clone (default) - - # Node.js options (if install-node: true) - node-version: '20' - package-manager: 'npm' - - # PHP options (if install-php: true) - php-version: '8.2' - php-extensions: 'mbstring, xml, ctype' - - # nginx options (if install-nginx: true) - nginx-config: './nginx.conf' - - # General options - install-dependencies: 'true' - build-command: 'npm run build' - env-file: '.env.production' - post-install-script: './scripts/setup.sh' -``` - -- Check the [README.md](README.md) for detailed documentation -- See [test workflow](.github/workflows/test.yml) for more usage examples -- Read [CONTRIBUTING.md](CONTRIBUTING.md) to contribute -- Report issues or request features in [Issues](../../issues) - -## Need Help? - -- 📖 [Full Documentation](README.md) -- 💬 [Discussions](../../discussions) -- 🐛 [Report a Bug](../../issues/new?template=bug_report.md) -- ✨ [Request a Feature](../../issues/new?template=feature_request.md) diff --git a/README.md b/README.md index 045a5da..54dbef0 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,12 @@ # Server Install Action -A GitHub Action to clone the Nodarx server repository and install Node.js, PHP, and/or nginx based on test requirements. Perfect for creating lean test environments (e.g., JS tests install only Node) while supporting full integration tests with all components. +A action to clone the Nodarx server repository and install Node.js, PHP, and/or nginx based on test requirements. Perfect for creating lean test environments (e.g., JS tests install only Node) while supporting full integration tests with all components. ## Features - ✅ Clone Nodarx server repository with submodule support - ✅ Flexible component installation (Node.js, PHP, nginx) -- ✅ Support for multiple Node.js package managers (npm, yarn, pnpm) - ✅ Automatic dependency installation (npm, composer) -- ✅ Environment file configuration - ✅ Custom build commands - ✅ Post-installation scripts - ✅ Comprehensive error handling and logging @@ -26,11 +24,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Server with Node.js - uses: Nodarx/action-server-install@v2 + uses: Nodarx/action-server-install@v1 with: install-node: 'true' - node-version: '20' - package-manager: 'npm' + node-version: '24' - name: Run tests run: | @@ -49,10 +46,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Server with PHP - uses: Nodarx/action-server-install@v2 + uses: Nodarx/action-server-install@v1 with: install-php: 'true' - php-version: '8.2' + php-version: '8.5' - name: Run tests run: | @@ -71,13 +68,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Server with All Components - uses: Nodarx/action-server-install@v2 + uses: Nodarx/action-server-install@v1 with: install-node: 'true' install-php: 'true' install-nginx: 'true' - node-version: '20' - php-version: '8.2' + node-version: '24' + php-version: '8.5' - name: Run integration tests run: | @@ -89,7 +86,7 @@ jobs: ```yaml - name: Install Server with nginx - uses: Nodarx/action-server-install@v2 + uses: Nodarx/action-server-install@v1 with: install-nginx: 'true' nginx-config: './config/nginx.conf' @@ -105,26 +102,19 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - name: Create environment file - run: | - echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" > .env.production - echo "API_KEY=${{ secrets.API_KEY }}" >> .env.production - - name: Install Server - uses: Nodarx/action-server-install@v2 + uses: Nodarx/action-server-install@v1 with: server-path: './server' install-node: 'true' install-php: 'true' install-nginx: 'true' node-version: '20' - package-manager: 'pnpm' php-version: '8.2' php-extensions: 'mbstring, xml, ctype, json, curl, zip, pdo, pdo_mysql' nginx-config: './config/nginx.conf' install-dependencies: 'true' build-command: 'npm run build' - env-file: '.env.production' post-install-script: './scripts/post-install.sh' ``` @@ -147,21 +137,20 @@ jobs: | `server-path` | Path where the server will be cloned/installed | No | `./server` | | `install-dependencies` | Whether to install dependencies (npm/composer) | No | `true` | | `build-command` | Custom build command to run after install | No | `''` | -| `env-file` | Path to environment file to copy (.env) | No | `''` | | `post-install-script` | Custom script to run after installation | No | `''` | ### Node.js Configuration | Input | Description | Required | Default | |-------|-------------|----------|---------| -| `node-version` | Node.js version to use | No | `20` | -| `package-manager` | Package manager for Node.js (npm, yarn, pnpm) | No | `npm` | +| `node-version` | Node.js version to use | No | `24` | + ### PHP Configuration | Input | Description | Required | Default | |-------|-------------|----------|---------| -| `php-version` | PHP version to use | No | `8.2` | +| `php-version` | PHP version to use | No | `8.5` | | `php-extensions` | Comma-separated list of PHP extensions to install | No | `mbstring, xml, ctype, json, curl, zip` | ### nginx Configuration @@ -180,46 +169,19 @@ jobs: | `php-installed` | Whether PHP was installed (true/false) | | `nginx-installed` | Whether nginx was installed (true/false) | -## Component Details - -### Server Repository -- Clones from: `https://git.ktrix.dev/Nodarx/server` -- Includes recursive submodule initialization -- Updates existing directory if already present - -### Node.js -- Uses `actions/setup-node@v4` for Node.js setup -- **npm**: Uses `npm ci` (with fallback to `npm install`) -- **yarn**: Uses `yarn install --frozen-lockfile` (with fallback) -- **pnpm**: Uses `pnpm install --frozen-lockfile` (with fallback, requires `pnpm/action-setup`) -- Default version: Node.js 20 (LTS) - -### PHP -- Uses `shivammathur/setup-php@v2` for PHP setup -- Default version: PHP 8.2 -- Default extensions: mbstring, xml, ctype, json, curl, zip -- **composer**: Uses `composer install --no-dev --optimize-autoloader` -- Skips gracefully if no `composer.json` found - -### nginx -- Installs via system package manager (`apt-get`) -- Supports optional custom configuration file -- Automatically starts the nginx service -- Validates configuration before reload - ## Best Practices 1. **Enable only needed components**: For faster test runs ```yaml # JS unit tests - Node.js only - - uses: Nodarx/action-server-install@v2 + - uses: Nodarx/action-server-install@v1 with: install-node: 'true' ``` 2. **Pin to specific versions**: Use commit SHA or version tag ```yaml - uses: Nodarx/action-server-install@v2.0.0 + uses: Nodarx/action-server-install@v1.0.0 ``` 3. **Cache dependencies**: Combine with caching for faster builds @@ -229,24 +191,12 @@ jobs: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('server/package-lock.json') }} - - uses: Nodarx/action-server-install@v2 + - uses: Nodarx/action-server-install@v1 with: install-node: 'true' ``` -4. **Secure secrets**: Use GitHub Secrets for sensitive variables - ```yaml - - name: Create .env file - run: | - echo "API_KEY=${{ secrets.API_KEY }}" > .env.production - - - uses: Nodarx/action-server-install@v2 - with: - install-node: 'true' - env-file: '.env.production' - ``` - -5. **Test different component combinations**: Matrix testing +4. **Test different component combinations**: Matrix testing ```yaml strategy: matrix: @@ -262,49 +212,6 @@ jobs: install-php: 'true' ``` -## Development - -### Local Testing - -To test this action locally, you can use [act](https://github.com/nektos/act): - -```bash -act -j test -W .github/workflows/test.yml -``` - -### Contributing - -1. Fork the repository -2. Create a feature branch (`git checkout -b feature/amazing-feature`) -3. Commit your changes (`git commit -m 'Add amazing feature'`) -4. Push to the branch (`git push origin feature/amazing-feature`) -5. Open a Pull Request - -## Versioning - -This action follows [Semantic Versioning](https://semver.org/). For the versions available, see the [tags on this repository](../../tags). - -### Major Version Tags - -Major version tags (v1, v2, etc.) are maintained to point to the latest minor/patch release within that major version: - -```yaml -uses: Nodarx/action-server-install@v1 # always latest v1.x.x -uses: Nodarx/action-server-install@v1.2 # always latest v1.2.x -uses: Nodarx/action-server-install@v1.2.3 # exact version -``` - ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. - -## Support - -If you encounter any issues or have questions: -- Open an [issue](../../issues) -- Check [existing discussions](../../discussions) - -## Acknowledgments - -- Inspired by GitHub's official actions -- Built with the GitHub Actions community diff --git a/action.yml b/action.yml index 5798d43..dea58a3 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,20 +30,16 @@ inputs: node-version: description: 'Node.js version to use (if install-node is true)' required: false - default: '20' - package-manager: - description: 'Package manager for Node.js (npm, yarn, pnpm)' - required: false - default: 'npm' + default: '24' 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: '' @@ -51,10 +47,6 @@ inputs: description: 'Custom build command to run after install' required: false default: '' - env-file: - description: 'Path to environment file to copy (.env)' - required: false - default: '' post-install-script: description: 'Custom script to run after installation' required: false @@ -95,7 +87,7 @@ runs: echo "Server path: ${{ inputs.server-path }}" echo "Components to install:" - [ "${{ inputs.install-node }}" == "true" ] && echo " ✓ Node.js ${{ inputs.node-version }} (${{ inputs.package-manager }})" + [ "${{ inputs.install-node }}" == "true" ] && echo " ✓ Node.js ${{ inputs.node-version }}" [ "${{ inputs.install-php }}" == "true" ] && echo " ✓ PHP ${{ inputs.php-version }}" [ "${{ inputs.install-nginx }}" == "true" ] && echo " ✓ nginx" echo "Install dependencies: ${{ inputs.install-dependencies }}" @@ -118,21 +110,15 @@ runs: echo "Repository cloned/updated successfully" echo "::endgroup::" - - name: Setup Node.js + - name: Setup Node if: inputs.install-node == 'true' - uses: actions/setup-node@v4 + uses: actions/setup-node@v6.2.0 with: node-version: ${{ inputs.node-version }} - - name: Setup pnpm - if: inputs.install-node == 'true' && inputs.package-manager == 'pnpm' - uses: pnpm/action-setup@v2 - with: - version: 8 - - name: Setup PHP if: inputs.install-php == 'true' - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@v2.36.0 with: php-version: ${{ inputs.php-version }} extensions: ${{ inputs.php-extensions }} @@ -140,18 +126,18 @@ runs: coverage: none - name: Install nginx - if: inputs.install-web-server == 'true' + if: inputs.install-nginx == 'true' shell: bash run: | echo "::group::Installing nginx" sudo apt-get update -qq sudo apt-get install -y nginx - echo "nginx installed successfully" + echo "✓ nginx installed successfully" nginx -v 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" @@ -159,8 +145,7 @@ runs: if [ -f "${{ inputs.nginx-config }}" ]; then sudo cp "${{ inputs.nginx-config }}" /etc/nginx/sites-available/default sudo nginx -t - sudo systemctl reload nginx - echo "nginx configured successfully" + echo "✓ nginx configured successfully" else echo "::warning::nginx config file not found: ${{ inputs.nginx-config }}" fi @@ -168,39 +153,29 @@ runs: echo "::endgroup::" - name: Start nginx - if: inputs.install-web-server == 'true' + if: inputs.install-nginx == 'true' shell: bash run: | echo "::group::Starting nginx" - sudo systemctl start nginx - sudo systemctl status nginx --no-pager || true - echo "nginx started successfully" + sudo nginx || echo "nginx may already be running" + # Verify nginx is working + if sudo nginx -t 2>/dev/null; then + echo "✓ nginx configuration valid" + fi + if pgrep nginx >/dev/null; then + echo "✓ nginx is running" + fi + echo "✓ nginx started successfully" echo "::endgroup::" - - name: Install Node.js dependencies + - name: Install Node dependencies if: inputs.install-node == 'true' && inputs.install-dependencies == 'true' shell: bash run: | - echo "::group::Installing Node.js dependencies" + echo "::group::Installing Node dependencies" cd "${{ inputs.server-path }}" - - case "${{ inputs.package-manager }}" in - npm) - npm ci || npm install - ;; - yarn) - yarn install --frozen-lockfile || yarn install - ;; - pnpm) - pnpm install --frozen-lockfile || pnpm install - ;; - *) - echo "::error::Unsupported package manager: ${{ inputs.package-manager }}" - exit 1 - ;; - esac - - echo "Node.js dependencies installed successfully" + npm ci || npm install + echo "✓ Node dependencies installed successfully" echo "::endgroup::" - name: Install PHP dependencies @@ -209,29 +184,8 @@ runs: run: | echo "::group::Installing PHP dependencies" cd "${{ inputs.server-path }}" - - if [ -f "composer.json" ]; then - composer install --no-dev --optimize-autoloader - echo "PHP dependencies installed successfully" - else - echo "::warning::composer.json not found, skipping PHP dependency installation" - fi - - echo "::endgroup::" - - - name: Copy environment file - if: inputs.env-file != '' - shell: bash - run: | - echo "::group::Setting up environment file" - - if [ -f "${{ inputs.env-file }}" ]; then - cp "${{ inputs.env-file }}" "${{ inputs.server-path }}/.env" - echo "Environment file copied successfully" - else - echo "::warning::Environment file not found: ${{ inputs.env-file }}" - fi - + composer install --optimize-autoloader + echo "✓ PHP dependencies installed successfully" echo "::endgroup::" - name: Run build command