mirror of
https://github.com/ModernRelay/omnigraph.git
synced 2026-06-15 01:55:13 +02:00
Fold openapi.json auto-sync into main CI test job
The separate openapi-sync workflow was duplicating the workspace build (~15 min cold-cache compile), paying the cost twice per PR. Fold the regen + auto-commit into the existing test job: one compile, shared rust-cache, same drift-check semantics. - Same-repo PRs: OMNIGRAPH_UPDATE_OPENAPI=1 during the test run, then commit the regenerated spec back to the PR branch - Fork PRs / pushes: env var empty, test stays in strict drift-check mode - openapi_spec_is_up_to_date treats empty env value as unset, so the conditional workflow env expression works Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9de2079263
commit
a157f6a17c
3 changed files with 42 additions and 64 deletions
41
.github/workflows/ci.yml
vendored
41
.github/workflows/ci.yml
vendored
|
|
@ -105,7 +105,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
permissions:
|
||||
contents: read
|
||||
contents: write
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
steps:
|
||||
|
|
@ -113,8 +113,22 @@ jobs:
|
|||
if: needs.classify_changes.outputs.run_full_ci != 'true'
|
||||
run: echo "Text-only change detected; skipping workspace test run."
|
||||
|
||||
- name: Checkout source
|
||||
if: needs.classify_changes.outputs.run_full_ci == 'true'
|
||||
# For same-repo PRs, check out the PR branch head directly so we can push
|
||||
# a regenerated openapi.json back to it. Fork PRs and push events use the
|
||||
# default checkout (which is read-only for our purposes).
|
||||
- name: Checkout (same-repo PR head)
|
||||
if: |
|
||||
needs.classify_changes.outputs.run_full_ci == 'true' &&
|
||||
github.event_name == 'pull_request' &&
|
||||
github.event.pull_request.head.repo.full_name == github.repository
|
||||
uses: actions/checkout@v5.0.1
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Checkout (default)
|
||||
if: |
|
||||
needs.classify_changes.outputs.run_full_ci == 'true' &&
|
||||
!(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
uses: actions/checkout@v5.0.1
|
||||
|
||||
- name: Install system dependencies
|
||||
|
|
@ -138,8 +152,29 @@ jobs:
|
|||
|
||||
- name: Run workspace tests
|
||||
if: needs.classify_changes.outputs.run_full_ci == 'true'
|
||||
# On same-repo PRs, regenerate openapi.json as part of the drift test
|
||||
# so the following step can commit the update. Elsewhere the env var
|
||||
# is empty, leaving the drift test in strict-check mode.
|
||||
env:
|
||||
OMNIGRAPH_UPDATE_OPENAPI: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) && '1' || '' }}
|
||||
run: cargo test --workspace --locked
|
||||
|
||||
- name: Commit regenerated openapi.json
|
||||
if: |
|
||||
needs.classify_changes.outputs.run_full_ci == 'true' &&
|
||||
github.event_name == 'pull_request' &&
|
||||
github.event.pull_request.head.repo.full_name == github.repository
|
||||
run: |
|
||||
if git diff --quiet -- openapi.json; then
|
||||
echo "openapi.json is already in sync."
|
||||
exit 0
|
||||
fi
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add openapi.json
|
||||
git commit -m "chore: regenerate openapi.json"
|
||||
git push
|
||||
|
||||
test_aws_feature:
|
||||
name: Test omnigraph-server --features aws
|
||||
needs: classify_changes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue