Skip to content

Commit 23a1a33

Browse files
workflows: capture DinD tests in PreCommit Py Coverage workflow
1 parent f3d10e3 commit 23a1a33

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

.github/workflows/beam_PreCommit_Python_Coverage.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,35 +58,44 @@ env:
5858

5959
jobs:
6060
beam_PreCommit_Python_Coverage:
61-
name: ${{ matrix.job_name }} (${{ matrix.job_phrase }})
62-
runs-on: [self-hosted, ubuntu-20.04, highmem]
61+
name: ${{ matrix.job_name }} (${{ matrix.job_phrase }} ${{ matrix.python_version }})
62+
runs-on: ${{ matrix.os }}
6363
strategy:
64+
fail-fast: false
6465
matrix:
6566
job_name: [beam_PreCommit_Python_Coverage]
6667
job_phrase: [Run Python_Coverage PreCommit]
68+
python_version: ['3.9']
69+
# Run on both self-hosted and GitHub-hosted runners.
70+
# Some tests (marked require_docker_in_docker) can't run on Beam's
71+
# self-hosted runners due to Docker-in-Docker environment constraint.
72+
# These tests will only execute on ubuntu-latest (GitHub-hosted).
73+
# Context: https://github.com/apache/beam/pull/35585
74+
os: [[self-hosted, ubuntu-20.04, highmem], [ubuntu-latest]]
6775
timeout-minutes: 180
6876
if: |
6977
github.event_name == 'push' ||
7078
github.event_name == 'pull_request_target' ||
7179
(github.event_name == 'schedule' && github.repository == 'apache/beam') ||
7280
github.event_name == 'workflow_dispatch' ||
73-
github.event.comment.body == 'Run Python_Coverage PreCommit'
81+
startswith(github.event.comment.body, 'Run Python_Coverage PreCommit 3.')
7482
steps:
7583
- uses: actions/checkout@v4
7684
- name: Setup repository
7785
uses: ./.github/actions/setup-action
7886
with:
79-
comment_phrase: ${{ matrix.job_phrase }}
87+
comment_phrase: ${{ matrix.job_phrase }} ${{ matrix.python_version }}
8088
github_token: ${{ secrets.GITHUB_TOKEN }}
81-
github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }})
89+
github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }} ${{ matrix.python_version }})
8290
- name: Setup environment
8391
uses: ./.github/actions/setup-environment-action
8492
with:
8593
java-version: default
86-
python-version: default
94+
python-version: ${{ matrix.python_version }}
8795
- name: Start DinD
8896
uses: ./.github/actions/dind-up-action
8997
id: dind
98+
if: contains(matrix.os, 'self-hosted')
9099
with:
91100
# Enable all the new features
92101
cleanup-dind-on-start: "true"
@@ -97,9 +106,9 @@ jobs:
97106
export-gh-env: "true"
98107
- name: Run preCommitPyCoverage
99108
env:
100-
DOCKER_HOST: ${{ steps.dind.outputs.docker-host }}
109+
DOCKER_HOST: ${{ contains(matrix.os, 'self-hosted') && steps.dind.outputs.docker-host || '' }}
101110
TOX_TESTENV_PASSENV: "DOCKER_*,TESTCONTAINERS_*,TC_*,BEAM_*,GRPC_*,OMP_*,OPENBLAS_*,PYTHONHASHSEED,PYTEST_*"
102-
TESTCONTAINERS_HOST_OVERRIDE: ${{ env.DIND_IP }}
111+
TESTCONTAINERS_HOST_OVERRIDE: ${{ contains(matrix.os, 'self-hosted') && env.DIND_IP || '' }}
103112
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: "/var/run/docker.sock"
104113
TESTCONTAINERS_RYUK_DISABLED: "false"
105114
TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED: "true"
@@ -110,6 +119,12 @@ jobs:
110119
uses: ./.github/actions/gradle-command-self-hosted-action
111120
with:
112121
gradle-command: :sdks:python:test-suites:tox:py39:preCommitPyCoverage
122+
arguments: |
123+
-Pposargs="${{
124+
contains(matrix.os, 'self-hosted') &&
125+
'-m (not require_docker_in_docker)' ||
126+
'-m require_docker_in_docker'
127+
}}"
113128
- uses: codecov/codecov-action@v3
114129
with:
115130
flags: python

0 commit comments

Comments
 (0)