diff --git a/.github/workflows/generate_diffs.yaml b/.github/workflows/generate_diffs.yaml deleted file mode 100644 index ea67c68a3e32..000000000000 --- a/.github/workflows/generate_diffs.yaml +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2021 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. - -on: - workflow_dispatch: - push: - branches: - - main -name: monorepo-diff -jobs: - generate-diffs: - if: ${{ github.event_name != 'pull_request' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - repository: 'googleapis/google-cloud-java' - fetch-depth: 0 - - name: Run generate-diff script - run: ./generation/generate_diff.sh - env: - USERNAME: ${{ github.actor }} diff --git a/generation/generate_diff.sh b/generation/generate_diff.sh deleted file mode 100755 index 513a0c537fa1..000000000000 --- a/generation/generate_diff.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash - -set -e - -function retry_with_backoff { - attempts_left=$1 - sleep_seconds=$2 - shift 2 - command=$@ - - # store current flag state - flags=$- - - # allow a failures to continue - set +e - ${command} - exit_code=$? - - # restore "e" flag - if [[ ${flags} =~ e ]] - then set -e - else set +e - fi - - if [[ $exit_code == 0 ]] - then - return 0 - fi - - # failure - if [[ ${attempts_left} -gt 0 ]] - then - echo "failure (${exit_code}), sleeping ${sleep_seconds}..." - sleep ${sleep_seconds} - new_attempts=$((${attempts_left} - 1)) - new_sleep=$((${sleep_seconds} * 2)) - retry_with_backoff ${new_attempts} ${new_sleep} ${command} - fi - - return $exit_code -} - -[ -z "`git config user.email`" ] && git config --global user.email "${USERNAME:-script}@google.com" -[ -z "`git config user.name`" ] && git config --global user.name "${USERNAME:-script}" - -current_branch="main-diff" -diff_java_branch="main-diff_java" -diff_java_it_branch="main-diff_java_it" -diff_non_java_branch="main-diff_non_java" - -if [[ $(git branch | grep "${current_branch}$") ]]; then - git checkout "${current_branch}" -else - git checkout -b "${current_branch}" -fi - -if [[ $(git branch | grep "${diff_java_branch}$") ]]; then - git branch -D "${diff_java_branch}" -fi -if [[ $(git branch | grep "${diff_java_it_branch}$") ]]; then - git branch -D "${diff_java_it_branch}" -fi -if [[ $(git branch | grep "${diff_non_java_branch}$") ]]; then - git branch -D "${diff_non_java_branch}" -fi - -modules=$(mvn help:evaluate -Dexpression=project.modules | grep '<.*>.*' | grep 'java' | sed -e 's/<.*>\(.*\)<\/.*>/\1/g') - -for module in $modules; do - echo "Running for ${module}" - rm -rf "${module}" - url="https://github.com/googleapis/${module}" - if curl --output /dev/null --silent --head --fail "${url}"; then - retry_with_backoff 3 10 git clone "${url}" - rm -rf "${module}/.git" - fi - echo "Done running for ${module}" -done - -./generation/delete_non_generated_samples.sh - -git checkout -b "${diff_java_it_branch}" -git add "*/src/test/*IT*.java" -git add "*/src/test/*/integration/*.java" -git add "*/src/test/*/it/*.java" -git commit -m "chore: Adding java IT diffs" --no-verify -git push origin "${diff_java_it_branch}" --force - -git stash -git checkout "${current_branch}" -git stash pop - -# *.java and *.proto are connected -- Adding them to the same branch -git checkout -b "${diff_java_branch}" -git add "*.java" -git add "*.proto" -git commit -m "chore: Adding java diffs" --no-verify -git push origin "${diff_java_branch}" --force - -git stash -git checkout "${current_branch}" -git stash pop - -git checkout -b "${diff_non_java_branch}" - -git add . -ignore_list=("java-*/.github/*" "java-*/.kokoro/*" "java-*/samples/*" "java-*/CODE_OF_CONDUCT.md" "java-*/CONTRIBUTING.md" "java-*/LICENSE" "java-*/SECURITY.md" "java-*/java.header" "java-*/license-checks.xml" "java-*/renovate.json") - -for ignore in "${ignore_list[@]}" -do - git reset "${ignore}" -done -git commit -m "chore: Adding non-java diffs" --no-verify -git push origin "${diff_non_java_branch}" --force - -git checkout "${current_branch}" - -echo "Done running script" \ No newline at end of file