Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from epidemicsound/GoogleCloudPlatform-main
Browse files Browse the repository at this point in the history
Google cloud platform main
  • Loading branch information
kirill-barkunov-es authored May 26, 2022
2 parents 98e2b4c + da24483 commit 1186f92
Show file tree
Hide file tree
Showing 288 changed files with 23,735 additions and 5,318 deletions.
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Bug
description: File a bug issue
title: "[Bug]: <Please Replace with a Summary of the Bug> "
labels: ["bug", "p2", "needs triage"]
body:
- type: markdown
attributes:
value: >
Thank you so much for taking the time to fill out this bug report!
**Please note: any issue that is currently affecting your production should be directed to Google Cloud customer support.**
- type: input
id: template
attributes:
label: Related Template(s)
description: "Which template(s) is this bug affecting?"
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Please share what you expected and what happened!
placeholder: Tell us what you see!
validations:
required: true
- type: dropdown
id: version
attributes:
label: Beam Version
description: What version of beam are you using?
options:
- Newer than 2.35.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- Older than 2.30.0
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Feature Request
description: File a feature request issue
title: "[Feature Request]: <Please Replace This with a Summary of Your Request>"
labels: ["addition", "p2", "needs triage"]
body:
- type: markdown
attributes:
value: |
Thank you so much for taking the time to fill out this feature request!
- type: input
id: template
attributes:
label: Related Template(s)
description: "Please let us know which templates are you submitting this feature request for. Or if you are requesting a new template."
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: What feature(s) are you requesting?
validations:
required: true
35 changes: 35 additions & 0 deletions .github/actions/cleanup-java-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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
#
# https://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.

# Cleans up the Java environment. This is mostly intended to help keep the
# Java cache a bit smaller by removing unnecessary dependencies or stuff that
# we will always rebuild anyways.

name: 'Cleanup Java Environment'
description: 'Do some cleanup of the Java environment'

runs:
using: 'composite'
steps:
- name: Remove Teleport Artifacts
shell: bash
run: |
TELEPORT_DIR=~/.m2/repository/com/google/cloud/teleport
if [[ -d "$TELEPORT_DIR" ]]; then
echo "Cleaning up $TELEPORT_DIR"
rm -r "$TELEPORT_DIR"
echo "$TELEPORT_DIR successfully cleaned up"
else
echo "$TELEPORT_DIR not found"
fi
75 changes: 75 additions & 0 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 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
#
# https://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.


# Action used to set up the environment. This assumes that we are using
# a Linux-based VM.
#
# General steps are:
# 1. Set up Java, which templates and tests are written in
# 2. Set up Go, which our CI/CD programs are written in
# 3. Build everything under cicd/cmd
# 4. Gets all the changed files

name: 'Setup Environment'
description: 'Sets up common environment for Dataflow Templates workflows'

inputs:
java-cache-key:
type: string
description: 'Key to use for the cache entry'
required: false
default: ''
java-version:
type: string
description: 'The version of Java to install'
required: false
default: '11'
go-version:
type: string
description: 'The version of Go to install'
required: false
default: '1.17'
outputs:
changed-files:
description: 'Comma-separated list of files that were changed'
value: ${{ steps.changed-files.outputs.all_changed_files }}

runs:
using: 'composite'
steps:
- name: Setup Go
uses: actions/setup-go@44e221478fc6847752e5c574fc7a7b3247b00fbf
with:
go-version: ${{ inputs.go-version }}
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@61ee456a9d0f512e7ecfdf28863634c97dae2d16
with:
separator: ','
# It shouldn't take too long to build all of this, and it will at least
# make running the target program easier
- name: Build CI/CD
shell: bash
run: |
cd cicd/
for CMD in $(ls cmd); do
go build ./cmd/$CMD
done
cd ..
- name: Setup Java
uses: ./.github/actions/setup-java-env
with:
cache-key: ${{ inputs.java-cache-key }}
java-version: ${{ inputs.java-version }}
68 changes: 68 additions & 0 deletions .github/actions/setup-java-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 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
#
# https://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.

# Sets up the cache for Java dependencies. If a specific key is given, then the
# key is used to resolve or else resolving the first entry that matches the prefix
# without the key. Otherwise, today's date and yetserday's date (both in UTC) will be
# tried before going to the first match without any date.

name: 'Setup Java Environment'
description: 'Sets up the full Java environment.'

inputs:
cache-key:
type: string
description: 'Key to use for the cache entry'
required: false
default: ''
java-version:
type: string
description: 'The version of Java to install'
required: false
default: '8'
outputs:
cache-hit:
description: 'Whether or not there was a cache hit'
value: ${{ steps.setup-cache.outputs.cache-hit }}

runs:
using: 'composite'
steps:
- name: Setup Java
uses: actions/setup-java@a12e082d834968c1847f782019214fadd20719f6
with:
distribution: 'zulu'
java-version: ${{ inputs.java-version }}
- name: Prepare Key
shell: bash
env:
KEY: ${{ inputs.cache-key }}
run: |
if [[ "$KEY" == "" || "$KEY" == "''" ]]; then
echo "TODAY=$(date -u +%Y%m%d)" >> $GITHUB_ENV
echo "YESTERDAY=$(date -u --date='1 day ago' +%Y%m%d)" >> $GITHUB_ENV
else
echo "TODAY=$KEY" >> $GITHUB_ENV
echo "YESTERDAY=$KEY" >> $GITHUB_ENV
fi
- name: Setup Cache
uses: actions/cache@72d1e4fdff0ff7b1b6e86b415f2d4f5941e5c006
id: setup-cache
with:
path: |
~/.m2
key: java-maven-cache-${{ env.TODAY }}
restore-keys: |
java-maven-cache-${{ env.YESTERDAY }}
java-maven-cache
65 changes: 65 additions & 0 deletions .github/workflows/go-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 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
#
# https://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.

# Checks to run whenever there is a Go PR. Currently, we only write Go code
# for CI/CD purposes, so the jobs tend to lighter-weight than Java PRs
# are.

name: Go PR

on:
pull_request:
branches:
- 'main'
paths:
- 'cicd/**'
- '.github/workflows/go-pr.yml'

permissions: read-all

jobs:
check_formatting:
name: Go FMT
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@230611dbd0eb52da1e1f4f7bc8bb0c3a339fc8b7
- name: Setup Go
uses: actions/setup-go@44e221478fc6847752e5c574fc7a7b3247b00fbf
with:
go-version: '1.17'
- name: Run Fmt
run: |
cd cicd
if [[ $(go fmt ./...) != "" ]]; then
echo 'There were formatting violations'
exit 1
fi
build_and_tests:
name: Build and Test
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@230611dbd0eb52da1e1f4f7bc8bb0c3a339fc8b7
- name: Setup Go
uses: actions/setup-go@44e221478fc6847752e5c574fc7a7b3247b00fbf
with:
go-version: '1.17'
# By nature, this also makes sure that everything builds
- name: Run Tests
run: |
cd cicd
go test ./...
73 changes: 73 additions & 0 deletions .github/workflows/java-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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
#
# https://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.

# Checks that are intended to run on PRs containing Java code.

name: Java PR

on:
pull_request:
branches:
- 'main'
paths:
- '**.java'
- '**pom.xml'
# Include relevant GitHub Action files for running these checks.
# This will make it easier to verify action changes don't break anything.
- '.github/actions/setup-env/*'
- '.github/workflows/java-pr.yml'

permissions: read-all

jobs:
spotless_check:
name: Spotless
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@230611dbd0eb52da1e1f4f7bc8bb0c3a339fc8b7
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env
- name: Run Spotless
run: ./cicd/run-spotless --changed-files="${{ steps.setup-env.outputs.changed-files }}"
java_build:
name: Build
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@230611dbd0eb52da1e1f4f7bc8bb0c3a339fc8b7
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env
- name: Run Build
run: ./cicd/run-build --changed-files="${{ steps.setup-env.outputs.changed-files }}"
- name: Cleanup Java Environment
uses: ./.github/actions/cleanup-java-env
java_tests:
name: Unit Tests
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@230611dbd0eb52da1e1f4f7bc8bb0c3a339fc8b7
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env
- name: Run Unit Tests
run: ./cicd/run-unit-tests --changed-files="${{ steps.setup-env.outputs.changed-files }}"
- name: Cleanup Java Environment
uses: ./.github/actions/cleanup-java-env
Loading

0 comments on commit 1186f92

Please sign in to comment.