Skip to content
This repository was archived by the owner on Jul 15, 2024. It is now read-only.

Commit b9ca69a

Browse files
chore: regenerate common templates (#256)
* build(java): switch to release-publish app for notifying GitHub of release status Source-Author: Jeff Ching <chingor@google.com> Source-Date: Wed Aug 26 21:48:06 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 019c7168faa0e56619f792693a8acdb30d6de19b Source-Link: googleapis/synthtool@019c716 * build(ci): enable auto-release for dependency-update-only releases Automatically perform a Java client library release when: 1. Only dependency updates are going out in the release since any releases containing bug fixes, build changes or new features should be supervised; 2. There are no outstanding/open dependency update pull requests in the repo. This is to avoid multiple/redundant releases; 3. It is a SNAPSHOT release which is automatically generated post regular release -- this requires no human supervision. Testing done in 5 java-bigquery* client library repos. Example: [chore: release 0.3.4 ](googleapis/java-bigqueryconnection#130) [chore: release 0.3.5-SNAPSHOT](googleapis/java-bigqueryconnection#131) Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Thu Sep 17 15:30:02 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 538a68019eb4a36a0cdfa4021f324dd01b784395 Source-Link: googleapis/synthtool@538a680 * chore(java): set yoshi-java as default CODEOWNER Source-Author: Jeff Ching <chingor@google.com> Source-Date: Mon Sep 21 09:00:06 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 80003a3de2d8a75f5b47cb2e77e018f7f0f776cc Source-Link: googleapis/synthtool@80003a3 * build(java): use yoshi-approver token for auto-approve Source-Author: Jeff Ching <chingor@google.com> Source-Date: Wed Sep 23 12:46:45 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 916c10e8581804df2b48a0f0457d848f3faa582e Source-Link: googleapis/synthtool@916c10e * chore(ci): skip autorelease workflow on non-release PRs Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Thu Sep 24 16:57:32 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 95dbe1bee3c7f7e52ddb24a54c37080620e0d1a2 Source-Link: googleapis/synthtool@95dbe1b * chore(ci): verify autorelease release PR content has changes Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Thu Sep 24 18:06:14 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: da29da32b3a988457b49ae290112b74f14b713cc Source-Link: googleapis/synthtool@da29da3 * chore(java): use separate autosynth job for README Split java README generation into a separate, per-repo continuous job running from Kokoro. We now generate a new job that runs on commits to the primary branch that strictly manages the README.md. This should prevent us from seeing the contextless autosynth PRs which are caused by non-proto/template upstream changes. Source-Author: Jeff Ching <chingor@google.com> Source-Date: Tue Sep 29 15:48:03 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: e6168630be3e31eede633ba2c6f1cd64248dec1c Source-Link: googleapis/synthtool@e616863 * build: rename samples lint workflow to checkstyle to disambiguate branch protection with unit lint Source-Author: BenWhitehead <BenWhitehead@users.noreply.github.com> Source-Date: Wed Sep 30 15:14:05 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 8a7a3021fe97aa0a3641db642fe2b767f1c8110f Source-Link: googleapis/synthtool@8a7a302 * build(java): readme.sh should be executable Source-Author: Jeff Ching <chingor@google.com> Source-Date: Wed Sep 30 13:20:04 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 0762e8ee2ec21cdfc4d82020b985a104feb0453b Source-Link: googleapis/synthtool@0762e8e * ci(java): suggest formatting fixes GitHub action config to run the java formatter and suggest inline fixes on the pull request. This was tested in java-asset: [example PR](googleapis/java-asset#392). Source-Author: Jeff Ching <chingor@google.com> Source-Date: Tue Oct 13 09:04:08 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: b65ef07d99946d23e900ef2cc490274a16edd336 Source-Link: googleapis/synthtool@b65ef07 * ci(java): restrict presubmit samples ITs to only snapshot This is to reduce resource consumption since we often times hit resource quota limit in samples testing. e.g. googleapis/java-bigquerydatatransfer#410 Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Thu Oct 15 17:16:14 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 27e0e916cbfdb3d5ff6639b686cc04f78a0b0386 Source-Link: googleapis/synthtool@27e0e91 * build(java): auto-approve README regeneration Source-Author: Jeff Ching <chingor@google.com> Source-Date: Thu Oct 15 16:04:06 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 7c5370937dd9ba9dcf9cd7d2af880a58b389b4f1 Source-Link: googleapis/synthtool@7c53709 * build(java): enable snippet-bot Source-Author: Jeff Ching <chingor@google.com> Source-Date: Mon Oct 19 16:13:57 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 5a506ec8765cc04f7e29f888b8e9b257d9a7ae11 Source-Link: googleapis/synthtool@5a506ec * Update publish_javadoc.sh We don't want quite as much and need to be in `target/devsite/reference`. Source-Author: Les Vogel <lesv@users.noreply.github.com> Source-Date: Thu Oct 22 14:10:05 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 9593c3b5b714cc9b17c445aee8834ac2b4b9348b Source-Link: googleapis/synthtool@9593c3b * chore(docs): update code of conduct of synthtool and templates Source-Author: Christopher Wilcox <crwilcox@google.com> Source-Date: Thu Oct 22 14:22:01 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 5f6ef0ec5501d33c4667885b37a7685a30d41a76 Source-Link: googleapis/synthtool@5f6ef0e * chore(ci): fix typo in restrict presubmit samples ITs to only snapshot Fixes below error in Java repos when googleapis/synthtool#804 was merged: ``` github/java-bigquerystorage/.kokoro/build.sh: line 81: pushd: {SAMPLES_DIR}: No such file or directory ``` Thanks @kolea2 for spotting this in Fusion build logs. cc @chingor13 Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Mon Oct 26 13:44:04 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: f68649c5f26bcff6817c6d21e90dac0fc71fef8e Source-Link: googleapis/synthtool@f68649c * chore(java): enable generated-files-bot This bot will comment on pull requests that modify templated files. For java, we configure to read from our 2 synth.metadata files: (primary templates and README) Source-Author: Jeff Ching <chingor@google.com> Source-Date: Fri Oct 30 14:22:02 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: b19b401571e77192f8dd38eab5fb2300a0de9324 Source-Link: googleapis/synthtool@b19b401 * chore(java): use production staging bucket Source-Author: Les Vogel <lesv@users.noreply.github.com> Source-Date: Wed Nov 4 10:18:01 2020 -0800 Source-Repo: googleapis/synthtool Source-Sha: c7824ea48ff6d4d42dfae0849aec8a85acd90bd9 Source-Link: googleapis/synthtool@c7824ea * chore(java): ignore return code 28 in README autosynth job Exit code 28 is returned if no changes are required and should not be considered a failure. Source-Author: Jeff Ching <chingor@google.com> Source-Date: Mon Nov 9 14:51:28 2020 -0800 Source-Repo: googleapis/synthtool Source-Sha: 7db8a6c5ffb12a6e4c2f799c18f00f7f3d60e279 Source-Link: googleapis/synthtool@7db8a6c * build(java): use code-suggester v1 tag rather than full semver Source-Author: Jeff Ching <chingor@google.com> Source-Date: Thu Nov 12 10:07:08 2020 -0800 Source-Repo: googleapis/synthtool Source-Sha: 7d652819519dfa24da9e14548232e4aaba71a11c Source-Link: googleapis/synthtool@7d65281 * build(java): use actions/github-script v3 tag rather than full semver So that renovate-bot stops proposing PRs like [this](https://github.com/googleapis/java-bigquerydatatransfer/pull/515/files)! Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Tue Nov 17 13:02:02 2020 -0500 Source-Repo: googleapis/synthtool Source-Sha: 7fcc405a579d5d53a726ff3da1b7c8c08f0f2d58 Source-Link: googleapis/synthtool@7fcc405 * chore(java): retry staging portion of the release with backoff * chore(java): retry staging portion of the release with backoff * build: skip logging the retried command - it may contain secrets Source-Author: Jeff Ching <chingor@google.com> Source-Date: Thu Nov 19 12:24:02 2020 -0800 Source-Repo: googleapis/synthtool Source-Sha: 68742c6016bf0d16948a572633d17955a8737414 Source-Link: googleapis/synthtool@68742c6 * build(java): enable blunderbuss for samples Source-Author: Jeff Ching <chingor@google.com> Source-Date: Mon Nov 23 10:23:01 2020 -0800 Source-Repo: googleapis/synthtool Source-Sha: 943bb78606d035001123030067dffcc34f4645f2 Source-Link: googleapis/synthtool@943bb78 * chore: Update publish_javadoc.sh * (chore) Update publish_javadoc.sh * add `export` to the envVar's to make sure maven knows about them. * report the Java version * chore: update script * remove `java -version` Co-authored-by: Jeffrey Rennie <rennie@google.com> Source-Author: Les Vogel <lesv@users.noreply.github.com> Source-Date: Mon Dec 7 09:37:58 2020 -0800 Source-Repo: googleapis/synthtool Source-Sha: 5d11bd2888c38ce1fb6fa6bf25494a4219a73928 Source-Link: googleapis/synthtool@5d11bd2
1 parent 06de2c5 commit b9ca69a

19 files changed

Lines changed: 349 additions & 73 deletions

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
# For syntax help see:
55
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
66

7+
* @googleapis/yoshi-java
8+
79
# The java-samples-reviewers team is the default owner for samples changes
810
samples/**/*.java @googleapis/java-samples-reviewers

.github/blunderbuss.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Configuration for the Blunderbuss GitHub app. For more info see
2+
# https://github.com/googleapis/repo-automation-bots/tree/master/packages/blunderbuss
3+
assign_prs_by:
4+
- labels:
5+
- samples
6+
to:
7+
- googleapis/java-samples-reviewers

.github/generated-files-bot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
externalManifests:
2+
- type: json
3+
file: 'synth.metadata'
4+
jsonpath: '$.generatedFiles[*]'
5+
- type: json
6+
file: '.github/readme/synth.metadata/synth.metadata'
7+
jsonpath: '$.generatedFiles[*]'

.github/readme/synth.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""This script is used to synthesize generated the README for this library."""
16+
17+
from synthtool.languages import java
18+
19+
java.custom_templates(["java_library/README.md"])

.github/snippet-bot.yml

Whitespace-only changes.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
on:
2+
pull_request:
3+
name: auto-merge-readme
4+
jobs:
5+
approve:
6+
runs-on: ubuntu-latest
7+
if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme'
8+
steps:
9+
- uses: actions/github-script@v3
10+
with:
11+
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
12+
script: |
13+
// only approve PRs from yoshi-automation
14+
if (context.payload.pull_request.user.login !== "yoshi-automation") {
15+
return;
16+
}
17+
18+
// only approve PRs like "chore: release <release version>"
19+
if (!context.payload.pull_request.title === "chore: regenerate README") {
20+
return;
21+
}
22+
23+
// only approve PRs with README.md and synth.metadata changes
24+
const files = new Set(
25+
(
26+
await github.paginate(
27+
github.pulls.listFiles.endpoint({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
pull_number: context.payload.pull_request.number,
31+
})
32+
)
33+
).map(file => file.filename)
34+
);
35+
if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) {
36+
return;
37+
}
38+
39+
// approve README regeneration PR
40+
await github.pulls.createReview({
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
body: 'Rubber stamped PR!',
44+
pull_number: context.payload.pull_request.number,
45+
event: 'APPROVE'
46+
});
47+
48+
// attach automerge label
49+
await github.issues.addLabels({
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
issue_number: context.payload.pull_request.number,
53+
labels: ['automerge']
54+
});
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
on:
2+
pull_request:
3+
name: auto-release
4+
jobs:
5+
approve:
6+
runs-on: ubuntu-latest
7+
if: contains(github.head_ref, 'release-v')
8+
steps:
9+
- uses: actions/github-script@v3
10+
with:
11+
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
12+
debug: true
13+
script: |
14+
// only approve PRs from release-please[bot]
15+
if (context.payload.pull_request.user.login !== "release-please[bot]") {
16+
return;
17+
}
18+
19+
// only approve PRs like "chore: release <release version>"
20+
if ( !context.payload.pull_request.title.startsWith("chore: release") ) {
21+
return;
22+
}
23+
24+
// only approve PRs with pom.xml and versions.txt changes
25+
const filesPromise = github.pulls.listFiles.endpoint({
26+
owner: context.repo.owner,
27+
repo: context.repo.repo,
28+
pull_number: context.payload.pull_request.number,
29+
});
30+
const changed_files = await github.paginate(filesPromise)
31+
32+
if ( changed_files.length < 1 ) {
33+
console.log( "Not proceeding since PR is empty!" )
34+
return;
35+
}
36+
37+
if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) {
38+
console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" )
39+
return;
40+
}
41+
42+
// trigger auto-release when
43+
// 1) it is a SNAPSHOT release (auto-generated post regular release)
44+
// 2) there are dependency updates only
45+
// 3) there are no open dependency update PRs in this repo (to avoid multiple releases)
46+
if (
47+
context.payload.pull_request.body.includes("Fix") ||
48+
context.payload.pull_request.body.includes("Build") ||
49+
context.payload.pull_request.body.includes("Documentation") ||
50+
context.payload.pull_request.body.includes("BREAKING CHANGES") ||
51+
context.payload.pull_request.body.includes("Features")
52+
) {
53+
console.log( "Not auto-releasing since it is not a dependency-update-only release." );
54+
return;
55+
}
56+
57+
const promise = github.pulls.list.endpoint({
58+
owner: context.repo.owner,
59+
repo: context.repo.repo,
60+
state: 'open'
61+
});
62+
const open_pulls = await github.paginate(promise)
63+
64+
if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) {
65+
for ( const pull of open_pulls ) {
66+
if ( pull.title.startsWith("deps: update dependency") ) {
67+
console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." );
68+
return;
69+
}
70+
}
71+
}
72+
73+
// approve release PR
74+
await github.pulls.createReview({
75+
owner: context.repo.owner,
76+
repo: context.repo.repo,
77+
body: 'Rubber stamped release!',
78+
pull_number: context.payload.pull_request.number,
79+
event: 'APPROVE'
80+
});
81+
82+
// attach kokoro:force-run and automerge labels
83+
await github.issues.addLabels({
84+
owner: context.repo.owner,
85+
repo: context.repo.repo,
86+
issue_number: context.payload.pull_request.number,
87+
labels: ['kokoro:force-run', 'automerge']
88+
});

.github/workflows/formatting.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
pull_request_target:
3+
types: [opened, synchronize]
4+
branches:
5+
- master
6+
name: format
7+
jobs:
8+
format-code:
9+
runs-on: ubuntu-latest
10+
env:
11+
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
ref: ${{github.event.pull_request.head.ref}}
16+
repository: ${{github.event.pull_request.head.repo.full_name}}
17+
- uses: actions/setup-java@v1
18+
with:
19+
java-version: 11
20+
- run: "mvn com.coveo:fmt-maven-plugin:format"
21+
- uses: googleapis/code-suggester@v1
22+
with:
23+
command: review
24+
pull_number: ${{ github.event.pull_request.number }}
25+
git_dir: '.'

.github/workflows/samples.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ on:
22
pull_request:
33
name: samples
44
jobs:
5-
lint:
5+
checkstyle:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v2

.kokoro/build.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,16 @@ integration)
6969
RETURN_CODE=$?
7070
;;
7171
samples)
72-
if [[ -f samples/pom.xml ]]
72+
SAMPLES_DIR=samples
73+
# only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise.
74+
if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]]
7375
then
74-
pushd samples
76+
SAMPLES_DIR=samples/snapshot
77+
fi
78+
79+
if [[ -f ${SAMPLES_DIR}/pom.xml ]]
80+
then
81+
pushd ${SAMPLES_DIR}
7582
mvn -B \
7683
-Penable-samples \
7784
-DtrimStackTrace=false \

0 commit comments

Comments
 (0)