|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 | +# contributor license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright ownership. |
| 4 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 5 | +# (the "License"); you may not use this file except in compliance with |
| 6 | +# the License. You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +name: PostCommit Python Versions |
| 17 | +on: |
| 18 | + pull_request_target: |
| 19 | + branches: [ "master", "release-*" ] |
| 20 | + paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Python_Versions.json'] |
| 21 | + push: |
| 22 | + tags: ['v*'] |
| 23 | + branches: ['master', 'release-*'] |
| 24 | + paths: [ "model/**","sdks/python/**",".github/workflows/beam_PostCommit_Python_Versions.yml"] |
| 25 | + schedule: |
| 26 | + - cron: '0 3/6 * * *' |
| 27 | + workflow_dispatch: |
| 28 | + |
| 29 | +#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event |
| 30 | +permissions: |
| 31 | + actions: write |
| 32 | + pull-requests: write |
| 33 | + checks: write |
| 34 | + contents: read |
| 35 | + deployments: read |
| 36 | + id-token: none |
| 37 | + issues: write |
| 38 | + discussions: read |
| 39 | + packages: read |
| 40 | + pages: read |
| 41 | + repository-projects: read |
| 42 | + security-events: read |
| 43 | + statuses: read |
| 44 | + |
| 45 | +# This allows a subsequently queued workflow run to interrupt previous runs |
| 46 | +concurrency: |
| 47 | + group: '${{ github.workflow }} @ ${{ github.event.pull_request.number || github.event.pull_request.head.label || github.sha || github.head_ref || github.ref }}-${{ github.event.schedule || github.event.comment.id || github.event.sender.login }}' |
| 48 | + cancel-in-progress: true |
| 49 | + |
| 50 | +env: |
| 51 | + DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} |
| 52 | + GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }} |
| 53 | + GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }} |
| 54 | + # Aggressive stability settings for flaky CI environment |
| 55 | + PYTHONHASHSEED: "0" |
| 56 | + OMP_NUM_THREADS: "1" |
| 57 | + OPENBLAS_NUM_THREADS: "1" |
| 58 | + # TODO(https://github.com/grpc/grpc/issues/37710): Remove once fixed. |
| 59 | + GRPC_ENABLE_FORK_SUPPORT: "0" |
| 60 | + # gRPC stability - more conservative for unstable networks |
| 61 | + GRPC_ARG_KEEPALIVE_TIME_MS: "10000" |
| 62 | + GRPC_ARG_KEEPALIVE_TIMEOUT_MS: "15000" |
| 63 | + GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS: "1" |
| 64 | + GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA: "0" |
| 65 | + GRPC_ARG_MAX_RECONNECT_BACKOFF_MS: "30000" |
| 66 | + # Beam-specific - very generous timeouts |
| 67 | + BEAM_RETRY_MAX_ATTEMPTS: "5" |
| 68 | + BEAM_RETRY_INITIAL_DELAY_MS: "5000" |
| 69 | + BEAM_RETRY_MAX_DELAY_MS: "120000" |
| 70 | + # Force stable execution |
| 71 | + BEAM_TESTING_FORCE_SINGLE_BUNDLE: "true" |
| 72 | + BEAM_TESTING_DETERMINISTIC_ORDER: "true" |
| 73 | + |
| 74 | +jobs: |
| 75 | + beam_PostCommit_Python_Versions: |
| 76 | + name: ${{ matrix.job_name }} (${{ matrix.job_phrase }} ${{ matrix.python_version }}) |
| 77 | + runs-on: [self-hosted, ubuntu-24.04, main] |
| 78 | + timeout-minutes: 180 |
| 79 | + strategy: |
| 80 | + fail-fast: false |
| 81 | + matrix: |
| 82 | + job_name: ['beam_PostCommit_Python_Versions'] |
| 83 | + job_phrase: ['Run Python Version PostCommit'] |
| 84 | + python_version: ['3.11','3.12','3.13'] # Run Python PreCommit tests on "middle" versions |
| 85 | + if: | |
| 86 | + github.event_name == 'push' || |
| 87 | + github.event_name == 'pull_request_target' || |
| 88 | + (github.event_name == 'schedule' && github.repository == 'apache/beam') || |
| 89 | + github.event_name == 'workflow_dispatch' |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v4 |
| 92 | + - name: Setup repository |
| 93 | + uses: ./.github/actions/setup-action |
| 94 | + with: |
| 95 | + comment_phrase: ${{ matrix.job_phrase }} ${{ matrix.python_version }} |
| 96 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 97 | + github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }} ${{ matrix.python_version }}) |
| 98 | + - name: Setup environment |
| 99 | + uses: ./.github/actions/setup-environment-action |
| 100 | + with: |
| 101 | + java-version: default |
| 102 | + python-version: ${{ matrix.python_version }} |
| 103 | + - name: Set PY_VER_CLEAN |
| 104 | + id: set_py_ver_clean |
| 105 | + run: | |
| 106 | + PY_VER=${{ matrix.python_version }} |
| 107 | + PY_VER_CLEAN=${PY_VER//.} |
| 108 | + echo "py_ver_clean=$PY_VER_CLEAN" >> $GITHUB_OUTPUT |
| 109 | + - name: Run pythonPreCommit |
| 110 | + env: |
| 111 | + TOX_TESTENV_PASSENV: "DOCKER_*,TESTCONTAINERS_*,TC_*,BEAM_*,GRPC_*,OMP_*,OPENBLAS_*,PYTHONHASHSEED,PYTEST_*" |
| 112 | + # Aggressive retry and timeout settings for flaky CI |
| 113 | + PYTEST_ADDOPTS: "-v --tb=short --maxfail=5 --durations=30 --reruns=5 --reruns-delay=15 --timeout=600 --disable-warnings" |
| 114 | + # Container stability - much more generous timeouts |
| 115 | + TC_TIMEOUT: "300" |
| 116 | + TC_MAX_TRIES: "15" |
| 117 | + TC_SLEEP_TIME: "5" |
| 118 | + # Additional gRPC stability for flaky environment |
| 119 | + GRPC_ARG_KEEPALIVE_TIME_MS: "60000" |
| 120 | + GRPC_ARG_KEEPALIVE_TIMEOUT_MS: "60000" |
| 121 | + GRPC_ARG_MAX_CONNECTION_IDLE_MS: "60000" |
| 122 | + GRPC_ARG_HTTP2_BDP_PROBE: "1" |
| 123 | + GRPC_ARG_SO_REUSEPORT: "1" |
| 124 | + # Force sequential execution to reduce load |
| 125 | + PYTEST_XDIST_WORKER_COUNT: "1" |
| 126 | + # Additional gRPC settings |
| 127 | + GRPC_ARG_MAX_RECONNECT_BACKOFF_MS: "120000" |
| 128 | + GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS: "2000" |
| 129 | + BEAM_RUNNER_BUNDLE_TIMEOUT_MS: "600000" |
| 130 | + uses: ./.github/actions/gradle-command-self-hosted-action |
| 131 | + with: |
| 132 | + gradle-command: :sdks:python:test-suites:tox:py${{steps.set_py_ver_clean.outputs.py_ver_clean}}:preCommitPy${{steps.set_py_ver_clean.outputs.py_ver_clean}} |
| 133 | + arguments: | |
| 134 | + -PpythonVersion=${{ matrix.python_version }} \ |
| 135 | + -Pposargs="--ignore=apache_beam/ml/" \ |
| 136 | + - name: Archive Python Test Results |
| 137 | + uses: actions/upload-artifact@v4 |
| 138 | + if: failure() |
| 139 | + with: |
| 140 | + name: Python ${{ matrix.python_version }} Test Results |
| 141 | + path: '**/pytest*.xml' |
| 142 | + - name: Publish Python Test Results |
| 143 | + uses: EnricoMi/publish-unit-test-result-action@v2 |
| 144 | + if: always() |
| 145 | + with: |
| 146 | + commit: '${{ env.prsha || env.GITHUB_SHA }}' |
| 147 | + comment_mode: ${{ github.event_name == 'issue_comment' && 'always' || 'off' }} |
| 148 | + files: '**/pytest*.xml' |
| 149 | + large_files: true |
0 commit comments