mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-10 03:27:59 +00:00
Add a `paths-changes` job to ci.yml that runs `dorny/paths-filter@v3`
ONCE per CI run and exposes three outputs to the four reusable
sub-workflows via `with:`:
- web (e2e gate)
- shared-resolution (forces full parity matrix)
- changed-languages (JSON array of language slugs to run parity for)
Tier the four sub-workflows so cheap quality checks gate the expensive
tier. `quality` failure now auto-skips `tests`, `e2e`, and
`scope-parity` via `needs: quality` + `if: needs.quality.result ==
'success'`. The `ci-status` aggregator surfaces the originating failure
first so cascade-skipped downstream results don't produce misleading
secondary errors. The aggregator now also includes `paths-changes` in
its `needs:` so a transient filter API failure surfaces with the
correct error, not a fake "Quality jobs failed".
`shared-resolution` is the OR of six independent signals — any change
that could regress any language's parity forces the full matrix:
- shared-ingestion (gitnexus/src/core/ingestion/** minus languages/)
- shared-types (gitnexus-shared/**)
- shared-parser-infra (gitnexus/src/core/tree-sitter/**)
- shared-test-harness (resolver helpers + gitnexus/test/helpers/**)
- shared-pipeline (ci.yml, ci-quality.yml, ci-scope-parity.yml,
setup-gitnexus action, discovery script)
- shared-config (package.json, package-lock.json, vitest.config,
tsconfig)
`predicate-quantifier: 'every'` is required for the shared-ingestion
negation to actually exclude (dorny/paths-filter#184); the other
filters use default OR semantics. Both filter steps carry
`continue-on-error: true` so a transient REST API blip falls back to
the conservative full-battery posture rather than blocking the PR.
In `ci-scope-parity.yml`, the discover job intersects MIGRATED_LANGUAGES
with `changed-languages` using strict equality (`IN(.slug; $changed[])`,
not `inside()` which would substring-match `c` against `cpp`). When
`shared-resolution-changed=true` the full matrix runs. The discover
step validates both its own script output and the caller-supplied
`changed-languages` input as JSON arrays before passing them through
`jq --argjson`, so malformed input fails loud at the discover step
instead of producing `fromJSON('')` matrix crashes downstream. An
empty filtered matrix is handled by `if: needs.discover.outputs.languages != '[]'`
on the parity job; the outer workflow conclusion stays `success`.
`ci-e2e.yml` drops its in-workflow `check-changes` job and consumes the
centralized `web-changed` input.
`save-pr-meta` and `ci-status` switch from `if: always()` to
`if: ${{ !cancelled() }}` so user-initiated workflow cancellation
actually cancels them (actions/runner#491).
Dead backward-compat hyphenated artifact copies in `save-pr-meta`
removed — verified the `ci-report.yml` on main reads only
underscore-named files.
Conservative `'true'` defaults on every input for non-PR callers
(release-candidate.yml, publish.yml via workflow_call): the full
battery still runs on every push to main and every release.
Adds `GITHUB_STEP_SUMMARY` lines in both `paths-changes` and the
scope-parity `discover` step so reviewers and agents can see why a
tier was pruned vs. ran without scraping logs.
94 lines
3.1 KiB
YAML
94 lines
3.1 KiB
YAML
name: E2E Tests
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
web-changed:
|
|
description: >-
|
|
Whether files under `gitnexus-web/**` (or shared types in
|
|
`gitnexus-shared/**`) changed on this PR. Computed by the
|
|
centralised `paths-changes` job in `ci.yml` and passed in
|
|
via `with:`. When `'false'`, the e2e job skips. For non-PR
|
|
callers (release-candidate.yml) `paths-changes` emits `'true'`
|
|
conservatively so the full battery still runs.
|
|
required: false
|
|
type: string
|
|
default: 'true'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
e2e:
|
|
name: e2e (chromium)
|
|
# Centralised change detection: ci.yml computes `web` ONCE and passes
|
|
# it here via `inputs.web-changed`. The legacy in-workflow `check-changes`
|
|
# job (which ran `dorny/paths-filter` on its own) is removed — the same
|
|
# detection now feeds every sub-workflow from a single source.
|
|
if: inputs.web-changed == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Configure e2e GitNexus home
|
|
run: echo "GITNEXUS_HOME=${RUNNER_TEMP}/gitnexus-home" >> "$GITHUB_ENV"
|
|
|
|
- uses: ./.github/actions/setup-gitnexus-web
|
|
|
|
- name: Install Playwright browsers
|
|
run: npx playwright install --with-deps chromium
|
|
working-directory: gitnexus-web
|
|
|
|
- name: Install backend dependencies
|
|
run: npm ci
|
|
working-directory: gitnexus
|
|
|
|
- name: Build backend
|
|
run: npm run build
|
|
working-directory: gitnexus
|
|
|
|
- name: Analyze repository (index for backend)
|
|
run: |
|
|
E2E_REPO="${RUNNER_TEMP}/gitnexus-e2e-repo"
|
|
rm -rf "${E2E_REPO}"
|
|
mkdir -p "${E2E_REPO}"
|
|
cp -R gitnexus/test/fixtures/mini-repo/src "${E2E_REPO}/src"
|
|
printf '%s\n' '{"name":"e2e-mini-repo","version":"0.0.0","private":true}' > "${E2E_REPO}/package.json"
|
|
node gitnexus/dist/cli/index.js analyze "${E2E_REPO}" --skip-git --skip-agents-md --name e2e-mini-repo
|
|
if [ ! -d "${E2E_REPO}/.gitnexus" ]; then
|
|
echo "::error::No fixture .gitnexus index created"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Start backend server
|
|
run: node dist/cli/index.js serve &
|
|
working-directory: gitnexus
|
|
|
|
- name: Wait for backend readiness
|
|
run: npx wait-on http://localhost:4747/api/repos --timeout 30000
|
|
working-directory: gitnexus-web
|
|
|
|
- name: Start Vite dev server
|
|
run: npm run dev &
|
|
working-directory: gitnexus-web
|
|
|
|
- name: Wait for Vite dev server
|
|
run: npx wait-on http://localhost:5173 --timeout 30000
|
|
working-directory: gitnexus-web
|
|
|
|
- name: Run E2E tests
|
|
run: npx playwright test
|
|
working-directory: gitnexus-web
|
|
env:
|
|
E2E: '1'
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: e2e-results
|
|
path: |
|
|
gitnexus-web/test-results/
|
|
gitnexus-web/playwright-report/
|
|
retention-days: 5
|