Select a Test Suite with Trigger Inputs
Use one job for a quick manual check and a full scheduled test run.
Use fixed trigger inputs when several start paths should run the same job with different settings. This guide maps a manual trigger to smoke tests and a Cron trigger to the full test suite.
Before you begin
You need:
- A Node.js repository with
test:smokeandtestscripts.
Add the workflow
Create .shipfox/workflows/test-suites.yml. This is a complete workflow:
# yaml-language-server: $schema=https://www.shipfox.io/docs/workflow.schema.json
name: Run the right test suite
runner: shipfox
triggers:
manual_smoke:
source: manual
with:
suite: smoke
nightly_full:
source: cron
config:
schedule: "0 2 * * *"
timezone: UTC
with:
suite: full
jobs:
test:
steps:
- run: npm ci
- env:
TEST_SUITE: "${{ inputs.suite }}"
run: |
case "$TEST_SUITE" in
smoke) npm run test:smoke ;;
full) npm test ;;
*) printf 'Unknown test suite: %s\n' "$TEST_SUITE" >&2; exit 2 ;;
esacEach trigger records its with values as run inputs. The run step gives the
selected suite a shell variable because the case statement uses that value
across several branches. The allowlist rejects any suite the workflow does not
support.
Commit and push the file to the project's default branch. Wait for Run the right test suite to sync.
Verify both start paths
For a quick schedule check, temporarily set schedule to the next UTC minute.
Restore 0 2 * * * after both start paths work.
- Select Run. Open the run and check that it uses
smokeand callsnpm run test:smoke. - After the next scheduled run, check that it uses
fulland callsnpm test. - Open each run's trigger data. Confirm that the matching
withvalue appears underinputs.
The Contexts reference defines
where inputs is available. Schedule workflows
defines Cron schedule fields.