Skip to content

Commit

Permalink
Add scheduled dispatch workflows for test suites
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Kinard <jeff@thekinards.com>
  • Loading branch information
Polber committed May 6, 2024
1 parent 81d83cb commit 47cece6
Show file tree
Hide file tree
Showing 12 changed files with 565 additions and 48 deletions.
39 changes: 39 additions & 0 deletions .github/actions/publish-site-report/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2024 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: 'Publish Site Report'
description: 'Publish site report'

inputs:
output-zip-file:
description: 'Output file name'
type: string
required: true

runs:
using: 'composite'
steps:
- name: Generate Site Report
shell: bash
run: mvn -B surefire-report:report-only -f pom.xml -Daggregate=true
- name: Publish Site Report
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v3.1.2
with:
name: ${{ inputs.output-zip-file }}
path: 'target/site/'
retention-days: 7
41 changes: 41 additions & 0 deletions .github/actions/run-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2024 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: 'Run Build'
description: 'Run build'

inputs:
changed-files:
description: 'Changed files'
type: string
required: true

runs:
using: 'composite'
steps:
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env

- name: Run Build
shell: bash
run: ./cicd/run-build --changed-files="${{ inputs.changed-files }}"

- name: Cleanup Java Environment
uses: ./.github/actions/cleanup-java-env
if: always()
58 changes: 58 additions & 0 deletions .github/actions/run-integration-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2024 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: 'Run Integration Tests'
description: 'Run integration tests'

inputs:
changed-files:
description: 'Changed files'
type: string
required: false
default: "pom.xml"

runs:
using: 'composite'
steps:
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env

- name: Run Build
shell: bash
run: ./cicd/run-build --changed-files="${{ inputs.changed-files }}"

- name: Run Integration Tests
shell: bash
run: |
./cicd/run-it-tests \
--changed-files="${{ inputs.changed-files }}" \
--it-region="us-central1" \
--it-project="cloud-teleport-testing" \
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
--it-private-connectivity="datastream-private-connect-us-central1"
- name: Publish Integration Test Site Report
uses: ./.github/actions/publish-site-report
with:
output-zip-file: integration-test-report
if: always()

- name: Cleanup Java Environment
uses: ./.github/actions/cleanup-java-env
if: always()
60 changes: 60 additions & 0 deletions .github/actions/run-load-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright 2024 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: 'Run Load Tests'
description: 'Run load tests'

inputs:
changed-files:
description: 'Changed files'
type: string
required: false
default: "pom.xml"

runs:
using: 'composite'
steps:
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env

- name: Run Build
shell: bash
run: ./cicd/run-build --changed-files="${{ inputs.changed-files }}"

- name: Run Load Tests
shell: bash
run: |
./cicd/run-load-tests \
--changed-files="${{ inputs.changed-files }}" \
--it-region="us-central1" \
--it-project="cloud-teleport-testing" \
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
--it-private-connectivity="datastream-private-connect-us-central1" \
--lt-export-project="cloud-teleport-testing" \
--lt-export-dataset="performance_tests" \
--lt-export-table="template_performance_metrics"
- name: Publish Load Test Site Report
uses: ./.github/actions/publish-site-report
with:
output-zip-file: load-test-report
if: always()

- name: Cleanup Java Environment
uses: ./.github/actions/cleanup-java-env
58 changes: 58 additions & 0 deletions .github/actions/run-smoke-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2024 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: 'Run Smoke Tests'
description: 'Run smoke tests'

inputs:
changed-files:
description: 'Changed files'
type: string
required: false
default: "pom.xml"

runs:
using: 'composite'
steps:
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env

- name: Run Build
shell: bash
run: ./cicd/run-build --changed-files="${{ inputs.changed-files }}"

- name: Run Smoke Tests
shell: bash
run: |
./cicd/run-it-smoke-tests \
--changed-files="${{ inputs.changed-files }}" \
--it-region="us-central1" \
--it-project="cloud-teleport-testing" \
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
--it-private-connectivity="datastream-private-connect-us-central1"
- name: Publish Smoke Test Site Report
uses: ./.github/actions/publish-site-report
with:
output-zip-file: smoke-test-report
if: always()

- name: Cleanup Java Environment
uses: ./.github/actions/cleanup-java-env
if: always()
52 changes: 52 additions & 0 deletions .github/actions/run-unit-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2024 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: 'Run Unit Tests'
description: 'Run unit tests'

inputs:
changed-files:
description: 'Changed files'
type: string
required: false
default: "pom.xml"

runs:
using: 'composite'
steps:
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env

- name: Run Build
shell: bash
run: ./cicd/run-build --changed-files="${{ inputs.changed-files }}"

- name: Run Unit Tests
shell: bash
run: ./cicd/run-unit-tests --changed-files="${{ inputs.changed-files }}"

- name: Publish Unit Test Site Report
uses: ./.github/actions/publish-site-report
with:
output-zip-file: unit-test-report
if: always()

- name: Cleanup Java Environment
uses: ./.github/actions/cleanup-java-env
if: always()
51 changes: 51 additions & 0 deletions .github/workflows/java-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2024 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 Build

on:
schedule:
- cron: "0 */6 * * *"
workflow_dispatch:
inputs:
branch:
description: 'Branch to check out.'
type: string
required: false
default: 'main'

env:
MAVEN_OPTS: -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugins.shade=error

permissions:
contents: read
checks: write
id-token: write

jobs:
java_build:
name: Java Build
timeout-minutes: 60
runs-on: [ self-hosted, it ]

steps:
- name: Checkout Code
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
with:
ref: ${{ inputs.branch }}
fetch-depth: 2 # setup-env action assumes fetch depth of at least 2 for https://github.com/tj-actions/changed-files?tab=readme-ov-file#on-push-%EF%B8%8F
- name: Run Java Build
uses: ./.github/actions/run-build

0 comments on commit 47cece6

Please sign in to comment.