Skip to content

ci-presubmit

ci-presubmit #27390

Workflow file for this run

# Copyright 2025 Google LLC
#
# 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.
# Generated by dev/tasks/generate-github-actions. DO NOT EDIT.
name: ci-presubmit
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- '**'
- '!experiments/**'
push:
branches: ["master", "release-*"]
paths:
- '**'
- '!experiments/**'
merge_group:
types: [checks_requested]
branches: ["master", "release-*"]
paths:
- '**'
- '!experiments/**'
jobs:
prepare-test-matrix:
runs-on: ubuntu-latest
outputs:
has_priority_tests: ${{ steps.split.outputs.has_priority_tests }}
priority_fixtures_json: ${{ steps.split.outputs.priority_fixtures_json }}
remaining_fixtures_json: ${{ steps.split.outputs.remaining_fixtures_json }}
samples_json: ${{ steps.split.outputs.samples_json }}
scenarios_json: ${{ steps.split.outputs.scenarios_json }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Split test matrix between priority and non-priority
id: split
run: ./dev/tasks/split-test-matrix
capture-pprof:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/capture-pprof"
run: |
./dev/ci/presubmits/capture-pprof
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-capture-pprof
path: /tmp/artifacts/
fuzz-roundtrippers:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/fuzz-roundtrippers"
run: |
./dev/ci/presubmits/fuzz-roundtrippers
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-fuzz-roundtrippers
path: /tmp/artifacts/
golangci-lint:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Free up disk space
run: dev/tasks/free-disk-space-on-github-actions-runner
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: 'go.mod'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.9.0
args: --timeout=20m
license-lint:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/license-lint"
run: |
./dev/ci/presubmits/license-lint
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-license-lint
path: /tmp/artifacts/
run-linters:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/run-linters"
run: |
./dev/ci/presubmits/run-linters
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-run-linters
path: /tmp/artifacts/
smoketest-with-kind:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/smoketest-with-kind"
run: |
./dev/ci/presubmits/smoketest-with-kind
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-smoketest-with-kind
path: /tmp/artifacts/
test-mockgcp:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- uses: 'google-github-actions/setup-gcloud@v3'
with:
version: '546.0.0'
install_components: 'alpha,beta'
- name: "Run dev/ci/presubmits/test-mockgcp"
run: |
./dev/ci/presubmits/test-mockgcp
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-test-mockgcp
path: /tmp/artifacts/
test-pause:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/test-pause"
run: |
./dev/ci/presubmits/test-pause
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-test-pause
path: /tmp/artifacts/
tests-e2e-direct-iam:
runs-on: ubuntu-latest
needs: unit-tests
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/tests-e2e-direct-iam"
run: |
./dev/ci/presubmits/tests-e2e-direct-iam
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-tests-e2e-direct-iam
path: /tmp/artifacts/
tests-e2e-fixtures:
runs-on: ubuntu-latest
needs: unit-tests
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/tests-e2e-fixtures"
run: |
./dev/ci/presubmits/tests-e2e-fixtures
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-tests-e2e-fixtures
path: /tmp/artifacts/
priority-e2e-fixtures:
name: "tests-e2e-fixtures-${{ matrix.service }}"
runs-on: ubuntu-latest
needs: prepare-test-matrix
if: needs.prepare-test-matrix.outputs.has_priority_tests == 'true'
timeout-minutes: 60
strategy:
fail-fast: true
matrix:
service: ${{ fromJSON(needs.prepare-test-matrix.outputs.priority_fixtures_json) }}
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- uses: 'google-github-actions/setup-gcloud@v3'
with:
version: '546.0.0'
install_components: 'alpha,beta'
- name: "Run priority E2E fixtures for ${{ matrix.service }}"
run: |
./dev/ci/presubmits/tests-e2e-fixtures-${{ matrix.service }}
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-priority-e2e-fixtures-${{ matrix.service }}
path: /tmp/artifacts/
tests-e2e-fixtures-matrix:
name: "tests-e2e-fixtures-${{ matrix.service }}"
runs-on: ubuntu-latest
needs: [prepare-test-matrix, priority-e2e-fixtures, unit-tests]
if: ${{ !cancelled() && needs.priority-e2e-fixtures.result != 'failure' && needs.unit-tests.result == 'success' }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
service: ${{ fromJSON(needs.prepare-test-matrix.outputs.remaining_fixtures_json) }}
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- uses: 'google-github-actions/setup-gcloud@v3'
with:
version: '546.0.0'
install_components: 'alpha,beta'
- name: "Run dev/ci/presubmits/tests-e2e-fixtures-${{ matrix.service }}"
run: |
./dev/ci/presubmits/tests-e2e-fixtures-${{ matrix.service }}
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-tests-e2e-fixtures-${{ matrix.service }}
path: /tmp/artifacts/
tests-e2e-samples-matrix:
name: "tests-e2e-samples-${{ matrix.service }}"
runs-on: ubuntu-latest
needs: [prepare-test-matrix, priority-e2e-fixtures, unit-tests]
if: ${{ !cancelled() && needs.priority-e2e-fixtures.result != 'failure' && needs.unit-tests.result == 'success' }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
service: ${{ fromJSON(needs.prepare-test-matrix.outputs.samples_json) }}
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- uses: 'google-github-actions/setup-gcloud@v3'
with:
version: '546.0.0'
install_components: 'alpha,beta'
- name: "Run dev/ci/presubmits/tests-e2e-samples-${{ matrix.service }}"
run: |
./dev/ci/presubmits/tests-e2e-samples-${{ matrix.service }}
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-tests-e2e-samples-${{ matrix.service }}
path: /tmp/artifacts/
tests-gcptracker:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/tests-gcptracker"
run: |
./dev/ci/presubmits/tests-gcptracker
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-tests-gcptracker
path: /tmp/artifacts/
tests-preview:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/tests-preview"
run: |
./dev/ci/presubmits/tests-preview
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-tests-preview
path: /tmp/artifacts/
tests-scenarios-matrix:
name: "tests-scenarios-${{ matrix.suite }}"
runs-on: ubuntu-latest
needs: [prepare-test-matrix, priority-e2e-fixtures, unit-tests]
if: ${{ !cancelled() && needs.priority-e2e-fixtures.result != 'failure' && needs.unit-tests.result == 'success' }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
suite: ${{ fromJSON(needs.prepare-test-matrix.outputs.scenarios_json) }}
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- uses: 'google-github-actions/setup-gcloud@v3'
with:
version: '546.0.0'
install_components: 'alpha,beta'
- name: "Run dev/ci/presubmits/tests-scenarios-${{ matrix.suite }}"
run: |
./dev/ci/presubmits/tests-scenarios-${{ matrix.suite }}
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-tests-scenarios-${{ matrix.suite }}
path: /tmp/artifacts/
unit-tests:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- name: Free up disk space
run: dev/tasks/free-disk-space-on-github-actions-runner
- uses: ./dev/actions/cache-go
- uses: 'google-github-actions/setup-gcloud@v3'
with:
version: '546.0.0'
install_components: 'alpha,beta'
- name: "Run dev/ci/presubmits/unit-tests"
run: |
./dev/ci/presubmits/unit-tests
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-unit-tests
path: /tmp/artifacts/
unit-tests-operator:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- name: Free up disk space
run: dev/tasks/free-disk-space-on-github-actions-runner
- uses: ./dev/actions/cache-go
- uses: 'google-github-actions/setup-gcloud@v3'
with:
version: '546.0.0'
install_components: 'alpha,beta'
- name: "Run dev/ci/presubmits/unit-tests-operator"
run: |
./dev/ci/presubmits/unit-tests-operator
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-unit-tests-operator
path: /tmp/artifacts/
validate-generated-files:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/validate-generated-files"
run: |
./dev/ci/presubmits/validate-generated-files
env:
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-validate-generated-files
path: /tmp/artifacts/
validate-untested-fields:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: ./dev/actions/cache-go
- name: "Run dev/ci/presubmits/validate-untested-fields"
run: |
./dev/ci/presubmits/validate-untested-fields
env:
COMMIT_HEAD: ${{ github.event.pull_request.head.sha }}
BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
ARTIFACTS: /tmp/artifacts
- name: "Upload artifacts"
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: artifacts-validate-untested-fields
path: /tmp/artifacts/
presubmit-gatekeeper:
needs:
- prepare-test-matrix
- capture-pprof
- fuzz-roundtrippers
- golangci-lint
- license-lint
- run-linters
- smoketest-with-kind
- test-mockgcp
- test-pause
- tests-e2e-direct-iam
- tests-e2e-fixtures
- priority-e2e-fixtures
- tests-e2e-fixtures-matrix
- tests-e2e-samples-matrix
- tests-gcptracker
- tests-preview
- tests-scenarios-matrix
- unit-tests
- unit-tests-operator
- validate-generated-files
- validate-untested-fields
runs-on: ubuntu-latest
if: ${{ !cancelled() }} # Ensure this runs even if some dependencies fail, but not if the workflow is cancelled
steps:
- name: Verify all checks succeeded
run: |
results='${{ toJSON(needs) }}'
echo "Analyzing job results..."
# Find any job whose result is 'failure' or 'cancelled' (ignoring 'success' and 'skipped')
failures=$(echo "$results" | jq '[to_entries[] | select(.value.result == "failure" or .value.result == "cancelled")]')
if [ "$(echo "$failures" | jq '. | length')" -ne 0 ]; then
echo "ERROR: One or more checks failed or were cancelled:"
echo "$failures" | jq '.[] | {job: .key, result: .value.result}'
exit 1
fi
echo "All checks completed successfully or were skipped safely!"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true