b6123d6ee11714bf3b5b9e906d1bb2c3236839eb
All checks were successful
Test Action / Test Node (push) Successful in 18s
Test Action / Test nginx (push) Successful in 21s
Test Action / Test Custom Server Path (push) Successful in 25s
Test Action / Test Build Command (push) Successful in 27s
Test Action / Test PHP (push) Successful in 1m8s
Test Action / Test All Components (push) Successful in 1m43s
Reviewed-on: #2
Server Install Action
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)
- ✅ Automatic dependency installation (npm, composer)
- ✅ Custom build commands
- ✅ Post-installation scripts
- ✅ Comprehensive error handling and logging
Usage
Node.js Only (Unit Tests)
name: Node.js Unit Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install Server with Node.js
uses: Nodarx/action-server-install@v1
with:
install-node: 'true'
node-version: '24'
- name: Run tests
run: |
cd server
npm test
PHP Only (Unit Tests)
name: PHP Unit Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install Server with PHP
uses: Nodarx/action-server-install@v1
with:
install-php: 'true'
php-version: '8.5'
- name: Run tests
run: |
cd server
./vendor/bin/phpunit
Full Integration Test (All Components)
name: Integration Tests
on: [push]
jobs:
integration:
runs-on: ubuntu-latest
steps:
- name: Install Server with All Components
uses: Nodarx/action-server-install@v1
with:
install-node: 'true'
install-php: 'true'
install-nginx: 'true'
node-version: '24'
php-version: '8.5'
- name: Run integration tests
run: |
cd server
npm run test:integration
With Custom nginx Configuration
- name: Install Server with nginx
uses: Nodarx/action-server-install@v1
with:
install-nginx: 'true'
nginx-config: './config/nginx.conf'
Advanced Example with All Options
name: Deploy Server
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Install Server
uses: Nodarx/action-server-install@v1
with:
server-path: './server'
install-node: 'true'
install-php: 'true'
install-nginx: 'true'
node-version: '20'
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'
post-install-script: './scripts/post-install.sh'
Inputs
Component Selection
| Input | Description | Required | Default |
|---|---|---|---|
install-node |
Install Node.js environment | No | false |
install-php |
Install PHP environment | No | false |
install-nginx |
Install nginx web server | No | false |
Note: At least one component must be enabled.
General Configuration
| Input | Description | Required | Default |
|---|---|---|---|
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 | '' |
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 | 24 |
PHP Configuration
| Input | Description | Required | Default |
|---|---|---|---|
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
| Input | Description | Required | Default |
|---|---|---|---|
nginx-config |
Path to nginx configuration file | No | '' |
Outputs
| Output | Description |
|---|---|
install-status |
Status of the installation (success/failure) |
install-path |
Path where the server was installed |
node-installed |
Whether Node.js was installed (true/false) |
php-installed |
Whether PHP was installed (true/false) |
nginx-installed |
Whether nginx was installed (true/false) |
Best Practices
-
Enable only needed components: For faster test runs
# JS unit tests - Node.js only - uses: Nodarx/action-server-install@v1 with: install-node: 'true' -
Pin to specific versions: Use commit SHA or version tag
uses: Nodarx/action-server-install@v1.0.0 -
Cache dependencies: Combine with caching for faster builds
- uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('server/package-lock.json') }} - uses: Nodarx/action-server-install@v1 with: install-node: 'true' -
Test different component combinations: Matrix testing
strategy: matrix: include: - name: Node Tests install-node: 'true' install-php: 'false' - name: PHP Tests install-node: 'false' install-php: 'true' - name: Integration Tests install-node: 'true' install-php: 'true'
License
This project is licensed under the MIT License - see the LICENSE file for details.
Languages
Shell
100%