Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/scripts/pr-workflow/detect-code-change.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

# Copyright 2026 The Agent Substrate Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Writes code=true to $GITHUB_OUTPUT if HEAD changes any file outside the
# docs-only paths listed in CONTRIBUTING.md, and code=false otherwise. With no
# base commit (push and schedule runs) it writes code=true.
#
# Used by .github/workflows/pr-workflow.yaml.

set -o errexit -o nounset -o pipefail

base="${1:-}"
if [[ -z "${base}" ]]; then
echo "code=true" >> "${GITHUB_OUTPUT}"
exit 0
fi

git fetch --quiet --no-tags --depth=1 origin "${base}"

files="$(git diff --name-only --no-renames "${base}" HEAD)"

code=false
while IFS= read -r f; do
[[ -n "${f}" ]] || continue
case "${f}" in
docs/* | site/* | demos/*/README.md) ;;
*/*) code=true ;;
*.md) ;;
*) code=true ;;
esac
if [[ "${code}" == true ]]; then
break
fi
done <<< "${files}"

echo "code=${code}" >> "${GITHUB_OUTPUT}"
30 changes: 26 additions & 4 deletions .github/workflows/pr-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,21 @@ jobs:
env:
BASE_REF: ${{ github.base_ref || github.event.merge_group.base_ref }}
run: hack/verify/postgresql-migrations.sh "origin/${BASE_REF#refs/heads/}"
# Skips the e2e lanes when a pull request or merge group only changes the
# paths listed under "Docs-only changes" in CONTRIBUTING.md.
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
code: ${{ steps.diff.outputs.code }}
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Detect code changes
id: diff
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
run: .github/scripts/pr-workflow/detect-code-change.sh "${BASE_SHA}"
# Free x86-64 ubuntu-latest runners expose /dev/kvm (with a udev rule), so
# create-kind-cluster.sh mounts it and the micro-VM (kata + cloud-hypervisor)
# sandbox class works alongside gVisor.
Expand All @@ -218,6 +233,8 @@ jobs:
# below are written once and run for every dataplane, sandbox class and
# preview mode. The e2e-test job below reports the required checks.
e2e:
needs: changes
if: needs.changes.outputs.code == 'true'
name: >-
${{ format('e2e ({0}, {1}{2}{3})', matrix.dataplane, matrix.sandbox,
matrix.ip_family != 'ipv4' && format(', {0}', matrix.ip_family) || '',
Expand Down Expand Up @@ -441,13 +458,18 @@ jobs:
kubectl --context kind-kind get pods -A -l ate.dev/worker-pool \
-o 'custom-columns=:.metadata.namespace,:.metadata.name' --no-headers 2>/dev/null \
| while read -r ns name; do dump "$ns" "$name"; done
# The required check, so the branch rules don't list each lane. Passes only
# when every blocking lane passed.
# The required check, so the branch rules don't list each lane. Passes when
# every blocking lane passed, or when changes found only docs and the lanes
# skipped.
e2e-test:
needs: e2e
needs: [changes, e2e]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Require every blocking e2e lane to pass
run: test "${{ needs.e2e.result }}" = success
env:
# code is only set when changes succeeded, and code=false always
# skips the lanes.
PASSED: ${{ needs.e2e.result == 'success' || needs.changes.outputs.code == 'false' }}
run: test "${PASSED}" = true
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ hack/run-root-tests.sh

New privileged tests only need the `roottest.Require` call — no CI changes.

### Docs-only changes

A PR skips the e2e tests if it only changes these files:

* `docs/**`
* `site/**`
* `*.md` at the repository root
* `demos/*/README.md`

These PRs still run the unit tests, `hack/verify-all.sh` and the PostgreSQL
migration check.

### Copyright Headers

Every file containing source code must include copyright and license
Expand Down