Skip to content

fix(ci): make smoke-test matrix valid (matrix context not allowed in job-level if)#42

Closed
sdserranog wants to merge 4 commits into
mainfrom
fix/ci-matrix-job-if
Closed

fix(ci): make smoke-test matrix valid (matrix context not allowed in job-level if)#42
sdserranog wants to merge 4 commits into
mainfrom
fix/ci-matrix-job-if

Conversation

@sdserranog

Copy link
Copy Markdown
Contributor

Problem

CI fails to even start with an invalid-workflow error:

Invalid workflow file: .github/workflows/ci.yml#L91
Unrecognized named-value: 'matrix'.

The smoke-test-templates job used matrix.template inside its job-level if:. The matrix context is not available there (only in strategy, name, env, runs-on, and step-level if:), so the whole workflow is rejected.

Fix

Compute the list of templates to test in the changes job and build the matrix dynamically:

  • changes emits templates — a JSON array (core change → all three; otherwise only the changed templates).
  • smoke-test-templates uses matrix: template: ${{ fromJSON(needs.changes.outputs.templates) }} and gates on if: needs.changes.outputs.templates != '[]' (also avoids an empty-matrix error).

This preserves the exact per-template gating behavior while being valid.

Note

Pre-existing bug, unrelated to the release-workflow fix (#41) — it surfaced because merging to main triggered CI.

The `matrix` context is not available in a job-level `if:`, so the previous
condition (`matrix.template == 'ai-sdk' && ...`) made the whole workflow
invalid. Emit a JSON template list from the changes job and build the matrix
via fromJSON, guarding on a non-empty list. Preserves the per-template
gating: core change tests all templates, otherwise only the changed ones.
setup-node cache:npm and npm ci both require a package-lock.json, which
this bun-based repo doesn't have — CI failed with 'Dependencies lock file
is not found'. Install with bun (matching release.yml), and make setup-bun
unconditional in smoke-test so the langchain leg can install root deps to
run the built CLI.
- Format langchain template with ruff (main.py, routes/arcade.py,
  routes/plan.py) so 'ruff format --check' passes.
- Feed doctor dummy CI env (gateway + LLM key) so its success path runs;
  it otherwise exits 1 on an unconfigured scaffold. No template changes.
The langchain smoke leg ran 'python -m app.doctor' without installing the
scaffolded project's requirements, so it failed on 'ModuleNotFoundError:
httpx'. Install requirements.txt after scaffolding.
@sdserranog sdserranog closed this Jul 7, 2026
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