From 47cece692f5a94089f7757111cb382fe7625b72f Mon Sep 17 00:00:00 2001 From: Jeffrey Kinard Date: Mon, 6 May 2024 12:56:14 -0400 Subject: [PATCH] Add scheduled dispatch workflows for test suites Signed-off-by: Jeffrey Kinard --- .../actions/publish-site-report/action.yml | 39 ++++++++++++ .github/actions/run-build/action.yml | 41 +++++++++++++ .../actions/run-integration-tests/action.yml | 58 ++++++++++++++++++ .github/actions/run-load-tests/action.yml | 60 +++++++++++++++++++ .github/actions/run-smoke-tests/action.yml | 58 ++++++++++++++++++ .github/actions/run-unit-tests/action.yml | 52 ++++++++++++++++ .github/workflows/java-build.yml | 51 ++++++++++++++++ .github/workflows/java-integration-tests.yml | 51 ++++++++++++++++ .github/workflows/java-load-tests.yml | 53 ++++++++++++++++ .github/workflows/java-smoke-tests.yml | 51 ++++++++++++++++ .github/workflows/java-unit-tests.yml | 51 ++++++++++++++++ .github/workflows/load-tests.yml | 48 --------------- 12 files changed, 565 insertions(+), 48 deletions(-) create mode 100644 .github/actions/publish-site-report/action.yml create mode 100644 .github/actions/run-build/action.yml create mode 100644 .github/actions/run-integration-tests/action.yml create mode 100644 .github/actions/run-load-tests/action.yml create mode 100644 .github/actions/run-smoke-tests/action.yml create mode 100644 .github/actions/run-unit-tests/action.yml create mode 100644 .github/workflows/java-build.yml create mode 100644 .github/workflows/java-integration-tests.yml create mode 100644 .github/workflows/java-load-tests.yml create mode 100644 .github/workflows/java-smoke-tests.yml create mode 100644 .github/workflows/java-unit-tests.yml delete mode 100644 .github/workflows/load-tests.yml diff --git a/.github/actions/publish-site-report/action.yml b/.github/actions/publish-site-report/action.yml new file mode 100644 index 0000000000..3479bbcf69 --- /dev/null +++ b/.github/actions/publish-site-report/action.yml @@ -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 diff --git a/.github/actions/run-build/action.yml b/.github/actions/run-build/action.yml new file mode 100644 index 0000000000..9cf7969f9c --- /dev/null +++ b/.github/actions/run-build/action.yml @@ -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() diff --git a/.github/actions/run-integration-tests/action.yml b/.github/actions/run-integration-tests/action.yml new file mode 100644 index 0000000000..7f42f947e6 --- /dev/null +++ b/.github/actions/run-integration-tests/action.yml @@ -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() diff --git a/.github/actions/run-load-tests/action.yml b/.github/actions/run-load-tests/action.yml new file mode 100644 index 0000000000..3c5f9c97c6 --- /dev/null +++ b/.github/actions/run-load-tests/action.yml @@ -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 diff --git a/.github/actions/run-smoke-tests/action.yml b/.github/actions/run-smoke-tests/action.yml new file mode 100644 index 0000000000..0027ed94d4 --- /dev/null +++ b/.github/actions/run-smoke-tests/action.yml @@ -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() diff --git a/.github/actions/run-unit-tests/action.yml b/.github/actions/run-unit-tests/action.yml new file mode 100644 index 0000000000..716b451cd3 --- /dev/null +++ b/.github/actions/run-unit-tests/action.yml @@ -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() diff --git a/.github/workflows/java-build.yml b/.github/workflows/java-build.yml new file mode 100644 index 0000000000..f4949f8d01 --- /dev/null +++ b/.github/workflows/java-build.yml @@ -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 diff --git a/.github/workflows/java-integration-tests.yml b/.github/workflows/java-integration-tests.yml new file mode 100644 index 0000000000..8988a49837 --- /dev/null +++ b/.github/workflows/java-integration-tests.yml @@ -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 Integration Tests + +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_integration_tests: + name: Integration Tests + 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 Integration Tests + uses: ./.github/actions/run-integration-tests diff --git a/.github/workflows/java-load-tests.yml b/.github/workflows/java-load-tests.yml new file mode 100644 index 0000000000..a66f6391b3 --- /dev/null +++ b/.github/workflows/java-load-tests.yml @@ -0,0 +1,53 @@ +# 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 Load Tests + +on: + schedule: + # at 00:00 every Saturday. + - cron: '0 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_load_tests_templates: + name: Dataflow Templates Load Tests + timeout-minutes: 2880 # 2 days + # Run on any runner that matches all the specified runs-on values. + runs-on: [ self-hosted, perf ] + + 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 Load Tests + uses: ./.github/actions/run-load-tests diff --git a/.github/workflows/java-smoke-tests.yml b/.github/workflows/java-smoke-tests.yml new file mode 100644 index 0000000000..fef37562d7 --- /dev/null +++ b/.github/workflows/java-smoke-tests.yml @@ -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 Smoke Tests + +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_smoke_tests: + name: Smoke Tests + 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 Smoke Tests + uses: ./.github/actions/run-smoke-tests diff --git a/.github/workflows/java-unit-tests.yml b/.github/workflows/java-unit-tests.yml new file mode 100644 index 0000000000..806fe1b675 --- /dev/null +++ b/.github/workflows/java-unit-tests.yml @@ -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 Unit Tests + +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_unit_tests: + name: Unit Tests + 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 Unit Tests + uses: ./.github/actions/run-unit-tests diff --git a/.github/workflows/load-tests.yml b/.github/workflows/load-tests.yml deleted file mode 100644 index c34e45abdb..0000000000 --- a/.github/workflows/load-tests.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Load Tests - -on: - schedule: - # at 00:00 every Saturday. - - cron: '0 0 * * 6' - workflow_dispatch: - -permissions: read-all - -jobs: - load_tests: - name: Dataflow Templates Load tests - timeout-minutes: 2880 # 2 days - # Run on any runner that matches all the specified runs-on values. - runs-on: [ self-hosted, perf ] - steps: - - name: Checkout code - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - fetch-depth: 0 - - name: Setup Environment - id: setup-java-env - uses: ./.github/actions/setup-java-env - - name: Get Host IP - id: variables - run: echo "hostIP=$(gcloud compute instances list | grep $(hostname) | awk '{print $4; exit}' )" >> $GITHUB_OUTPUT - - name: Run load tests with Maven - run: | - mvn test -PtemplatesLoadTests \ - -Dproject=apache-beam-testing \ - -DartifactBucket=gs://apache-beam-testing-pranavbhandari \ - -DhostIp=${HOST_IP} \ - -DprivateConnectivity="datastream-private-connect-us-central1" \ - -DexportProject=cloud-teleport-testing \ - -DexportDataset=performance_tests \ - -DexportTable=template_performance_metrics -e -fae - env: - HOST_IP: ${{ steps.variables.outputs.hostIP }} - - name: Upload Load Tests Report - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: always() # always run even if the previous step fails - with: - name: surefire-test-results - path: '**/surefire-reports/TEST-*.xml' - retention-days: 1 - - name: Cleanup Java Environment - uses: ./.github/actions/cleanup-java-env \ No newline at end of file