Skip to content

Commit

Permalink
chore: add template files
Browse files Browse the repository at this point in the history
  • Loading branch information
lqiu96 committed Aug 10, 2022
1 parent 0201267 commit a1e719a
Show file tree
Hide file tree
Showing 38 changed files with 4,141 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
digest: sha256:b47e411068ffc6e6990cb4e0802fbac9a4488dec7f5f424553518ba21abea208
# created: 2022-07-26T00:00:00.000000000Z
16 changes: 16 additions & 0 deletions .github/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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.

docker:
image: "gcr.io/cloud-devrel-public-resources/owlbot-java:latest"
3 changes: 3 additions & 0 deletions .github/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
primaryBranch: monorepo_script_output
releaseType: java-yoshi
manifest: true
1 change: 1 addition & 0 deletions .github/release-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enabled: true
15 changes: 15 additions & 0 deletions .github/rename-to-workflows/googleapis_hermetic_sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Googleapis Sync (Hermetic Build)
on:
workflow_dispatch:
jobs:
create-pull-request:
name: Create pull request for recent googleapis changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: 'googleapis/google-cloud-java'
- run: |
.kokoro/sync_with_googleapis.sh monorepo_script_output
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 changes: 45 additions & 0 deletions .github/rename-to-workflows/readme.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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:
schedule:
# every morning
- cron: '0 1 * * *'
name: readme
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'
- run: python3 -m pip install requests
- run: python3 generate-readme.py
- uses: googleapis/code-suggester@v3
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
command: pr
upstream_owner: googleapis
upstream_repo: google-cloud-java
description: 'ran python3 generate-readme.py'
title: 'chore: regenerate client table in README'
message: 'chore: regenerate client table in README'
branch: update-readme
primary: main
force: true
git_dir: '.'
39 changes: 39 additions & 0 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Whether or not rebase-merging is enabled on this repository.
# Defaults to `true`
rebaseMergeAllowed: false

# Whether or not squash-merging is enabled on this repository.
# Defaults to `true`
squashMergeAllowed: true

# Whether or not PRs are merged with a merge commit on this repository.
# Defaults to `false`
mergeCommitAllowed: false

# Rules for main branch protection
branchProtectionRules:
# Identifies the protection rule pattern. Name of the branch to be protected.
# Defaults to `main`
- pattern: main
# Can admins overwrite branch protection.
# Defaults to `true`
isAdminEnforced: true
# Number of approving reviews required to update matching branches.
# Defaults to `1`
requiredApprovingReviewCount: 1
# Are reviews from code owners required to update matching branches.
# Defaults to `false`
requiresCodeOwnerReviews: true
# Require up to date branches
requiresStrictStatusChecks: false
# List of required status check contexts that must pass for commits to be accepted to matching branches.
requiredStatusCheckContexts:
- "cla/google"
# List of explicit permissions to add (additive only)
permissionRules:
- team: yoshi-admins
permission: admin
- team: yoshi-java-admins
permission: admin
- team: yoshi-java
permission: push
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Packages
dist
bin
var
sdist
target

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

.metadata
.project
.pydevproject
*.iml
.idea
.settings
.DS_Store
.classpath

# Built documentation
docs/

# API key file containing value of GOOGLE_API_KEY for integration tests
api_key

# Python utilities
*.pyc
18 changes: 18 additions & 0 deletions .kokoro/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
:: 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.
:: See documentation in type-shell-output.bat

"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh
136 changes: 136 additions & 0 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/bin/bash
# Copyright 2019 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.

set -eo pipefail

## Get the directory of the build script
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
## cd to the parent directory, i.e. the root of the git repo
cd ${scriptDir}/..

# include common functions
source ${scriptDir}/common.sh

# Use GCP Maven Mirror
mkdir -p ${HOME}/.m2
cp settings.xml ${HOME}/.m2

mvn install -pl '!google-cloud-gapic-bom,!CoverageAggregator' -T 1C -DskipTests=true -Dclirr.skip=true -Denforcer.skip=true -Dcheckstyle.skip=true -Dflatten.skip=true -Danimal.sniffer.skip=true -Djacoco.skip=true

# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it
if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then
export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS})
fi

RETURN_CODE=0
set +e

case ${JOB_TYPE} in
test)
mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true
RETURN_CODE=$?
;;
lint)
mvn com.coveo:fmt-maven-plugin:check -B -ntp
RETURN_CODE=$?
;;
javadoc)
mvn javadoc:javadoc javadoc:test-javadoc -B -ntp
RETURN_CODE=$?
;;
integration)
if [ -f "${KOKORO_GFILE_DIR}/secret_manager/java-bigqueryconnection-samples-secrets" ]
then
source "${KOKORO_GFILE_DIR}/secret_manager/java-bigqueryconnection-samples-secrets"
fi

mvn -B -pl '!google-cloud-gapic-bom,!CoverageAggregator,!java-game-servers/google-cloud-game-servers' \
-ntp \
-Penable-integration-tests \
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dcheckstyle.skip=true \
-Dflatten.skip=true \
-Danimal.sniffer.skip=true \
-Djacoco.skip=true \
-DskipUnitTests=true \
-fae \
-T 1C \
verify
RETURN_CODE=$?
;;
graalvm)
# Run Unit and Integration Tests with Native Image
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test
RETURN_CODE=$?
;;
graalvm17)
# Run Unit and Integration Tests with Native Image
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test
RETURN_CODE=$?
;;
samples)
SAMPLES_DIR=samples
# only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise.
if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]]
then
SAMPLES_DIR=samples/snapshot
fi

if [[ -f ${SAMPLES_DIR}/pom.xml ]]
then
for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do
[[ -f "$FILE" ]] || continue
source "$FILE"
done

pushd ${SAMPLES_DIR}
mvn -B \
-ntp \
-DtrimStackTrace=false \
-Dclirr.skip=true \
-fae \
verify
RETURN_CODE=$?
popd
else
echo "no sample pom.xml found - skipping sample tests"
fi
;;
clirr)
mvn -B -ntp -Denforcer.skip=true clirr:check
RETURN_CODE=$?
;;
*)
;;
esac

if [ "${REPORT_COVERAGE}" == "true" ]
then
bash ${KOKORO_GFILE_DIR}/codecov.sh
fi

# fix output location of logs
bash .kokoro/coerce_logs.sh

if [[ "${ENABLE_FLAKYBOT}" == "true" ]]
then
chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot
${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-cloud-java
fi

echo "exiting with ${RETURN_CODE}"
exit ${RETURN_CODE}
37 changes: 37 additions & 0 deletions .kokoro/coerce_logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# Copyright 2019 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 finds and moves sponge logs so that they can be found by placer
# and are not flagged as flaky by sponge.

set -eo pipefail

## Get the directory of the build script
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
## cd to the parent directory, i.e. the root of the git repo
cd ${scriptDir}/..

job=$(basename ${KOKORO_JOB_NAME})

echo "coercing sponge logs..."
for xml in `find . -name *-sponge_log.xml`
do
class=$(basename ${xml} | cut -d- -f2)
dir=$(dirname ${xml})/${job}/${class}
text=$(dirname ${xml})/${class}-sponge_log.txt
mkdir -p ${dir}
mv ${xml} ${dir}/sponge_log.xml
mv ${text} ${dir}/sponge_log.txt
done
13 changes: 13 additions & 0 deletions .kokoro/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR}
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# All builds use the trampoline script to run in docker.
build_file: "google-cloud-java/.kokoro/trampoline.sh"

# Tell the trampoline which build file to use.
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-cloud-java/.kokoro/build.sh"
}
Loading

0 comments on commit a1e719a

Please sign in to comment.