|
| 1 | +# Copyright 2026 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: BigQuery Anomaly Detection PR |
| 16 | + |
| 17 | +on: |
| 18 | + pull_request: |
| 19 | + branches: |
| 20 | + - 'main' |
| 21 | + paths: |
| 22 | + - 'python/src/main/python/bigquery-anomaly-detection/**' |
| 23 | + - 'python/src/test/python/bigquery-anomaly-detection/**' |
| 24 | + - 'python/src/main/java/**/BigQueryAnomalyDetection*.java' |
| 25 | + - 'python/src/test/java/**/BigQueryAnomalyDetection*.java' |
| 26 | + - '.github/workflows/bqmonitor-pr.yml' |
| 27 | + workflow_dispatch: |
| 28 | + |
| 29 | +concurrency: |
| 30 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 31 | + cancel-in-progress: true |
| 32 | + |
| 33 | +env: |
| 34 | + MAVEN_OPTS: -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugins.shade=error |
| 35 | + IT_REGION: us-west2 |
| 36 | + |
| 37 | +permissions: |
| 38 | + actions: write |
| 39 | + checks: write |
| 40 | + contents: read |
| 41 | + pull-requests: read |
| 42 | + statuses: write |
| 43 | + |
| 44 | +jobs: |
| 45 | + python_unit_tests: |
| 46 | + name: Python Unit Tests |
| 47 | + timeout-minutes: 15 |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - name: Checkout Code |
| 51 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 52 | + - name: Set up Python |
| 53 | + uses: actions/setup-python@v5 |
| 54 | + with: |
| 55 | + python-version: '3.11' |
| 56 | + - name: Install dependencies and run tests |
| 57 | + working-directory: python |
| 58 | + run: | |
| 59 | + pip install -r src/test/python/bigquery-anomaly-detection/requirements-test.txt |
| 60 | + pip install -e src/main/python/bigquery-anomaly-detection |
| 61 | + python -m unittest discover \ |
| 62 | + -s src/test/python/bigquery-anomaly-detection \ |
| 63 | + -p '*_test.py' \ |
| 64 | + -v |
| 65 | + java_build: |
| 66 | + name: Build |
| 67 | + timeout-minutes: 60 |
| 68 | + runs-on: [self-hosted, it] |
| 69 | + steps: |
| 70 | + - name: Checkout Code |
| 71 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 72 | + - name: Setup Environment |
| 73 | + id: setup-env |
| 74 | + uses: ./.github/actions/setup-env |
| 75 | + - name: Run Build |
| 76 | + run: | |
| 77 | + ./cicd/run-build \ |
| 78 | + --modules-to-build="YAML" |
| 79 | + - name: Cleanup Java Environment |
| 80 | + uses: ./.github/actions/cleanup-java-env |
| 81 | + java_integration_tests: |
| 82 | + name: Integration Tests |
| 83 | + needs: [python_unit_tests, java_build] |
| 84 | + timeout-minutes: 120 |
| 85 | + runs-on: [self-hosted, it] |
| 86 | + steps: |
| 87 | + - name: Checkout Code |
| 88 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 89 | + - name: Setup Environment |
| 90 | + id: setup-env |
| 91 | + uses: ./.github/actions/setup-env |
| 92 | + - name: Run Integration Tests |
| 93 | + run: | |
| 94 | + ./cicd/run-it-tests \ |
| 95 | + --modules-to-build="YAML" \ |
| 96 | + --it-region="${{ env.IT_REGION }}" \ |
| 97 | + --it-project="cloud-teleport-testing" \ |
| 98 | + --it-artifact-bucket="cloud-teleport-testing-it-gitactions" \ |
| 99 | + --it-private-connectivity="datastream-connect-2" \ |
| 100 | + --test="BigQueryAnomalyDetectionIT" |
| 101 | + - name: Upload Integration Tests Report |
| 102 | + uses: actions/upload-artifact@v6 |
| 103 | + if: always() |
| 104 | + with: |
| 105 | + name: surefire-integration-test-results |
| 106 | + path: | |
| 107 | + **/surefire-reports/TEST-*.xml |
| 108 | + **/surefire-reports/*.html |
| 109 | + **/surefire-reports/html/** |
| 110 | + retention-days: 1 |
| 111 | + - name: Cleanup Java Environment |
| 112 | + uses: ./.github/actions/cleanup-java-env |
| 113 | + if: always() |
0 commit comments