From dfc99b321dfa1a566d1703761756dc3ded6fd77b Mon Sep 17 00:00:00 2001 From: Sebastian Krupinski Date: Thu, 23 Jul 2026 00:02:45 -0400 Subject: [PATCH] fix: tests Signed-off-by: Sebastian Krupinski --- .github/workflows/test.yml | 43 ++++++++++++++++++++++++++++++++++++++ README.md | 21 ++++++++++++++++++- action.yml | 32 ++++++++++++++++++---------- 3 files changed, 84 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd94f16..b6e12b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,13 @@ on: pull_request: branches: [ main ] +# Keep the fixture source in one place. Override these with repository variables +# when testing another server repository; no workflow edits are required. +env: + TEST_SERVER_REPOSITORY: ${{ vars.TEST_SERVER_REPOSITORY || 'Nodarx/server' }} + TEST_SERVER_REF: ${{ vars.TEST_SERVER_REF || 'main' }} + TEST_GIT_SERVER_URL: ${{ vars.TEST_GIT_SERVER_URL || 'https://git.ktrix.dev' }} + jobs: test-node: name: Test Node @@ -18,6 +25,10 @@ jobs: install-node: 'true' node-version: '24' server-path: './test-server' + server-repository: ${{ env.TEST_SERVER_REPOSITORY }} + server-ref: ${{ env.TEST_SERVER_REF }} + github-server-url: ${{ env.TEST_GIT_SERVER_URL }} + checkout-token: ${{ secrets.TEST_SERVER_TOKEN }} - name: Verify installation run: | @@ -44,6 +55,10 @@ jobs: install-php: 'true' php-version: '8.5' server-path: './test-server' + server-repository: ${{ env.TEST_SERVER_REPOSITORY }} + server-ref: ${{ env.TEST_SERVER_REF }} + github-server-url: ${{ env.TEST_GIT_SERVER_URL }} + checkout-token: ${{ secrets.TEST_SERVER_TOKEN }} - name: Verify installation run: | @@ -79,6 +94,10 @@ jobs: database-uri: 'mongodb://127.0.0.1:27017/?tls=false' database-name: 'ktrix_ci' app-environment: 'test' + server-repository: ${{ env.TEST_SERVER_REPOSITORY }} + server-ref: ${{ env.TEST_SERVER_REF }} + github-server-url: ${{ env.TEST_GIT_SERVER_URL }} + checkout-token: ${{ secrets.TEST_SERVER_TOKEN }} - name: Verify configuration was written run: | @@ -119,6 +138,10 @@ jobs: database-uri: 'mongodb://127.0.0.1:27017/?tls=false' database-name: 'ktrix_ci' install-base-modules: 'true' + server-repository: ${{ env.TEST_SERVER_REPOSITORY }} + server-ref: ${{ env.TEST_SERVER_REF }} + github-server-url: ${{ env.TEST_GIT_SERVER_URL }} + checkout-token: ${{ secrets.TEST_SERVER_TOKEN }} - name: Verify password authentication provider is installed and enabled run: | @@ -152,6 +175,10 @@ jobs: install-node: 'true' install-base-modules: 'true' server-path: './test-server' + server-repository: ${{ env.TEST_SERVER_REPOSITORY }} + server-ref: ${{ env.TEST_SERVER_REF }} + github-server-url: ${{ env.TEST_GIT_SERVER_URL }} + checkout-token: ${{ secrets.TEST_SERVER_TOKEN }} - name: Verify the action failed run: | @@ -172,6 +199,10 @@ jobs: with: install-nginx: 'true' server-path: './test-server' + server-repository: ${{ env.TEST_SERVER_REPOSITORY }} + server-ref: ${{ env.TEST_SERVER_REF }} + github-server-url: ${{ env.TEST_GIT_SERVER_URL }} + checkout-token: ${{ secrets.TEST_SERVER_TOKEN }} - name: Verify installation run: | @@ -198,6 +229,10 @@ jobs: node-version: '24' php-version: '8.5' server-path: './test-server' + server-repository: ${{ env.TEST_SERVER_REPOSITORY }} + server-ref: ${{ env.TEST_SERVER_REF }} + github-server-url: ${{ env.TEST_GIT_SERVER_URL }} + checkout-token: ${{ secrets.TEST_SERVER_TOKEN }} - name: Verify installation run: | @@ -232,6 +267,10 @@ jobs: with: install-node: 'true' server-path: './my-custom-server' + server-repository: ${{ env.TEST_SERVER_REPOSITORY }} + server-ref: ${{ env.TEST_SERVER_REF }} + github-server-url: ${{ env.TEST_GIT_SERVER_URL }} + checkout-token: ${{ secrets.TEST_SERVER_TOKEN }} - name: Verify installation run: | @@ -260,6 +299,10 @@ jobs: install-node: 'true' server-path: './test-server' build-command: 'echo "Build complete" > build.log' + server-repository: ${{ env.TEST_SERVER_REPOSITORY }} + server-ref: ${{ env.TEST_SERVER_REF }} + github-server-url: ${{ env.TEST_GIT_SERVER_URL }} + checkout-token: ${{ secrets.TEST_SERVER_TOKEN }} - name: Verify build run: | diff --git a/README.md b/README.md index b6a1146..ef1cfee 100644 --- a/README.md +++ b/README.md @@ -223,7 +223,11 @@ Overrides are written into the checked-out `config/system.php`. Requires `instal ### Base Modules -Delegates cloning to [action-module-install](https://git.ktrix.dev/Nodarx/action-module-install), then installs and enables the module via `bin/console`. Requires `install-php` and a reachable, configured database. +Clones the configured module repository directly, then installs and enables the +module via `bin/console`. This avoids a nested remote-action dependency, so the +action works on GitHub-compatible hosts without resolving +`Nodarx/action-module-install` through GitHub. Requires `install-php` and a +reachable, configured database. | Input | Description | Required | Default | |-------|-------------|----------|---------| @@ -231,6 +235,21 @@ Delegates cloning to [action-module-install](https://git.ktrix.dev/Nodarx/action | `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` | +## Testing Against Another Source + +The action's test workflow keeps its server fixture source in repository +variables. The defaults target `Nodarx/server` on `https://git.ktrix.dev`. +To test another source without editing the workflow, set: + +| Repository variable | Purpose | Default | +|---------------------|---------|---------| +| `TEST_SERVER_REPOSITORY` | Repository in `owner/name` form | `Nodarx/server` | +| `TEST_SERVER_REF` | Branch, tag, or commit | `main` | +| `TEST_GIT_SERVER_URL` | Base URL of the GitHub-compatible server | `https://git.ktrix.dev` | + +For a private source, also add a repository secret named +`TEST_SERVER_TOKEN`. Public repositories do not require the secret. + ## Outputs | Output | Description | diff --git a/action.yml b/action.yml index 3be105c..3a3d9b8 100644 --- a/action.yml +++ b/action.yml @@ -268,17 +268,27 @@ runs: - name: Clone base modules if: inputs.install-base-modules == 'true' - uses: Nodarx/action-module-install@main - with: - modules: | - [ - { - "name": "authentication_provider_password", - "repo": "${{ inputs.base-modules-repository }}", - "branch": "${{ inputs.base-modules-branch }}" - } - ] - install-path: ${{ inputs.server-path }}/modules + shell: bash + env: + MODULE_REPOSITORY: ${{ inputs.base-modules-repository }} + MODULE_REF: ${{ inputs.base-modules-branch }} + MODULE_PATH: ${{ inputs.server-path }}/modules/authentication_provider_password + run: | + echo "::group::Cloning base modules" + + if [ -e "$MODULE_PATH" ]; then + echo "::error::Base module path already exists: $MODULE_PATH" + exit 1 + fi + + mkdir -p "$(dirname "$MODULE_PATH")" + git init "$MODULE_PATH" + git -C "$MODULE_PATH" remote add origin "$MODULE_REPOSITORY" + git -C "$MODULE_PATH" fetch --depth 1 origin "$MODULE_REF" + git -C "$MODULE_PATH" checkout --detach FETCH_HEAD + + echo "✓ Base modules cloned" + echo "::endgroup::" - name: Install and enable base modules if: inputs.install-base-modules == 'true' -- 2.39.5