Skip to content

Commit

Permalink
build: add kokoro & ci configs to 1.106.1-patch branch (#847)
Browse files Browse the repository at this point in the history
* build: add kokoro & ci changes

* add samples folder to pass ci

* build: pin fmt-maven-plugin version to 2.9

fmt-maven-plugin v2.10 is compiled for java 11, v2.9 is compiled for java 8

port of fix from googleapis/java-shared-config#90

* remove samples directory & ci

* add ci block

* remove snippet bot config

* sync ci changes

* fix(test): update blob paths used in storage.it.ITStorageTest#testDownloadPublicBlobWithoutAuthentication (#759)

Port of googleapis/google-cloud-go#3806

Fixes #755

Co-authored-by: BenWhitehead <BenWhitehead@users.noreply.github.com>
  • Loading branch information
danielduhh and BenWhitehead committed Jun 10, 2021
1 parent a861628 commit 0ac1292
Show file tree
Hide file tree
Showing 31 changed files with 861 additions and 110 deletions.
12 changes: 12 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
@@ -0,0 +1,12 @@
# Code owners file.
# This file controls who is tagged for review for any given pull request.

# For syntax help see:
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax

# The @googleapis/storage-dpe is the default owner for changes in this repo
* @googleapis/yoshi-java @googleapis/storage-dpe
**/*.java @googleapis/storage-dpe

# The java-samples-reviewers team is the default owner for samples changes
samples/**/*.java @googleapis/java-samples-reviewers
7 changes: 7 additions & 0 deletions .github/blunderbuss.yml
@@ -0,0 +1,7 @@
# Configuration for the Blunderbuss GitHub app. For more info see
# https://github.com/googleapis/repo-automation-bots/tree/master/packages/blunderbuss
assign_prs_by:
- labels:
- samples
to:
- googleapis/java-samples-reviewers
12 changes: 12 additions & 0 deletions .github/generated-files-bot.yml
@@ -0,0 +1,12 @@
externalManifests:
- type: json
file: 'synth.metadata'
jsonpath: '$.generatedFiles[*]'
- type: json
file: '.github/readme/synth.metadata/synth.metadata'
jsonpath: '$.generatedFiles[*]'
ignoreAuthors:
- 'renovate-bot'
- 'yoshi-automation'
- 'release-please[bot]'
- 'gcf-owl-bot[bot]'
18 changes: 18 additions & 0 deletions .github/readme/synth.metadata/synth.metadata
@@ -0,0 +1,18 @@
{
"sources": [
{
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-storage.git",
"sha": "c734edf01084419b25825cee1bc1cf9ff8c6369c"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "4f4b1b9b8d8b52f1e9e4a76165896debce5ab7f1"
}
}
]
}
19 changes: 19 additions & 0 deletions .github/readme/synth.py
@@ -0,0 +1,19 @@
# Copyright 2020 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.

"""This script is used to synthesize generated the README for this library."""

from synthtool.languages import java

java.custom_templates(["java_library/README.md"])
12 changes: 11 additions & 1 deletion .github/release-please.yml
@@ -1,2 +1,12 @@
bumpMinorPreMajor: true
handleGHRelease: true
releaseType: java-yoshi
bumpMinorPreMajor: true
branches:
- bumpMinorPreMajor: true
handleGHRelease: true
releaseType: java-lts
branch: 1.113.14-sp
- bumpMinorPreMajor: true
handleGHRelease: true
releaseType: java-yoshi
branch: 1.106.1-patch
58 changes: 58 additions & 0 deletions .github/sync-repo-settings.yaml
@@ -0,0 +1,58 @@
rebaseMergeAllowed: false
squashMergeAllowed: true
mergeCommitAllowed: false
branchProtectionRules:
- pattern: master
isAdminEnforced: true
requiredApprovingReviewCount: 1
requiresCodeOwnerReviews: true
requiresStrictStatusChecks: false
requiredStatusCheckContexts:
- dependencies (8)
- dependencies (11)
- linkage-monitor
- lint
- clirr
- units (7)
- units (8)
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- pattern: 1.113.14-sp
isAdminEnforced: true
requiredApprovingReviewCount: 1
requiresCodeOwnerReviews: true
requiresStrictStatusChecks: false
requiredStatusCheckContexts:
- dependencies (8)
- dependencies (11)
- linkage-monitor
- lint
- clirr
- units (7)
- units (8)
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- pattern: 1.106.1-patch
isAdminEnforced: true
requiredApprovingReviewCount: 1
requiresCodeOwnerReviews: true
requiresStrictStatusChecks: false
requiredStatusCheckContexts:
- dependencies (8)
- dependencies (11)
- lint
- clirr
- units (7)
- units (8)
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
permissionRules:
- team: yoshi-admins
permission: admin
- team: yoshi-java-admins
permission: admin
- team: yoshi-java
permission: push
54 changes: 54 additions & 0 deletions .github/workflows/approve-readme.yaml
@@ -0,0 +1,54 @@
on:
pull_request:
name: auto-merge-readme
jobs:
approve:
runs-on: ubuntu-latest
if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme'
steps:
- uses: actions/github-script@v3
with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
script: |
// only approve PRs from yoshi-automation
if (context.payload.pull_request.user.login !== "yoshi-automation") {
return;
}
// only approve PRs like "chore: release <release version>"
if (!context.payload.pull_request.title === "chore: regenerate README") {
return;
}
// only approve PRs with README.md and synth.metadata changes
const files = new Set(
(
await github.paginate(
github.pulls.listFiles.endpoint({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
})
)
).map(file => file.filename)
);
if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) {
return;
}
// approve README regeneration PR
await github.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Rubber stamped PR!',
pull_number: context.payload.pull_request.number,
event: 'APPROVE'
});
// attach automerge label
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['automerge']
});
88 changes: 88 additions & 0 deletions .github/workflows/auto-release.yaml
@@ -0,0 +1,88 @@
on:
pull_request:
name: auto-release
jobs:
approve:
runs-on: ubuntu-latest
if: contains(github.head_ref, 'release-please')
steps:
- uses: actions/github-script@v3
with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
debug: true
script: |
// only approve PRs from release-please[bot]
if (context.payload.pull_request.user.login !== "release-please[bot]") {
return;
}
// only approve PRs like "chore: release <release version>"
if ( !context.payload.pull_request.title.startsWith("chore: release") ) {
return;
}
// only approve PRs with pom.xml and versions.txt changes
const filesPromise = github.pulls.listFiles.endpoint({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
const changed_files = await github.paginate(filesPromise)
if ( changed_files.length < 1 ) {
console.log( "Not proceeding since PR is empty!" )
return;
}
if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) {
console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" )
return;
}
// trigger auto-release when
// 1) it is a SNAPSHOT release (auto-generated post regular release)
// 2) there are dependency updates only
// 3) there are no open dependency update PRs in this repo (to avoid multiple releases)
if (
context.payload.pull_request.body.includes("Fix") ||
context.payload.pull_request.body.includes("Build") ||
context.payload.pull_request.body.includes("Documentation") ||
context.payload.pull_request.body.includes("BREAKING CHANGES") ||
context.payload.pull_request.body.includes("Features")
) {
console.log( "Not auto-releasing since it is not a dependency-update-only release." );
return;
}
const promise = github.pulls.list.endpoint({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
});
const open_pulls = await github.paginate(promise)
if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) {
for ( const pull of open_pulls ) {
if ( pull.title.startsWith("deps: update dependency") ) {
console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." );
return;
}
}
}
// approve release PR
await github.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Rubber stamped release!',
pull_number: context.payload.pull_request.number,
event: 'APPROVE'
});
// attach kokoro:force-run and automerge labels
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['kokoro:force-run', 'automerge']
});
79 changes: 79 additions & 0 deletions .github/workflows/ci.yaml
@@ -0,0 +1,79 @@
on:
push:
branches:
- 1.106.1
pull_request:
name: ci
jobs:
units:
runs-on: ubuntu-latest
strategy:
matrix:
java: [7, 8, 11]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: test
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- run: .kokoro/build.bat
env:
JOB_TYPE: test
dependencies:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- run: java -version
- run: .kokoro/dependencies.sh
linkage-monitor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- name: Install artifacts to local Maven repository
run: .kokoro/build.sh
shell: bash
- name: Validate any conflicts with regard to com.google.cloud:libraries-bom (latest release)
uses: GoogleCloudPlatform/cloud-opensource-java/linkage-monitor@v1-linkagemonitor
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: lint
clirr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: clirr
2 changes: 1 addition & 1 deletion .kokoro/build.bat
@@ -1,3 +1,3 @@
:: See documentation in type-shell-output.bat

"C:\Program Files\Git\bin\bash.exe" github/java-storage/.kokoro/build.sh
"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh

0 comments on commit 0ac1292

Please sign in to comment.