chore: update name
Some checks failed
Test Action / Test PHP (pull_request) Failing after 11s
Test Action / Test Without Dependencies (pull_request) Failing after 6s
Test Action / Test Node (pull_request) Failing after 21s
Test Action / Test Custom Server Path (pull_request) Failing after 19s
Test Action / Test Build Command (pull_request) Failing after 17s
Test Action / Test All Components (pull_request) Failing after 31s
Test Action / Test nginx (pull_request) Failing after 54s
Some checks failed
Test Action / Test PHP (pull_request) Failing after 11s
Test Action / Test Without Dependencies (pull_request) Failing after 6s
Test Action / Test Node (pull_request) Failing after 21s
Test Action / Test Custom Server Path (pull_request) Failing after 19s
Test Action / Test Build Command (pull_request) Failing after 17s
Test Action / Test All Components (pull_request) Failing after 31s
Test Action / Test nginx (pull_request) Failing after 54s
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6.0.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
|||||||
109
.github/workflows/test.yml
vendored
109
.github/workflows/test.yml
vendored
@@ -6,18 +6,17 @@ on:
|
|||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-node-npm:
|
test-node:
|
||||||
name: Test Node.js with npm
|
name: Test Node
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with Node.js (npm)
|
- name: Test action with Node.js (npm)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
node-version: '20'
|
node-version: '24'
|
||||||
package-manager: 'npm'
|
|
||||||
server-path: './test-server'
|
server-path: './test-server'
|
||||||
|
|
||||||
- name: Verify installation
|
- name: Verify installation
|
||||||
@@ -31,76 +30,19 @@ jobs:
|
|||||||
- name: Run server tests
|
- name: Run server tests
|
||||||
run: |
|
run: |
|
||||||
cd ./test-server
|
cd ./test-server
|
||||||
npm test
|
npm run test:unit
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
test-php:
|
test-php:
|
||||||
name: Test PHP
|
name: Test PHP
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with PHP
|
- name: Test action with PHP
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
install-php: 'true'
|
install-php: 'true'
|
||||||
php-version: '8.2'
|
php-version: '8.5'
|
||||||
server-path: './test-server'
|
server-path: './test-server'
|
||||||
|
|
||||||
- name: Verify installation
|
- name: Verify installation
|
||||||
@@ -115,13 +57,13 @@ jobs:
|
|||||||
- name: Run server tests
|
- name: Run server tests
|
||||||
run: |
|
run: |
|
||||||
cd ./test-server
|
cd ./test-server
|
||||||
./vendor/bin/phpunit
|
composer test:unit
|
||||||
|
|
||||||
test-nginx:
|
test-nginx:
|
||||||
name: Test nginx
|
name: Test nginx
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with nginx
|
- name: Test action with nginx
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -133,7 +75,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
test -d ./test-server || exit 1
|
test -d ./test-server || exit 1
|
||||||
nginx -v
|
nginx -v
|
||||||
sudo systemctl status nginx --no-pager
|
# Verify nginx is running
|
||||||
|
pgrep nginx || exit 1
|
||||||
chmod +x ./scripts/health-check.sh
|
chmod +x ./scripts/health-check.sh
|
||||||
./scripts/health-check.sh ./test-server false false true
|
./scripts/health-check.sh ./test-server false false true
|
||||||
echo "✓ nginx installation successful"
|
echo "✓ nginx installation successful"
|
||||||
@@ -142,7 +85,7 @@ jobs:
|
|||||||
name: Test All Components
|
name: Test All Components
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with all components
|
- name: Test action with all components
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -150,9 +93,8 @@ jobs:
|
|||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
install-php: 'true'
|
install-php: 'true'
|
||||||
install-nginx: 'true'
|
install-nginx: 'true'
|
||||||
node-version: '20'
|
node-version: '24'
|
||||||
php-version: '8.2'
|
php-version: '8.5'
|
||||||
package-manager: 'npm'
|
|
||||||
server-path: './test-server'
|
server-path: './test-server'
|
||||||
|
|
||||||
- name: Verify installation
|
- name: Verify installation
|
||||||
@@ -171,13 +113,17 @@ jobs:
|
|||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: |
|
run: |
|
||||||
cd ./test-server
|
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:
|
test-custom-paths:
|
||||||
name: Test Custom Server Path
|
name: Test Custom Server Path
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with custom path
|
- name: Test action with custom path
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -194,13 +140,17 @@ jobs:
|
|||||||
- name: Run server tests
|
- name: Run server tests
|
||||||
run: |
|
run: |
|
||||||
cd ./my-custom-server
|
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:
|
test-without-dependencies:
|
||||||
name: Test Without Dependencies
|
name: Test Without Dependencies
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action without installing dependencies
|
- name: Test action without installing dependencies
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -224,7 +174,7 @@ jobs:
|
|||||||
name: Test Build Command
|
name: Test Build Command
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6.0.2
|
||||||
|
|
||||||
- name: Test action with build command
|
- name: Test action with build command
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -235,6 +185,5 @@ jobs:
|
|||||||
|
|
||||||
- name: Verify build
|
- name: Verify build
|
||||||
run: |
|
run: |
|
||||||
test -f ./test-server/build.log || exit 1
|
cd ./test-server
|
||||||
grep -q "Build complete" ./test-server/build.log || exit 1
|
npm run dev
|
||||||
echo "✓ Build command executed successfully"
|
|
||||||
|
|||||||
149
QUICK_START.md
149
QUICK_START.md
@@ -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)
|
|
||||||
127
README.md
127
README.md
@@ -1,14 +1,12 @@
|
|||||||
# Server Install Action
|
# 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
|
## Features
|
||||||
|
|
||||||
- ✅ Clone Nodarx server repository with submodule support
|
- ✅ Clone Nodarx server repository with submodule support
|
||||||
- ✅ Flexible component installation (Node.js, PHP, nginx)
|
- ✅ Flexible component installation (Node.js, PHP, nginx)
|
||||||
- ✅ Support for multiple Node.js package managers (npm, yarn, pnpm)
|
|
||||||
- ✅ Automatic dependency installation (npm, composer)
|
- ✅ Automatic dependency installation (npm, composer)
|
||||||
- ✅ Environment file configuration
|
|
||||||
- ✅ Custom build commands
|
- ✅ Custom build commands
|
||||||
- ✅ Post-installation scripts
|
- ✅ Post-installation scripts
|
||||||
- ✅ Comprehensive error handling and logging
|
- ✅ Comprehensive error handling and logging
|
||||||
@@ -26,11 +24,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install Server with Node.js
|
- name: Install Server with Node.js
|
||||||
uses: Nodarx/action-server-install@v2
|
uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
node-version: '20'
|
node-version: '24'
|
||||||
package-manager: 'npm'
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
@@ -49,10 +46,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install Server with PHP
|
- name: Install Server with PHP
|
||||||
uses: Nodarx/action-server-install@v2
|
uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-php: 'true'
|
install-php: 'true'
|
||||||
php-version: '8.2'
|
php-version: '8.5'
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
@@ -71,13 +68,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install Server with All Components
|
- name: Install Server with All Components
|
||||||
uses: Nodarx/action-server-install@v2
|
uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
install-php: 'true'
|
install-php: 'true'
|
||||||
install-nginx: 'true'
|
install-nginx: 'true'
|
||||||
node-version: '20'
|
node-version: '24'
|
||||||
php-version: '8.2'
|
php-version: '8.5'
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: |
|
run: |
|
||||||
@@ -89,7 +86,7 @@ jobs:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install Server with nginx
|
- name: Install Server with nginx
|
||||||
uses: Nodarx/action-server-install@v2
|
uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-nginx: 'true'
|
install-nginx: 'true'
|
||||||
nginx-config: './config/nginx.conf'
|
nginx-config: './config/nginx.conf'
|
||||||
@@ -105,26 +102,19 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
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
|
- name: Install Server
|
||||||
uses: Nodarx/action-server-install@v2
|
uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
server-path: './server'
|
server-path: './server'
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
install-php: 'true'
|
install-php: 'true'
|
||||||
install-nginx: 'true'
|
install-nginx: 'true'
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
package-manager: 'pnpm'
|
|
||||||
php-version: '8.2'
|
php-version: '8.2'
|
||||||
php-extensions: 'mbstring, xml, ctype, json, curl, zip, pdo, pdo_mysql'
|
php-extensions: 'mbstring, xml, ctype, json, curl, zip, pdo, pdo_mysql'
|
||||||
nginx-config: './config/nginx.conf'
|
nginx-config: './config/nginx.conf'
|
||||||
install-dependencies: 'true'
|
install-dependencies: 'true'
|
||||||
build-command: 'npm run build'
|
build-command: 'npm run build'
|
||||||
env-file: '.env.production'
|
|
||||||
post-install-script: './scripts/post-install.sh'
|
post-install-script: './scripts/post-install.sh'
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -147,21 +137,20 @@ jobs:
|
|||||||
| `server-path` | Path where the server will be cloned/installed | No | `./server` |
|
| `server-path` | Path where the server will be cloned/installed | No | `./server` |
|
||||||
| `install-dependencies` | Whether to install dependencies (npm/composer) | No | `true` |
|
| `install-dependencies` | Whether to install dependencies (npm/composer) | No | `true` |
|
||||||
| `build-command` | Custom build command to run after install | No | `''` |
|
| `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 | `''` |
|
| `post-install-script` | Custom script to run after installation | No | `''` |
|
||||||
|
|
||||||
### Node.js Configuration
|
### Node.js Configuration
|
||||||
|
|
||||||
| Input | Description | Required | Default |
|
| Input | Description | Required | Default |
|
||||||
|-------|-------------|----------|---------|
|
|-------|-------------|----------|---------|
|
||||||
| `node-version` | Node.js version to use | No | `20` |
|
| `node-version` | Node.js version to use | No | `24` |
|
||||||
| `package-manager` | Package manager for Node.js (npm, yarn, pnpm) | No | `npm` |
|
|
||||||
|
|
||||||
### PHP Configuration
|
### PHP Configuration
|
||||||
|
|
||||||
| Input | Description | Required | Default |
|
| 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` |
|
| `php-extensions` | Comma-separated list of PHP extensions to install | No | `mbstring, xml, ctype, json, curl, zip` |
|
||||||
|
|
||||||
### nginx Configuration
|
### nginx Configuration
|
||||||
@@ -180,46 +169,19 @@ jobs:
|
|||||||
| `php-installed` | Whether PHP was installed (true/false) |
|
| `php-installed` | Whether PHP was installed (true/false) |
|
||||||
| `nginx-installed` | Whether nginx 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
|
## Best Practices
|
||||||
|
|
||||||
1. **Enable only needed components**: For faster test runs
|
1. **Enable only needed components**: For faster test runs
|
||||||
```yaml
|
```yaml
|
||||||
# JS unit tests - Node.js only
|
# JS unit tests - Node.js only
|
||||||
- uses: Nodarx/action-server-install@v2
|
- uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Pin to specific versions**: Use commit SHA or version tag
|
2. **Pin to specific versions**: Use commit SHA or version tag
|
||||||
```yaml
|
```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
|
3. **Cache dependencies**: Combine with caching for faster builds
|
||||||
@@ -229,24 +191,12 @@ jobs:
|
|||||||
path: ~/.npm
|
path: ~/.npm
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('server/package-lock.json') }}
|
key: ${{ runner.os }}-node-${{ hashFiles('server/package-lock.json') }}
|
||||||
|
|
||||||
- uses: Nodarx/action-server-install@v2
|
- uses: Nodarx/action-server-install@v1
|
||||||
with:
|
with:
|
||||||
install-node: 'true'
|
install-node: 'true'
|
||||||
```
|
```
|
||||||
|
|
||||||
4. **Secure secrets**: Use GitHub Secrets for sensitive variables
|
4. **Test different component combinations**: Matrix testing
|
||||||
```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
|
|
||||||
```yaml
|
```yaml
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -262,49 +212,6 @@ jobs:
|
|||||||
install-php: 'true'
|
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
|
## License
|
||||||
|
|
||||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
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
|
|
||||||
|
|||||||
102
action.yml
102
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'
|
description: 'Clone Nodarx server repository and install Node.js, PHP, and/or nginx based on test requirements'
|
||||||
author: 'Nodarx'
|
author: 'Nodarx'
|
||||||
|
|
||||||
@@ -30,20 +30,16 @@ inputs:
|
|||||||
node-version:
|
node-version:
|
||||||
description: 'Node.js version to use (if install-node is true)'
|
description: 'Node.js version to use (if install-node is true)'
|
||||||
required: false
|
required: false
|
||||||
default: '20'
|
default: '24'
|
||||||
package-manager:
|
|
||||||
description: 'Package manager for Node.js (npm, yarn, pnpm)'
|
|
||||||
required: false
|
|
||||||
default: 'npm'
|
|
||||||
php-version:
|
php-version:
|
||||||
description: 'PHP version to use (if install-php is true)'
|
description: 'PHP version to use (if install-php is true)'
|
||||||
required: false
|
required: false
|
||||||
default: '8.2'
|
default: '8.5'
|
||||||
php-extensions:
|
php-extensions:
|
||||||
description: 'Comma-separated list of PHP extensions to install'
|
description: 'Comma-separated list of PHP extensions to install'
|
||||||
required: false
|
required: false
|
||||||
default: 'mbstring, xml, ctype, json, curl, zip'
|
default: 'mbstring, xml, ctype, json, curl, zip'
|
||||||
web-config:
|
nginx-config:
|
||||||
description: 'Path to nginx configuration file (optional)'
|
description: 'Path to nginx configuration file (optional)'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
@@ -51,10 +47,6 @@ inputs:
|
|||||||
description: 'Custom build command to run after install'
|
description: 'Custom build command to run after install'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
env-file:
|
|
||||||
description: 'Path to environment file to copy (.env)'
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
post-install-script:
|
post-install-script:
|
||||||
description: 'Custom script to run after installation'
|
description: 'Custom script to run after installation'
|
||||||
required: false
|
required: false
|
||||||
@@ -95,7 +87,7 @@ runs:
|
|||||||
|
|
||||||
echo "Server path: ${{ inputs.server-path }}"
|
echo "Server path: ${{ inputs.server-path }}"
|
||||||
echo "Components to install:"
|
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-php }}" == "true" ] && echo " ✓ PHP ${{ inputs.php-version }}"
|
||||||
[ "${{ inputs.install-nginx }}" == "true" ] && echo " ✓ nginx"
|
[ "${{ inputs.install-nginx }}" == "true" ] && echo " ✓ nginx"
|
||||||
echo "Install dependencies: ${{ inputs.install-dependencies }}"
|
echo "Install dependencies: ${{ inputs.install-dependencies }}"
|
||||||
@@ -118,21 +110,15 @@ runs:
|
|||||||
echo "Repository cloned/updated successfully"
|
echo "Repository cloned/updated successfully"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node
|
||||||
if: inputs.install-node == 'true'
|
if: inputs.install-node == 'true'
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version: ${{ inputs.node-version }}
|
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
|
- name: Setup PHP
|
||||||
if: inputs.install-php == 'true'
|
if: inputs.install-php == 'true'
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2.36.0
|
||||||
with:
|
with:
|
||||||
php-version: ${{ inputs.php-version }}
|
php-version: ${{ inputs.php-version }}
|
||||||
extensions: ${{ inputs.php-extensions }}
|
extensions: ${{ inputs.php-extensions }}
|
||||||
@@ -140,18 +126,18 @@ runs:
|
|||||||
coverage: none
|
coverage: none
|
||||||
|
|
||||||
- name: Install nginx
|
- name: Install nginx
|
||||||
if: inputs.install-web-server == 'true'
|
if: inputs.install-nginx == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Installing nginx"
|
echo "::group::Installing nginx"
|
||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
sudo apt-get install -y nginx
|
sudo apt-get install -y nginx
|
||||||
echo "nginx installed successfully"
|
echo "✓ nginx installed successfully"
|
||||||
nginx -v
|
nginx -v
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Configure nginx
|
- name: Configure nginx
|
||||||
if: inputs.install-web-server == 'true' && inputs.nginx-config != ''
|
if: inputs.install-nginx == 'true' && inputs.nginx-config != ''
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Configuring nginx"
|
echo "::group::Configuring nginx"
|
||||||
@@ -159,8 +145,7 @@ runs:
|
|||||||
if [ -f "${{ inputs.nginx-config }}" ]; then
|
if [ -f "${{ inputs.nginx-config }}" ]; then
|
||||||
sudo cp "${{ inputs.nginx-config }}" /etc/nginx/sites-available/default
|
sudo cp "${{ inputs.nginx-config }}" /etc/nginx/sites-available/default
|
||||||
sudo nginx -t
|
sudo nginx -t
|
||||||
sudo systemctl reload nginx
|
echo "✓ nginx configured successfully"
|
||||||
echo "nginx configured successfully"
|
|
||||||
else
|
else
|
||||||
echo "::warning::nginx config file not found: ${{ inputs.nginx-config }}"
|
echo "::warning::nginx config file not found: ${{ inputs.nginx-config }}"
|
||||||
fi
|
fi
|
||||||
@@ -168,39 +153,29 @@ runs:
|
|||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Start nginx
|
- name: Start nginx
|
||||||
if: inputs.install-web-server == 'true'
|
if: inputs.install-nginx == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Starting nginx"
|
echo "::group::Starting nginx"
|
||||||
sudo systemctl start nginx
|
sudo nginx || echo "nginx may already be running"
|
||||||
sudo systemctl status nginx --no-pager || true
|
# Verify nginx is working
|
||||||
echo "nginx started successfully"
|
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::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Install Node.js dependencies
|
- name: Install Node dependencies
|
||||||
if: inputs.install-node == 'true' && inputs.install-dependencies == 'true'
|
if: inputs.install-node == 'true' && inputs.install-dependencies == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "::group::Installing Node.js dependencies"
|
echo "::group::Installing Node dependencies"
|
||||||
cd "${{ inputs.server-path }}"
|
cd "${{ inputs.server-path }}"
|
||||||
|
npm ci || npm install
|
||||||
case "${{ inputs.package-manager }}" in
|
echo "✓ Node dependencies installed successfully"
|
||||||
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"
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Install PHP dependencies
|
- name: Install PHP dependencies
|
||||||
@@ -209,29 +184,8 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
echo "::group::Installing PHP dependencies"
|
echo "::group::Installing PHP dependencies"
|
||||||
cd "${{ inputs.server-path }}"
|
cd "${{ inputs.server-path }}"
|
||||||
|
composer install --optimize-autoloader
|
||||||
if [ -f "composer.json" ]; then
|
echo "✓ PHP dependencies installed successfully"
|
||||||
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
|
|
||||||
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Run build command
|
- name: Run build command
|
||||||
|
|||||||
Reference in New Issue
Block a user