Sebastian d9dd782229
Test Action / Test Base Modules Requires PHP (push) Failing after 10m29s
Test Action / Test Base Modules Installation (push) Failing after 10m31s
Test Action / Test Node (push) Failing after 10m37s
Test Action / Test Build Command (push) Failing after 14m37s
Test Action / Test Custom Server Path (push) Failing after 15m23s
Test Action / Test All Components (push) Failing after 15m25s
Test Action / Test nginx (push) Failing after 15m27s
Test Action / Test Database Configuration (push) Failing after 15m33s
Test Action / Test PHP (push) Failing after 15m35s
feat: improve install action
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-07-22 23:56:05 -04:00
2026-07-22 23:56:05 -04:00
2026-07-22 23:56:05 -04:00
2026-02-14 16:28:51 -05:00
2026-02-14 16:28:51 -05:00
2026-07-22 23:56:05 -04:00
2026-02-14 16:28:51 -05:00
2026-07-22 23:56:05 -04:00

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 Database Configuration

Point the checked-out server at a database (e.g. a mongo service container) and write the value into config/system.php before dependencies or base modules are installed:

services:
  mongo:
    image: mongo:7
    ports:
      - 27017:27017

steps:
  - name: Install server with database configuration
    uses: Nodarx/action-server-install@v1
    with:
      install-php: 'true'
      database-uri: 'mongodb://127.0.0.1:27017/?tls=false'
      database-name: 'ktrix_ci'
      app-environment: 'test'

Any override left blank keeps the value already committed in config/system.php.

With Base Modules (Password Authentication)

install-base-modules clones the password authentication provider module (from base-modules-repository, via action-module-install), then installs and enables it with bin/console. This requires PHP and a reachable, configured database:

services:
  mongo:
    image: mongo:7
    ports:
      - 27017:27017

steps:
  - name: Install server with base modules
    uses: Nodarx/action-server-install@v1
    with:
      install-php: 'true'
      database-uri: 'mongodb://127.0.0.1:27017/?tls=false'
      database-name: 'ktrix_ci'
      install-base-modules: 'true'

  - name: Provision a tenant and user for testing
    run: |
      cd server
      php bin/console tenant:create ci.test --identifier ci
      php bin/console user:create ci tester@ci.test
      php bin/console user:password ci tester@ci.test 'Sup3r-Secret!'

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

Server Settings Configuration

Overrides are written into the checked-out config/system.php. Requires install-php: 'true'; any input left blank keeps the repository's committed default.

Input Description Required Default
database-uri MongoDB connection URI No ''
database-name MongoDB database name No ''
app-environment Application environment, e.g. test No ''
security-salt Security salt No ''

Base Modules

Delegates cloning to action-module-install, then installs and enables the module via bin/console. Requires install-php and a reachable, configured database.

Input Description Required Default
install-base-modules Clone, install, and enable the base module set (currently: authentication_provider_password) No false
base-modules-repository Repository URL for the password authentication provider module No https://git.ktrix.dev/Nodarx/authentication_provider_password
base-modules-branch Branch, tag, or commit to check out for the password authentication provider module No main

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)
base-modules-installed Whether the base module set was installed (true/false)

Best Practices

  1. Enable only needed components: For faster test runs

    # JS unit tests - Node.js only
    - uses: Nodarx/action-server-install@v1
      with:
        install-node: 'true'
    
  2. Pin to specific versions: Use commit SHA or version tag

    uses: Nodarx/action-server-install@v1.0.0
    
  3. 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'
    
  4. 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.

S
Description
No description provided
Readme MIT 128 KiB
Languages
Shell 67.3%
PHP 32.7%