diff --git a/.github/workflows/mainloop-fork-ci.yaml b/.github/workflows/mainloop-fork-ci.yaml new file mode 100644 index 0000000000..46a7443933 --- /dev/null +++ b/.github/workflows/mainloop-fork-ci.yaml @@ -0,0 +1,51 @@ +name: Mainloop Fork Fixture CI + +on: + pull_request: + branches: [mainloop-substrate-0-4] + push: + branches: [mainloop-substrate-0-4] + workflow_dispatch: {} + +permissions: + contents: read + +jobs: + fixture-check: + name: ChatGPT refresh fixtures + runs-on: ubuntu-latest + timeout-minutes: 20 + defaults: + run: + shell: bash + working-directory: go + env: + GOFLAGS: -p=2 + GOMAXPROCS: "2" + steps: + - name: Checkout event source + # Keep the event default: PR merge candidate, push SHA, or dispatch SHA. + uses: actions/checkout@v6 + with: + persist-credentials: false + - name: Record tested source + env: + EVENT_NAME: ${{ github.event_name }} + SOURCE_REF: ${{ github.ref }} + EVENT_SHA: ${{ github.sha }} + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + checkout_sha=$(git rev-parse HEAD) + printf 'Event: %s\nRef: %s\nEvent SHA: %s\nCheckout SHA: %s\nPR head SHA: %s\n' \ + "$EVENT_NAME" "$SOURCE_REF" "$EVENT_SHA" "$checkout_sha" "$PR_HEAD_SHA" \ + | tee -a "$GITHUB_STEP_SUMMARY" + test "$checkout_sha" = "$EVENT_SHA" + - name: Set up Go + uses: actions/setup-go@v7 + with: + go-version-file: go/go.mod + cache: false + - name: Test refresh fixtures + run: go test ./core/internal/controller/chatgptrefresh -count=1 -timeout=180s + - name: Vet refresh package + run: go vet ./core/internal/controller/chatgptrefresh diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index ecd10cf4ca..eb10d5cbd4 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -43,6 +43,32 @@ When making changes to `kagent`, the most important thing is to figure out which - [go](go): Contains the code for the kubernetes controller, and the CLI. - [ui](ui): Contains the code for the web UI. +## Mainloop fork fixture gate + +In `oldsj/kagent`, `.github/workflows/mainloop-fork-ci.yaml` runs the +`chatgptrefresh` package's fixture tests (`-count=1 -timeout=180s`) and `go vet` +on a standard GitHub-hosted runner. It runs for pull requests targeting +`mainloop-substrate-0-4`, pushes to that branch, and manual dispatches, without +path filters. The upstream CI workflow is unchanged. + +PR runs test GitHub's merge candidate; push and manual runs test the event's +commit. The run summary records the ref, event SHA, checkout SHA, and PR head +SHA so publication checks can be matched to the intended source. After +publication, when the workflow is available for dispatch on the default branch, +select the source branch in **Run workflow** or use: + +```shell +gh workflow run mainloop-fork-ci.yaml --repo oldsj/kagent --ref SOURCE_BRANCH +``` + +Verify the recorded SHA against the published candidate before accepting a +remote result. Bootstrap fixtures participate once their changes are in the +tested checkout. This gate uses synthetic credentials, fake Kubernetes clients, +and a fixture CLI; it needs no provider secrets or subscription. Image builds +and publication, live provider calls, and container/Kubernetes E2E suites remain +separate, opt-in validation. A passing fixture gate does not prove image CI, +live credential refresh, or deployment readiness. + ## Nightly releases The [Nightly Release workflow](https://github.com/kagent-dev/kagent/actions/workflows/nightly.yaml)