chore: update name
All checks were successful
Test Action / Test Node (pull_request) Successful in 18s
Test Action / Test Without Dependencies (pull_request) Successful in 8s
Test Action / Test nginx (pull_request) Successful in 22s
Test Action / Test Custom Server Path (pull_request) Successful in 21s
Test Action / Test Build Command (pull_request) Successful in 24s
Test Action / Test PHP (pull_request) Successful in 55s
Test Action / Test All Components (pull_request) Successful in 1m15s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-02-14 16:35:27 -05:00
parent f3c24e48fb
commit b843124cd6
5 changed files with 74 additions and 413 deletions

127
README.md
View File

@@ -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