From 0fa6650873695db4dbbab736b7ec8252515055a5 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 16:05:03 -0500 Subject: [PATCH 01/11] chore: test ci From f64776d74ee0b5b85c40332e03e51ea124e9a078 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 16:17:56 -0500 Subject: [PATCH 02/11] skip tests --- .github/workflows/ci.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c233d19ee4..f351301be3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,11 +41,11 @@ jobs: echo "and it will start over with a clean cache." echo "The old one will disappear after 7 days." - - name: Unit Tests - run: bazel --batch test //:units --noshow_progress --test_output=errors - - - name: Integration Tests - run: bazel --batch test //test/integration/... +# - name: Unit Tests +# run: bazel --batch test //:units --noshow_progress --test_output=errors +# +# - name: Integration Tests +# run: bazel --batch test //test/integration/... - name: Gradle Build Generated Storage Client Library run: | From d02e8f927f323a32fefdb789705e5448eddcaf66 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 16:21:05 -0500 Subject: [PATCH 03/11] no cache --- .github/workflows/ci.yaml | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f351301be3..c79d0568b0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,28 +19,28 @@ jobs: distribution: temurin - run: java -version - - name: Bazel File Cache Setup - id: cache-bazel - uses: actions/cache@v3 - with: - path: ~/.cache/bazel - key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }} - - - name: Bazel Cache Not Found - if: steps.cache-bazel.outputs.cache-hit != 'true' - run: | - echo "No cache found." - - name: Bazel Cache Found - if: steps.cache-bazel.outputs.cache-hit == 'true' - run: | - echo -n "Cache found. Cache size: " - du -sh ~/.cache/bazel - echo "If the cache seems broken, update the CACHE_VERSION secret in" - echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions" - echo "(use any random string, any GUID will work)" - echo "and it will start over with a clean cache." - echo "The old one will disappear after 7 days." - +# - name: Bazel File Cache Setup +# id: cache-bazel +# uses: actions/cache@v3 +# with: +# path: ~/.cache/bazel +# key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }} +# +# - name: Bazel Cache Not Found +# if: steps.cache-bazel.outputs.cache-hit != 'true' +# run: | +# echo "No cache found." +# - name: Bazel Cache Found +# if: steps.cache-bazel.outputs.cache-hit == 'true' +# run: | +# echo -n "Cache found. Cache size: " +# du -sh ~/.cache/bazel +# echo "If the cache seems broken, update the CACHE_VERSION secret in" +# echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions" +# echo "(use any random string, any GUID will work)" +# echo "and it will start over with a clean cache." +# echo "The old one will disappear after 7 days." +# # - name: Unit Tests # run: bazel --batch test //:units --noshow_progress --test_output=errors # From 4503c897b05bef5e30824b039ac7552f2e5af5db Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 16:40:59 -0500 Subject: [PATCH 04/11] specifying container https://github.com/googleapis/googleapis/blob/d5d4072128f7ac00885e1e9dc69757855c575580/.github/workflows/diregapic.yaml --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c79d0568b0..76393f1abc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,7 @@ name: ci jobs: build: runs-on: ubuntu-latest - + container: gcr.io/gapic-images/googleapis:20220711 strategy: matrix: java: [ 8, 11 ] From c638938ea09fdf0c93af3fe7e06ac93520283642 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 16:48:58 -0500 Subject: [PATCH 05/11] split integration test from client generation test --- .github/workflows/ci.yaml | 125 ++++++++++++++++++++++++-------------- 1 file changed, 80 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 76393f1abc..ed4094225d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,6 +9,7 @@ jobs: runs-on: ubuntu-latest container: gcr.io/gapic-images/googleapis:20220711 strategy: + fail-fast: false matrix: java: [ 8, 11 ] steps: @@ -18,54 +19,31 @@ jobs: java-version: ${{ matrix.java }} distribution: temurin - run: java -version + - run: bazel version + - name: Bazel File Cache Setup + id: cache-bazel + uses: actions/cache@v3 + with: + path: ~/.cache/bazel + key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }} -# - name: Bazel File Cache Setup -# id: cache-bazel -# uses: actions/cache@v3 -# with: -# path: ~/.cache/bazel -# key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }} -# -# - name: Bazel Cache Not Found -# if: steps.cache-bazel.outputs.cache-hit != 'true' -# run: | -# echo "No cache found." -# - name: Bazel Cache Found -# if: steps.cache-bazel.outputs.cache-hit == 'true' -# run: | -# echo -n "Cache found. Cache size: " -# du -sh ~/.cache/bazel -# echo "If the cache seems broken, update the CACHE_VERSION secret in" -# echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions" -# echo "(use any random string, any GUID will work)" -# echo "and it will start over with a clean cache." -# echo "The old one will disappear after 7 days." -# -# - name: Unit Tests -# run: bazel --batch test //:units --noshow_progress --test_output=errors -# -# - name: Integration Tests -# run: bazel --batch test //test/integration/... - - - name: Gradle Build Generated Storage Client Library + - name: Bazel Cache Not Found + if: steps.cache-bazel.outputs.cache-hit != 'true' run: | - echo "Building Storage lib from generated source..." - mkdir /tmp/java-storage - bazel --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java - tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage - pushd /tmp/java-storage/google-cloud-storage-v2-java - ./gradlew clean build publishToMavenLocal sourcesJar allJars - popd - - - name: Gradle Build Generated Compute Client Library + echo "No cache found." + - name: Bazel Cache Found + if: steps.cache-bazel.outputs.cache-hit == 'true' run: | - echo "Building Compute lib from generated source..." - mkdir /tmp/java-compute - bazel --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java - tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute - pushd /tmp/java-compute/google-cloud-compute-small-v1-java - ./gradlew clean build publishToMavenLocal sourcesJar allJars - popd + echo -n "Cache found. Cache size: " + du -sh ~/.cache/bazel + echo "If the cache seems broken, update the CACHE_VERSION secret in" + echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions" + echo "(use any random string, any GUID will work)" + echo "and it will start over with a clean cache." + echo "The old one will disappear after 7 days." + + - name: Integration Tests + run: bazel --batch test //test/integration/... - uses: actions/upload-artifact@v3 if: ${{ failure() }} @@ -77,6 +55,63 @@ jobs: - name: Java Linter run: bazel --batch run //:google_java_format_verification + generate-client-libraries: + runs-on: ubuntu-latest + container: gcr.io/gapic-images/googleapis:20220711 + strategy: + fail-fast: false + matrix: + java: [ 8, 11 ] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} + distribution: temurin + - run: java -version + - run: bazel version + - name: Bazel File Cache Setup + id: cache-bazel + uses: actions/cache@v3 + with: + path: ~/.cache/bazel + key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }} + + - name: Bazel Cache Not Found + if: steps.cache-bazel.outputs.cache-hit != 'true' + run: | + echo "No cache found." + - name: Bazel Cache Found + if: steps.cache-bazel.outputs.cache-hit == 'true' + run: | + echo -n "Cache found. Cache size: " + du -sh ~/.cache/bazel + echo "If the cache seems broken, update the CACHE_VERSION secret in" + echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions" + echo "(use any random string, any GUID will work)" + echo "and it will start over with a clean cache." + echo "The old one will disappear after 7 days." + + - name: Gradle Build Generated Storage Client Library + run: | + echo "Building Storage lib from generated source..." + mkdir /tmp/java-storage + bazel --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java + tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage + pushd /tmp/java-storage/google-cloud-storage-v2-java + ./gradlew clean build publishToMavenLocal sourcesJar allJars + popd + + - name: Gradle Build Generated Compute Client Library + run: | + echo "Building Compute lib from generated source..." + mkdir /tmp/java-compute + bazel --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java + tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute + pushd /tmp/java-compute/google-cloud-compute-small-v1-java + ./gradlew clean build publishToMavenLocal sourcesJar allJars + popd + coverage: runs-on: ubuntu-latest steps: From 77ea607bd1e2e0aeb1c9a7207712f14d580ceda6 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 16:52:01 -0500 Subject: [PATCH 06/11] bazeliskrc to point 4.2.2 --- .bazeliskrc | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .bazeliskrc diff --git a/.bazeliskrc b/.bazeliskrc new file mode 100644 index 0000000000..463b45379f --- /dev/null +++ b/.bazeliskrc @@ -0,0 +1,2 @@ +# See https://github.com/bazelbuild/bazelisk +USE_BAZEL_VERSION=4.2.2 From 8cdbcf923aaebe441060b74273fba7dc16ffd9fe Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 16:54:04 -0500 Subject: [PATCH 07/11] note --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ed4094225d..ac475a7e15 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,6 +7,10 @@ name: ci jobs: build: runs-on: ubuntu-latest + # Using the same container as googleapis/googleapis repository ensures that + # we use the same Bazel version. The ubuntu-latest's Bazel version is + # occasionally upgraded automatically without a notice. + # https://github.com/googleapis/googleapis/blob/master/.github/workflows/diregapic.yaml#L11 container: gcr.io/gapic-images/googleapis:20220711 strategy: fail-fast: false From 550b256b9a17a27783e674399727da6440470d94 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 17:02:30 -0500 Subject: [PATCH 08/11] use bazelisk rather than bazel --- .github/workflows/ci.yaml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ac475a7e15..9f2ed25cf6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,11 +7,6 @@ name: ci jobs: build: runs-on: ubuntu-latest - # Using the same container as googleapis/googleapis repository ensures that - # we use the same Bazel version. The ubuntu-latest's Bazel version is - # occasionally upgraded automatically without a notice. - # https://github.com/googleapis/googleapis/blob/master/.github/workflows/diregapic.yaml#L11 - container: gcr.io/gapic-images/googleapis:20220711 strategy: fail-fast: false matrix: @@ -23,7 +18,7 @@ jobs: java-version: ${{ matrix.java }} distribution: temurin - run: java -version - - run: bazel version + - run: bazelisk version - name: Bazel File Cache Setup id: cache-bazel uses: actions/cache@v3 @@ -47,7 +42,7 @@ jobs: echo "The old one will disappear after 7 days." - name: Integration Tests - run: bazel --batch test //test/integration/... + run: bazelisk --batch test //test/integration/... - uses: actions/upload-artifact@v3 if: ${{ failure() }} @@ -57,7 +52,7 @@ jobs: retention-days: 5 - name: Java Linter - run: bazel --batch run //:google_java_format_verification + run: bazelisk --batch run //:google_java_format_verification generate-client-libraries: runs-on: ubuntu-latest @@ -73,7 +68,7 @@ jobs: java-version: ${{ matrix.java }} distribution: temurin - run: java -version - - run: bazel version + - run: bazelisk version - name: Bazel File Cache Setup id: cache-bazel uses: actions/cache@v3 @@ -100,7 +95,7 @@ jobs: run: | echo "Building Storage lib from generated source..." mkdir /tmp/java-storage - bazel --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java + bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage pushd /tmp/java-storage/google-cloud-storage-v2-java ./gradlew clean build publishToMavenLocal sourcesJar allJars @@ -110,7 +105,7 @@ jobs: run: | echo "Building Compute lib from generated source..." mkdir /tmp/java-compute - bazel --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java + bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute pushd /tmp/java-compute/google-cloud-compute-small-v1-java ./gradlew clean build publishToMavenLocal sourcesJar allJars @@ -127,7 +122,7 @@ jobs: - name: Generate Code Coverage Report # Run only test targets, and not golden_update targets. - run: bazel coverage //:units --combined_report=lcov + run: bazelisk coverage //:units --combined_report=lcov license-header: runs-on: ubuntu-latest From c584eee97bbd438fe711770adc4adcccb4d070cc Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 17:04:35 -0500 Subject: [PATCH 09/11] remove container field --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9f2ed25cf6..2e8996b89a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -56,7 +56,6 @@ jobs: generate-client-libraries: runs-on: ubuntu-latest - container: gcr.io/gapic-images/googleapis:20220711 strategy: fail-fast: false matrix: From b6e3618594bb872576a97158f8b5b4b76a1ba836 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 17:07:23 -0500 Subject: [PATCH 10/11] remove coverage --- .github/workflows/ci.yaml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2e8996b89a..a48a43d1cd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -110,19 +110,6 @@ jobs: ./gradlew clean build publishToMavenLocal sourcesJar allJars popd - coverage: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v3 - with: - java-version: 8 - - run: java -version - - - name: Generate Code Coverage Report - # Run only test targets, and not golden_update targets. - run: bazelisk coverage //:units --combined_report=lcov - license-header: runs-on: ubuntu-latest steps: From df612a88ca492333b7cf7e8c6a2fd919a06f0f40 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 19 Dec 2022 18:11:18 -0500 Subject: [PATCH 11/11] remove Bazel-based lint --- .github/workflows/ci.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a48a43d1cd..31a446e08b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,9 +51,6 @@ jobs: path: ~/.cache/bazel/*/*/*/gapic_generator_java/bazel-out/*/testlogs/* retention-days: 5 - - name: Java Linter - run: bazelisk --batch run //:google_java_format_verification - generate-client-libraries: runs-on: ubuntu-latest strategy: