Skip to content

Conversation

silky-x0
Copy link
Contributor

@silky-x0 silky-x0 commented Oct 2, 2025

Automate running Node.js tests on every pull request

Description

This PR implements automated testing for FEAScript examples using GitHub Actions, providing immediate feedback when changes break existing examples.

Closes #32

Changes

Added

  • GitHub Actions Workflow (.github/workflows/scripts-test.yml)
    • Automatically runs all Node.js examples on every push to main and pull request
    • Tests across multiple Node.js versions (18.x and 20.x)
    • Excludes generalFormPDEScript example (as it's not yet fully integrated)

Key Features

Automated Test Execution

  • Discovers and runs all .js files in the examples/ directory
  • Each example runs with a 5-minute timeout to prevent hanging
  • Fail-fast disabled to test all Node versions even if one fails

Comprehensive Logging

  • Captures all output (stdout/stderr) to .log files for each example
  • Shows output preview (first 5 lines) for passed tests
  • Displays error details (last 20 lines) for failed tests directly in workflow logs

Detailed Reporting

  • Visual indicators (▶ ✓ ✗) for test status
  • Summary statistics: total/passed/failed counts
  • Lists all failed examples at the end
  • Fails the workflow if any example fails

Debug Support

  • Uploads log files as artifacts when tests fail
  • Artifacts retained for 7 days for troubleshooting
  • Provides exit codes for failed examples

Examples Tested

The workflow automatically runs these examples:

  • examples/frontPropagationScript/SolidificationFront2D.js
  • examples/solidHeatTransferScript/HeatConduction1DWall.js
  • examples/solidHeatTransferScript/HeatConduction2DFin.js
  • examples/solidHeatTransferScript/HeatConduction2DFinGmsh.js

Note: generalFormPDEScript is excluded.

Checklist

  • Workflow file created in .github/workflows/
  • Tests run on both Node.js 18.x and 20.x
  • Excluded generalFormPDEScript as requested
  • Added timeout protection (5 minutes per example)
  • Implemented comprehensive logging with output capture
  • Added artifact upload for failed test logs

Copy link
Member

@nikoscham nikoscham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @silky-x0. It will help catch issues early. Thanks a lot for the contribution.

@nikoscham nikoscham merged commit 74158a9 into FEAScript:main Oct 2, 2025
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automate running Node.js tests on every pull request

2 participants