Skip to content

[exporter/loadbalancing] transition from Endpoints to EndpointSlices #14409

[exporter/loadbalancing] transition from Endpoints to EndpointSlices

[exporter/loadbalancing] transition from Endpoints to EndpointSlices #14409

Workflow file for this run

name: scoped-test
on:
push:
branches: [ main ]
pull_request:
types: [opened, synchronize, reopened]
permissions: read-all
jobs:
changedfiles:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
env:
PR_HEAD: ${{ github.event.pull_request.head.sha }}
outputs:
go_sources: ${{ steps.changes.outputs.go_sources }}
go_tests: ${{ steps.changes.outputs.go_tests }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Get changes
shell: bash
id: changes
run: |
changed_files=$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main $PR_HEAD) $PR_HEAD)
echo changed_files
echo $changed_files
go_sources=$(echo "$changed_files" | tr ' ' '\n' | grep -E '\.go$' | grep -v -E '.*_test\.go$' || true)
echo go_sources
echo $go_sources
if [[ -n "$go_sources" ]]; then
{
echo 'go_sources<<EOF'
echo $go_sources
echo EOF
} >> $GITHUB_OUTPUT
fi
go_tests=$(echo "$changed_files" | tr ' ' '\n' | grep -E '.*_test\.go$' || true)
echo go_tests
echo $go_tests
if [[ -n "$go_tests" ]]; then
{
echo 'go_tests<<EOF'
echo $go_tests
echo EOF
} >> $GITHUB_OUTPUT
fi
scoped-tests:
needs: changedfiles
if: needs.changedfiles.outputs.go_sources != '' || needs.changedfiles.outputs.go_tests != ''
runs-on: windows-latest
steps:
- name: Echo changed files
shell: bash
run: |
echo "go_sources: ${{ needs.changedfiles.outputs.go_sources }}"
echo "go_tests: ${{ needs.changedfiles.outputs.go_tests }}"
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version: 1.23.10
cache: false
- name: Try to restore go-cache
id: go-cache
timeout-minutes: 25
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Build gotestsum on Windows
if: runner.os == 'Windows'
run: make "$(${PWD} -replace '\\', '/')/.tools/gotestsum"
- name: Build gotestsum
if: runner.os != 'Windows'
run: make "$PWD/.tools/gotestsum"
- name: Run changed tests
if: needs.changedfiles.outputs.go_tests
env:
CHANGED_GOLANG_TESTS: ${{ needs.changedfiles.outputs.go_tests }}
run: |
make run-changed-tests
- name: Run tests on dependent components
if: needs.changedfiles.outputs.go_sources
env:
CHANGED_GOLANG_SOURCES: ${{ needs.changedfiles.outputs.go_sources }}
run: |
make for-affected-components CMD="make"