restructure

This commit is contained in:
2026-05-29 11:16:00 -04:00
parent abeb9d04d0
commit 1ffe0c23cb
27 changed files with 14 additions and 14 deletions
+29
View File
@@ -0,0 +1,29 @@
# test/npm
Composite action: install dependencies and run an npm test script.
## Inputs
| Input | Description | Default |
|---|---|---|
| `INSTALL_CMD` | Install command | `npm ci` |
| `TEST_SCRIPT` | npm script to run (must exist in `package.json`) | `test` |
| `WORKING_DIRECTORY` | Directory to run commands in | `.` |
## Usage
```yaml
- uses: stat-tackler/stat-tackler-infra/test/npm@main
with:
TEST_SCRIPT: test:unit
```
### Common test scripts by project
| Project | Script | Runner |
|---|---|---|
| `stat-tackler-api` | `test` | Jest |
| `stat-tackler-scorekeeper` | `test:unit` | Vitest |
| `stat-tackler-scorekeeper` | `test:integration` | Vitest |
| `stat-tackler-scorekeeper` | `test:run` | Vitest (unit + integration) |
| `stat-tackler-scorekeeper` | `test:coverage` | Vitest |
+40
View File
@@ -0,0 +1,40 @@
name: NPM Test
description: Install dependencies and run npm tests
inputs:
INSTALL_CMD:
description: "Install command"
default: "npm ci"
TEST_SCRIPT:
description: "npm script to run (must exist in package.json)"
default: "test"
WORKING_DIRECTORY:
description: "Directory to run commands in"
default: "."
runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v5
with:
node-version-file: package.json
- name: Cache node_modules
uses: actions/cache@v4
with:
path: ${{ inputs.WORKING_DIRECTORY }}/node_modules
key: node-modules-${{ hashFiles(format('{0}/package-lock.json', inputs.WORKING_DIRECTORY)) }}
restore-keys: node-modules-
- name: Install
shell: sh
working-directory: ${{ inputs.WORKING_DIRECTORY }}
run: ${{ inputs.INSTALL_CMD }}
- name: Test
shell: sh
working-directory: ${{ inputs.WORKING_DIRECTORY }}
run: npm run ${{ inputs.TEST_SCRIPT }}