From ceb033eb26b98d7b0da4c3f2ee6eeecf15d9bfa0 Mon Sep 17 00:00:00 2001 From: Blake Li Date: Tue, 10 Feb 2026 18:21:43 -0500 Subject: [PATCH] ci: configure the protected branch (#7378) --- .github/workflows/bom-content-test.yaml | 70 ++++++------ .github/workflows/ci-validate-bom.yaml | 64 ++++------- .github/workflows/ci.yaml | 146 +++++++++++------------- .github/workflows/dashboard.yaml | 50 ++++---- 4 files changed, 152 insertions(+), 178 deletions(-) diff --git a/.github/workflows/bom-content-test.yaml b/.github/workflows/bom-content-test.yaml index 635bd318ae40..084060e956a4 100644 --- a/.github/workflows/bom-content-test.yaml +++ b/.github/workflows/bom-content-test.yaml @@ -1,49 +1,47 @@ -on: +'on': push: branches: - - main - pull_request: + - 26.75.x + pull_request: null name: ci jobs: bom-content-test: runs-on: ubuntu-latest if: github.repository_owner == 'googleapis' steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: 11 - cache: maven - - run: java -version - - name: Install BOMs - run: | - mvn -B -V -ntp install - - name: Ensure the members of the Libraries BOM exist in Maven Central - uses: ./tests/validate-bom - with: - bom-path: libraries-bom/pom.xml - - name: Ensure the BOM has valid content (at releases) - if: github.head_ref == 'release-please--branches--main' - run: | - mvn -B -V -ntp verify -Dtest="BomContentTest#testLibrariesBom" - working-directory: tests - + - uses: actions/checkout@v4 + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 11 + cache: maven + - run: java -version + - name: Install BOMs + run: | + mvn -B -V -ntp install + - name: Ensure the members of the Libraries BOM exist in Maven Central + uses: ./tests/validate-bom + with: + bom-path: libraries-bom/pom.xml + - name: Ensure the BOM has valid content (at releases) + if: github.head_ref == 'release-please--branches--main' + run: | + mvn -B -V -ntp verify -Dtest="BomContentTest#testLibrariesBom" + working-directory: tests bom-assertion-test: name: BomContentAssertionsTest (Test for assertion logic in BomContentTest) runs-on: ubuntu-latest if: github.repository_owner == 'googleapis' steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v5 - with: - distribution: zulu - java-version: 8 - - run: java -version - - name: Install BOMs - run: | - mvn -B -V -ntp install - - run: | - mvn -B -V -ntp verify -Dtest="BomContentAssertionsTest" - working-directory: tests - + - uses: actions/checkout@v4 + - uses: actions/setup-java@v5 + with: + distribution: zulu + java-version: 8 + - run: java -version + - name: Install BOMs + run: | + mvn -B -V -ntp install + - run: | + mvn -B -V -ntp verify -Dtest="BomContentAssertionsTest" + working-directory: tests diff --git a/.github/workflows/ci-validate-bom.yaml b/.github/workflows/ci-validate-bom.yaml index e8b2e0048a3d..f1663f9760b4 100644 --- a/.github/workflows/ci-validate-bom.yaml +++ b/.github/workflows/ci-validate-bom.yaml @@ -1,46 +1,32 @@ -# Copyright 2023 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. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: +'on': push: branches: - - main - pull_request: + - 26.75.x + pull_request: null name: test for tests/validate-bom logic jobs: test-invalid-bom: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Fetch the bad protobuf-bom version 3.22.1 - shell: bash - # 3.22.1 had a issue in their pom.xml - # https://github.com/protocolbuffers/protobuf/issues/12170 - run: | - mkdir -p bad-protobuf-bom - curl https://repo1.maven.org/maven2/com/google/protobuf/protobuf-bom/3.22.1/protobuf-bom-3.22.1.pom \ - --output bad-protobuf-bom/pom.xml - - name: Check the bad BOM - uses: ./tests/validate-bom - id: validate-bom - with: - bom-path: bad-protobuf-bom/pom.xml - continue-on-error: true - - name: Ensure the validate-bom invalidated the bad BOM - shell: bash - if: steps.validate-bom.outcome != 'failure' - run: | - echo "The validate-bom check should have invalidated the bad BOM" - exit 1 + - uses: actions/checkout@v4 + - name: Fetch the bad protobuf-bom version 3.22.1 + shell: bash + run: > + mkdir -p bad-protobuf-bom + + curl + https://repo1.maven.org/maven2/com/google/protobuf/protobuf-bom/3.22.1/protobuf-bom-3.22.1.pom + \ + --output bad-protobuf-bom/pom.xml + - name: Check the bad BOM + uses: ./tests/validate-bom + id: validate-bom + with: + bom-path: bad-protobuf-bom/pom.xml + continue-on-error: true + - name: Ensure the validate-bom invalidated the bad BOM + shell: bash + if: steps.validate-bom.outcome != 'failure' + run: | + echo "The validate-bom check should have invalidated the bad BOM" + exit 1 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 686618a93038..9b031e8dc279 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,23 +1,8 @@ -# Copyright 2022 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. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: +'on': push: branches: - - main - pull_request: + - 26.75.x + pull_request: null name: ci jobs: units: @@ -25,20 +10,22 @@ jobs: strategy: fail-fast: false matrix: - java: [11, 17, 21] + java: + - 11 + - 17 + - 21 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: ${{matrix.java}} - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: test + - uses: actions/checkout@v4 + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: test units-java8: - # Building using Java 17 and run the tests with Java 8 runtime - name: "units (8)" + name: units (8) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -46,9 +33,9 @@ jobs: with: java-version: 8 distribution: temurin - - name: "Set jvm system property environment variable for surefire plugin (unit tests)" - # Maven surefire plugin (unit tests) allows us to specify JVM to run the tests. - # https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm + - name: >- + Set jvm system property environment variable for surefire plugin (unit + tests) run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV shell: bash - uses: actions/setup-java@v5 @@ -61,63 +48,64 @@ jobs: windows: runs-on: windows-latest steps: - - name: Support longpaths - run: git config --system core.longpaths true - - uses: actions/checkout@v4 - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: 8 - - run: java -version - - run: .kokoro/build.bat - env: - JOB_TYPE: test + - name: Support longpaths + run: git config --system core.longpaths true + - uses: actions/checkout@v4 + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 8 + - run: java -version + - run: .kokoro/build.bat + env: + JOB_TYPE: test dependencies: runs-on: ubuntu-latest strategy: matrix: - java: [17] + java: + - 17 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: ${{matrix.java}} - - run: java -version - - run: .kokoro/dependencies.sh + - uses: actions/checkout@v4 + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/dependencies.sh javadoc: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: 17 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: javadoc + - uses: actions/checkout@v4 + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 17 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: javadoc lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: 11 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: lint + - uses: actions/checkout@v4 + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 11 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: lint clirr: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: 8 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: clirr + - uses: actions/checkout@v4 + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 8 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: clirr diff --git a/.github/workflows/dashboard.yaml b/.github/workflows/dashboard.yaml index db2bdb849576..fb267596dc08 100644 --- a/.github/workflows/dashboard.yaml +++ b/.github/workflows/dashboard.yaml @@ -1,34 +1,36 @@ -on: +'on': push: branches: - - main - pull_request: + - 26.75.x + pull_request: null name: ci jobs: dashboard: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: 8 - cache: maven - - run: java -version - - run: .kokoro/dashboard.sh - env: - JOB_TYPE: dashboard-units-check + - uses: actions/checkout@v4 + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 8 + cache: maven + - run: java -version + - run: .kokoro/dashboard.sh + env: + JOB_TYPE: dashboard-units-check shared-dependencies-convergence: runs-on: ubuntu-latest - if: github.repository_owner == 'googleapis' && github.head_ref == 'release-please--branches--main' + if: >- + github.repository_owner == 'googleapis' && github.head_ref == + 'release-please--branches--main' steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: 8 - cache: maven - - run: java -version - - run: .kokoro/dashboard.sh - env: - JOB_TYPE: dependency-convergence-check + - uses: actions/checkout@v4 + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 8 + cache: maven + - run: java -version + - run: .kokoro/dashboard.sh + env: + JOB_TYPE: dependency-convergence-check