Skip to content

chore(ci): redesign test workflows into reusable+caller pattern#6

Merged
saqibmanan merged 7 commits into
devfrom
chore/redesign-ci-workflows
May 7, 2026
Merged

chore(ci): redesign test workflows into reusable+caller pattern#6
saqibmanan merged 7 commits into
devfrom
chore/redesign-ci-workflows

Conversation

@saqibmanan
Copy link
Copy Markdown
Contributor

@saqibmanan saqibmanan commented May 7, 2026

Description

Replace the monolithic test-automation.yml (397 lines) with a composite setup action, a reusable _test.yml, and four focused caller workflows. Fixes the broken smoke artifact upload, removes Node deprecation warnings, and gates multistate to dev-only triggers.

This PR is opened as a draft against dev to verify pr.yml (smoke) end-to-end before merging.

Type of Change

  • Refactoring
  • Bug fix (smoke artifact upload, conftest htmlpath clobber)
  • Documentation update

Changes Made

New files

  • .github/actions/setup-test-env/action.yml — composite action for checkout, Python, deps, driver cache, and report dir creation. Single source of truth for setup; fixes the smoke-job artifact bug centrally.
  • .github/workflows/_test.yml — reusable workflow (workflow_call). Inputs: markers, shards, workers, target_env, test_path, bootstrap_states. Two jobs: matrix-sharded test and summary (merge + publish + PR comment).
  • .github/workflows/pr.yml — PR → smoke (1 × 4, target_env=dev). paths-ignore for docs; concurrency cancels superseded runs.
  • .github/workflows/main.yml — push to main → full suite (3 × 2, target_env=staging).
  • .github/workflows/nightly.yml — cron 0 2 * * * + manual → multistate (4 × 2, target_env=dev, with bootstrap_states).
  • .github/workflows/dispatch.ymlworkflow_dispatch (scope/target_env inputs) + repository_dispatch (frontend-deployed/backend-deployed). Routes by client_payload.environment: dev → multistate; prod/staging/main → smoke + analytics-non-multistate + component + dataset.
  • docs/upstream-dispatch-setup.md — PAT + dispatch-step instructions for IDS-DRR-Frontend and IDS-DRR-Backend.

Modified

  • conftest.py — htmlpath rewrite now only fires when the value equals the addopts default (reports/report.html). CI shard-specific --html paths are preserved.
  • .github/workflows/README.md — rewritten for the new structure.

Deleted

  • .github/workflows/test-automation.yml — replaced by the above.

Trigger map (after merge)

Trigger Workflow Markers Shards × workers Target env
QA-repo PR pr.yml smoke 1 × 4 dev
QA-repo push to main main.yml (all) 3 × 2 staging
Nightly 02:00 UTC + manual nightly.yml multistate 4 × 2 dev
Upstream dev deploy dispatch.yml:on-dev-deploy multistate 4 × 2 dev
Upstream main deploy dispatch.yml:on-main-deploy smoke or (analytics and not multistate) or component or dataset 3 × 2 prod
Manual dispatch.yml user-chosen per scope user-chosen

Testing

  • All workflow files pass actionlint -color (zero warnings).
  • Smoke run via this PR (pr.yml) — pending.
  • Verify shard-specific HTML names land on disk (conftest fix).
  • Cross-repo dispatch verification — pending upstream wiring (see manual steps doc).

Manual steps required after merge

The cross-repo wiring lives in the upstream IDS-DRR-Frontend and IDS-DRR-Backend repos and cannot be done from this PR. See docs/upstream-dispatch-setup.md for the PAT/secret/dispatch-step instructions.

Checklist

  • Code follows project style (composite action + reusable workflow pattern)
  • Self-review completed
  • Documentation updated (workflows README + new upstream-dispatch-setup doc)
  • No breaking changes for local dev (pytest, run_tests.sh, run_parallel_tests.sh unchanged)

Related Issues

N/A — internal CI redesign.

Saqib and others added 6 commits May 7, 2026 06:35
Admin: purge sensitive data and add security docs
- SECURITY.md: set security contact to tech@civicdatalab.in
- ADMIN_ANNOUNCE.md: set maintainer handle to @saqibmanan
- CODE_OF_CONDUCT.md: add reporting contact, drop pre-release self-flag
- .env.example: consolidate duplicated config blocks
Replace monolithic test-automation.yml with a composite setup action,
a reusable _test.yml, and four caller workflows (pr, main, nightly,
dispatch). Multistate now only runs on dev triggers; main deploys run
smoke + analytics-non-multistate + component + dataset. Fixes the
smoke artifact upload bug, removes Node deprecation warnings, and
adds upstream-dispatch-setup docs for IDS-DRR-Frontend/Backend.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Test Results (smoke)

37 tests   36 ✅  3m 52s ⏱️
 1 suites   1 💤
 1 files     0 ❌

Results for commit 62effc0.

♻️ This comment has been updated with latest results.

Local composite actions cannot self-checkout — the runner needs
.github/actions/setup-test-env/action.yml on disk before the
composite can be located. Callers must run actions/checkout@v4
first; only the test job in _test.yml needs the explicit step
since summary already had its own checkout.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

QA Tests passed

  • Markers: smoke
  • Sharding: 1 × 4 workers
  • Target env: dev

Download the consolidated-test-report artifact for the merged report.html.

@saqibmanan saqibmanan marked this pull request as ready for review May 7, 2026 04:44
@saqibmanan saqibmanan merged commit b2e4783 into dev May 7, 2026
4 checks passed
@saqibmanan saqibmanan deleted the chore/redesign-ci-workflows branch May 7, 2026 04:45
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