Skip to content

Comments

Add test workflow#1

Open
rafal-k wants to merge 27 commits intomasterfrom
add-test-workflow
Open

Add test workflow#1
rafal-k wants to merge 27 commits intomasterfrom
add-test-workflow

Conversation

@rafal-k
Copy link

@rafal-k rafal-k commented Feb 21, 2026

Summary

Adds automated testing and linting workflows to the pos-modules monorepo with support for selective module execution based on changed files.

Changes

1. Lint Workflow (lint.yml)

  • Runs platformos-check on changed modules
  • Dynamic matrix generation detects which modules changed
  • Generates detailed summary with lint issues table
  • Skips unchanged modules to optimize CI time

2. E2E Testing Workflow (test-e2e.yml)

  • Reserves CI instance, deploys module, runs Playwright tests, releases instance
  • Sequential execution (max-parallel: 1) ensures clean instance lifecycle per module
  • Dynamic matrix configuration with module-specific deploy and test commands
  • Supports user, chat, and common-styling modules

3. Dynamic Matrix Pattern

  • Both workflows use toJSON() + jq to auto-generate matrices from path filters
  • Adding new modules requires only filter definition + config object
  • No workflow code changes needed when adding modules

Architecture

Each module configuration specifies:

  • path: Module directory
  • deploy-script: Module-specific deployment commands
  • test-commands: Test execution commands

Workflows detect changed files and run only for affected modules.

Implement GitHub Actions workflows for automated testing and linting:
- test.yml: Runs platformOS and Playwright tests with isolated CI instances
- lint.yml: Runs platformos-check linter across all modules

Uses matrix strategies with path-based change detection to test only
modified modules in parallel. Each module gets its own CI instance for
complete isolation.
The payments module lacks an app/ directory and cannot be deployed
via pos-cli deploy. Only keep modules with app/ directories in the
test-platformos job until deployment strategy is determined for
module-only packages.
Create separate workflows for different test types:
- test.yml: module/Liquid tests (pos-cli test run)
- test-e2e.yml: Playwright E2E tests

This resolves instance reservation conflicts that occurred when both
test jobs tried to reserve the same CI instance simultaneously.
Removed comment-trigger from pos-module-user
Refactor test.yml to use matrix deploy-script field instead of
hardcoded deployment commands. This allows each module to define
its own deployment strategy, enabling future addition of modules
without seed infrastructure (e.g., pos-module-core).

Aligns with the pattern already used in test-e2e.yml.
Refactor test-playwright job into three separate jobs following the
pattern from e2e_tests_on_ps.yml:

- deploy: Reserves instances and deploys modules (10min timeout)
- test: Retrieves instance URLs and runs Playwright tests (35min timeout)
- cleanup: Always releases CI instances, even on failure

Benefits:
- Clear separation between deployment and test failures
- Better visibility in GitHub Actions UI
- Ensures CI instances are always released via cleanup job
- Aligns with established workflow patterns in the repository
Mirror the structure and action versions from reserve-and-deploy-cs.yml
into the test-e2e.yml deploy job to maintain consistency across workflows.

Changes:
- Update Get MPKIT token action from @mask-token to @0.1.2
- Add ref parameter to checkout step for proper branch handling
- Increase deploy timeout from 10 to 15 minutes
Replace HOME environment variable with NPM_CONFIG_CACHE in deploy job
and remove redundant HOME variable from test job.

- Deploy job: use NPM_CONFIG_CACHE instead of HOME for npm caching
- Test job: remove HOME variable (NPM_CONFIG_CACHE already present)
Refactor instance URL handling to use job outputs instead of
querying the CI repository in the test job.

Changes:
- Deploy job: add mpkit-url output from reserve step
- Test job: use deploy job output for MPKIT_URL environment variable
- Test job: remove redundant "Get reserved instance URL" step
- Test job: move MPKIT_URL to job-level env for cleaner configuration

This simplifies the workflow by eliminating an extra API call to
retrieve the instance URL that was already reserved in the deploy job.
Update test and cleanup job dependencies to reference the renamed
reserve-and-deploy job instead of deploy.
Move the comment from inside the {% parse_json %} block to before it
using Liquid comment syntax to prevent JSON parsing errors.
Replace hardcoded matrices with dynamic matrix generation based on
changed modules. This eliminates redundant change detection and makes
adding new modules significantly easier.
Replace repetitive if-blocks with automatic extraction of changed
modules using toJSON() and jq filtering. This drastically reduces
code duplication and maintenance burden.

Changes:
- lint.yml: replace 14 if-blocks (64 lines) with single jq filter (4 lines)
- test-e2e.yml: replace 3 if-blocks with config JSON + jq mapping
- Use toJSON(steps.filter.outputs) to get all filter results
- Use jq to extract only modules where value == "true"
- test-e2e.yml: define module configs in clean JSON format
Add better error handling to the Generate summary step to diagnose
why summary reports aren't rendering after workflow completion.

Changes:
- Remove error suppression (2>/dev/null) to expose jq failures
- Add success/failure conditional logic with feedback messages
- Show actual JSON content in summary when jq parsing fails
- Display expected file path when platformos-check.json is missing
- Add debug output to help identify root cause of rendering issues

This will reveal whether the problem is:
- Missing JSON output file
- Malformed JSON structure
- jq parsing errors
- Incorrect file paths
Add max-parallel: 1 to reserve-and-deploy, test, and cleanup jobs to ensure
sequential execution when multiple modules change. This prevents "Instance
already reserved" errors that occurred when matrix jobs attempted to reserve
the same CI instance concurrently.

Trade-off: Multiple module changes will now run sequentially rather than in
parallel, increasing total runtime but ensuring reliability.
Combine reserve-and-deploy, test, and cleanup jobs into a single test-e2e job
to ensure each module completes its full lifecycle before the next begins.

Previously, when multiple modules changed, the workflow would:
1. Reserve instances for all modules (in sequence)
2. Run tests for all modules
3. Release all instances

This caused "Instance already reserved" errors because Module 2 would attempt
to reserve before Module 1 released its instance.

Now, with max-parallel: 1 and a unified job, each module:
1. Reserves instance
2. Deploys
3. Tests
4. Releases instance (always, even on failure)

Before the next module starts. This ensures the instance is available for
subsequent modules while maintaining test isolation.
…ssues

Fix chat module to use container's pre-installed Playwright
- Change package.json script from "npx playwright test" to "playwright test"
- Prevents version conflicts between container's Playwright and package.json
- Matches user module pattern which was working correctly
@rafal-k rafal-k requested a review from Slashek February 21, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant