Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move dependency tests from PreCommit Coverage to PostCommit #30704

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ PostCommit Jobs run in a schedule against master branch and generally do not get
| [ PostCommit PortableJar Spark ](https://github.com/apache/beam/actions/workflows/beam_PostCommit_PortableJar_Spark.yml) | N/A |`beam_PostCommit_PortableJar_Spark.json`| [![.github/workflows/beam_PostCommit_PortableJar_Spark.yml](https://github.com/apache/beam/actions/workflows/beam_PostCommit_PortableJar_Spark.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PostCommit_PortableJar_Spark.yml?query=event%3Aschedule) |
| [ PostCommit Python ](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python.yml) | ['3.8','3.9','3.10','3.11'] |`beam_PostCommit_Python.json`| [![.github/workflows/beam_PostCommit_Python.yml](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python.yml?query=event%3Aschedule) |
| [ PostCommit Python Arm](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Arm.yml) | ['3.8','3.9','3.10','3.11'] |`beam_PostCommit_Python_Arm.json`| [![.github/workflows/beam_PostCommit_Python_Arm.yml](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Arm.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Arm.yml?query=event%3Aschedule) |
| [ PostCommit Python Dependency ](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Dependency.yml) | N/A |`beam_PostCommit_Python_Dependency.json`| [![.github/workflows/beam_PostCommit_Python_Dependency.yml](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Dependency.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Dependency.yml?query=event%3Aschedule) |
| [ PostCommit Python Examples Dataflow ](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Examples_Dataflow.yml) | N/A |`beam_PostCommit_Python_Examples_Dataflow.json`| [![.github/workflows/beam_PostCommit_Python_Examples_Dataflow.yml](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Examples_Dataflow.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Examples_Dataflow.yml?query=event%3Aschedule) |
| [ PostCommit Python Examples Direct ](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Examples_Direct.yml) | ['3.8','3.9','3.10','3.11'] |`beam_PostCommit_Python_Examples_Direct.json`| [![.github/workflows/beam_PostCommit_Python_Examples_Direct.yml](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Examples_Direct.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Examples_Direct.yml?query=event%3Aschedule) |
| [ PostCommit Python Examples Flink ](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Examples_Flink.yml) | ['3.8','3.11'] |`beam_PostCommit_Python_Examples_Flink.json`| [![.github/workflows/beam_PostCommit_Python_Examples_Flink.yml](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Examples_Flink.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PostCommit_Python_Examples_Flink.yml?query=event%3Aschedule) |
Expand Down
99 changes: 99 additions & 0 deletions .github/workflows/beam_PostCommit_Python_Dependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
#
# http://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.

name: PostCommit Python Dependency

on:
schedule:
- cron: '0 5/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Python_Dependency.json']
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
permissions:
actions: write
pull-requests: write
checks: write
contents: read
deployments: read
id-token: none
issues: write
discussions: read
packages: read
pages: read
repository-projects: read
security-events: read
statuses: read

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.issue.number || github.sha || github.head_ref || github.ref }}-${{ github.event.schedule || github.event.comment.id || github.event.sender.login }}'
cancel-in-progress: true

env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
HF_INFERENCE_TOKEN: ${{ secrets.HF_INFERENCE_TOKEN }}


jobs:
beam_PostCommit_Python_Dependency:
name: ${{ matrix.job_name }} (${{ matrix.job_phrase }})
runs-on: [self-hosted, ubuntu-20.04, main]
strategy:
fail-fast: false
matrix:
job_name: [beam_PostCommit_Python_Dependency]
job_phrase: [Run Python PostCommit Dependency]
Copy link
Contributor

@tvalentyn tvalentyn May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making this change. Do we still need to explicitly mention new suites anywhere under release/src/main/scripts or this is no longer necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary. job_phrase for postcommit currently is not effective (#28909). I just copy-paste from existing yml which had this structure.

timeout-minutes: 120
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request_target' ||
(github.event_name == 'schedule' && github.repository == 'apache/beam') ||
github.event.comment.body == 'Run Python PostCommit Dependency'
steps:
- uses: actions/checkout@v4
- name: Setup repository
uses: ./.github/actions/setup-action
with:
comment_phrase: ${{ matrix.job_phrase }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }})
- name: Setup environment
uses: ./.github/actions/setup-environment-action
with:
java-version: 8
python-version: 3.8
- name: Run postCommitPyDep
uses: ./.github/actions/gradle-command-self-hosted-action
with:
gradle-command: :sdks:python:test-suites:tox:py38:postCommitPyDep
arguments: |
-PuseWheelDistribution
- name: Archive Python Test Results
uses: actions/upload-artifact@v4
if: failure()
with:
name: Python Test Results
path: '**/pytest*.xml'
- name: Publish Python Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
commit: '${{ env.prsha || env.GITHUB_SHA }}'
comment_mode: ${{ github.event_name == 'issue_comment' && 'always' || 'off' }}
files: '**/pytest*.xml'
4 changes: 0 additions & 4 deletions sdks/python/test-suites/tox/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ test.dependsOn "testPy${pythonVersionSuffix}Cloud"
// toxTask "testPy${pythonVersionSuffix}Dask", "py${pythonVersionSuffix}-dask", "${posargs}"
// test.dependsOn "testPy${pythonVersionSuffix}Dask"


toxTask "testPy38CloudCoverage", "py38-cloudcoverage", "${posargs}"
test.dependsOn "testPy38CloudCoverage"

project.tasks.register("preCommitPy${pythonVersionSuffix}") {
// Since codecoverage reports will always be generated for py38,
// all tests will be exercised.
Expand Down
54 changes: 32 additions & 22 deletions sdks/python/test-suites/tox/py38/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,76 +44,84 @@ lint.dependsOn mypyPy38
apply from: "../common.gradle"



// PyCoverage Precommit runs test suites that evaluate test coverage and compatibility of
// particular dependencies. It is exercised on a single Python version.
toxTask "testPy38CloudCoverage", "py38-cloudcoverage", "${posargs}"
test.dependsOn "testPy38CloudCoverage"
project.tasks.register("preCommitPyCoverage") {
dependsOn = ["testPy38CloudCoverage"]
}

// Dep Postcommit runs test suites that evaluate compatibility of particular
// dependencies. It is exercised on a single Python version.
//
// Should still leave at least one version in PreCommit unless the marked tests
// are also exercised by existing PreCommit
// e.g. pyarrow and pandas also run on PreCommit Dataframe and Coverage
project.tasks.register("postCommitPyDep") {}

// Create a test task for each supported major version of pyarrow
toxTask "testPy38pyarrow-3", "py38-pyarrow-3", "${posargs}"
test.dependsOn "testPy38pyarrow-3"
preCommitPyCoverage.dependsOn "testPy38pyarrow-3"
postCommitPyDep.dependsOn "testPy38pyarrow-3"

toxTask "testPy38pyarrow-4", "py38-pyarrow-4", "${posargs}"
test.dependsOn "testPy38pyarrow-4"
preCommitPyCoverage.dependsOn "testPy38pyarrow-4"
postCommitPyDep.dependsOn "testPy38pyarrow-4"

toxTask "testPy38pyarrow-5", "py38-pyarrow-5", "${posargs}"
test.dependsOn "testPy38pyarrow-5"
preCommitPyCoverage.dependsOn "testPy38pyarrow-5"
postCommitPyDep.dependsOn "testPy38pyarrow-5"

toxTask "testPy38pyarrow-6", "py38-pyarrow-6", "${posargs}"
test.dependsOn "testPy38pyarrow-6"
preCommitPyCoverage.dependsOn "testPy38pyarrow-6"
postCommitPyDep.dependsOn "testPy38pyarrow-6"

toxTask "testPy38pyarrow-7", "py38-pyarrow-7", "${posargs}"
test.dependsOn "testPy38pyarrow-7"
preCommitPyCoverage.dependsOn "testPy38pyarrow-7"
postCommitPyDep.dependsOn "testPy38pyarrow-7"

toxTask "testPy38pyarrow-8", "py38-pyarrow-8", "${posargs}"
test.dependsOn "testPy38pyarrow-8"
preCommitPyCoverage.dependsOn "testPy38pyarrow-8"
postCommitPyDep.dependsOn "testPy38pyarrow-8"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each of these categories are not strictly dependency tests, they also test some other functionality which is not necessarily tested elsewhere. I agree we don't need the full matrix of all versions in our precommits, but I think it would be good to keep at least 1 version per type that also runs in the precommit. So for example, we could change this line to 2 lines:

preCommitPyCoverage.dependsOn "testPy38pyarrow-8"
postCommitPyDep.dependsOn "testPy38pyarrow-8"

but leave the rest of the pyarrow versions for the dependency task

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought these tests are also running on usual precommit, with dependency version unrestricted (see comment above). Let me open a draft PR to double check

Copy link
Contributor Author

@Abacn Abacn Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From test result of #30226 Only pyarrow and pandas tests were executed in other PreCommit (PreCommit dataframe), so these two tests can be fully moved to postcommit; other tests leave at least one version in PreCommit coverage


toxTask "testPy38pyarrow-9", "py38-pyarrow-9", "${posargs}"
test.dependsOn "testPy38pyarrow-9"
preCommitPyCoverage.dependsOn "testPy38pyarrow-9"
postCommitPyDep.dependsOn "testPy38pyarrow-9"

// Create a test task for each minor version of pandas
toxTask "testPy38pandas-14", "py38-pandas-14", "${posargs}"
test.dependsOn "testPy38pandas-14"
preCommitPyCoverage.dependsOn "testPy38pandas-14"
postCommitPyDep.dependsOn "testPy38pandas-14"

toxTask "testPy38pandas-15", "py38-pandas-15", "${posargs}"
test.dependsOn "testPy38pandas-15"
preCommitPyCoverage.dependsOn "testPy38pandas-15"
postCommitPyDep.dependsOn "testPy38pandas-15"

toxTask "testPy38pandas-20", "py38-pandas-20", "${posargs}"
test.dependsOn "testPy38pandas-20"
preCommitPyCoverage.dependsOn "testPy38pandas-20"
postCommitPyDep.dependsOn "testPy38pandas-20"

// Create a test task for each minor version of pytorch
toxTask "testPy38pytorch-19", "py38-pytorch-19", "${posargs}"
test.dependsOn "testPy38pytorch-19"
preCommitPyCoverage.dependsOn "testPy38pytorch-19"
postCommitPyDep.dependsOn "testPy38pytorch-19"

toxTask "testPy38pytorch-110", "py38-pytorch-110", "${posargs}"
test.dependsOn "testPy38pytorch-110"
preCommitPyCoverage.dependsOn "testPy38pytorch-110"
postCommitPyDep.dependsOn "testPy38pytorch-110"

toxTask "testPy38pytorch-111", "py38-pytorch-111", "${posargs}"
test.dependsOn "testPy38pytorch-111"
preCommitPyCoverage.dependsOn "testPy38pytorch-111"
postCommitPyDep.dependsOn "testPy38pytorch-111"

toxTask "testPy38pytorch-112", "py38-pytorch-112", "${posargs}"
test.dependsOn "testPy38pytorch-112"
preCommitPyCoverage.dependsOn "testPy38pytorch-112"
postCommitPyDep.dependsOn "testPy38pytorch-112"

toxTask "testPy38pytorch-113", "py38-pytorch-113", "${posargs}"
test.dependsOn "testPy38pytorch-113"
preCommitPyCoverage.dependsOn "testPy38pytorch-113"
postCommitPyDep.dependsOn "testPy38pytorch-113"

// run on precommit
toxTask "testPy38pytorch-200", "py38-pytorch-200", "${posargs}"
test.dependsOn "testPy38pytorch-200"
preCommitPyCoverage.dependsOn "testPy38pytorch-200"
Expand All @@ -126,7 +134,7 @@ preCommitPyCoverage.dependsOn "testPy38tft-113"
// Create a test task for each minor version of onnx
// toxTask "testPy38onnx-113", "py38-onnx-113", "${posargs}"
// test.dependsOn "testPy38onnx-113"
// preCommitPyCoverage.dependsOn "testPy38onnx-113"
// postCommitPyDep.dependsOn "testPy38onnx-113"
// Create a test task for each minor version of tensorflow
toxTask "testPy38tensorflow-212", "py38-tensorflow-212", "${posargs}"
test.dependsOn "testPy38tensorflow-212"
Expand All @@ -135,12 +143,13 @@ preCommitPyCoverage.dependsOn "testPy38tensorflow-212"
// Create a test task for each minor version of transformers
toxTask "testPy38transformers-428", "py38-transformers-428", "${posargs}"
test.dependsOn "testPy38transformers-428"
preCommitPyCoverage.dependsOn "testPy38transformers-428"
postCommitPyDep.dependsOn "testPy38transformers-428"

toxTask "testPy38transformers-429", "py38-transformers-429", "${posargs}"
test.dependsOn "testPy38transformers-429"
preCommitPyCoverage.dependsOn "testPy38transformers-429"
postCommitPyDep.dependsOn "testPy38transformers-429"

// run on precommit
toxTask "testPy38transformers-430", "py38-transformers-430", "${posargs}"
test.dependsOn "testPy38transformers-430"
preCommitPyCoverage.dependsOn "testPy38transformers-430"
Expand All @@ -153,8 +162,9 @@ preCommitPyCoverage.dependsOn "testPy38embeddingsMLTransform"
// mutliple versions so keeping this suite separate.
toxTask "testPy38TensorflowHubEmbeddings-014", "py38-TFHubEmbeddings-014", "${posargs}"
test.dependsOn "testPy38TensorflowHubEmbeddings-014"
preCommitPyCoverage.dependsOn "testPy38TensorflowHubEmbeddings-014"
postCommitPyDep.dependsOn "testPy38TensorflowHubEmbeddings-014"

// run on precommit
toxTask "testPy38TensorflowHubEmbeddings-015", "py38-TFHubEmbeddings-015", "${posargs}"
test.dependsOn "testPy38TensorflowHubEmbeddings-015"
preCommitPyCoverage.dependsOn "testPy38TensorflowHubEmbeddings-015"
Expand Down
Loading