Skip to content

Cross version tests #113

Cross version tests

Cross version tests #113

name: Cross version tests
run-name: ${{ inputs.uuid }}
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch:
inputs:
repository:
description: >
[Optional] Repository name with owner. For example, mlflow/mlflow.
Defaults to the repository that triggered a workflow.
required: false
default: ""
ref:
description: >
[Optional] The branch, tag or SHA to checkout. When checking out the repository that
triggered a workflow, this defaults to the reference or SHA for that event. Otherwise,
uses the default branch.
required: false
default: ""
flavors:
description: "[Optional] Comma-separated string specifying which flavors to test (e.g. 'sklearn, xgboost'). If unspecified, all flavors are tested."
required: false
default: ""
versions:
description: "[Optional] Comma-separated string specifying which versions to test (e.g. '1.2.3, 4.5.6'). If unspecified, all versions are tested."
required: false
default: ""
uuid:
description: "[Optional] A unique identifier for this run."
required: false
default: ""
schedule:
# Run this workflow daily at 13:00 UTC
- cron: "0 13 * * *"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
env:
MLFLOW_HOME: /home/runner/work/mlflow/mlflow
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu
jobs:
set-matrix:
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'schedule' && github.repository == 'mlflow-automation/mlflow') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
permissions:
issues: read # listLabelsOnIssue
outputs:
matrix1: ${{ steps.set-matrix.outputs.matrix1 }}
matrix2: ${{ steps.set-matrix.outputs.matrix2 }}
is_matrix1_empty: ${{ steps.set-matrix.outputs.is_matrix1_empty }}
is_matrix2_empty: ${{ steps.set-matrix.outputs.is_matrix2_empty }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
repository: ${{ github.event_name == 'schedule' && 'mlflow/mlflow' || github.event.inputs.repository }}
ref: ${{ github.event.inputs.ref }}
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- name: Install dependencies
run: |
pip install -r dev/requirements.txt
pip install pytest pytest-cov
- name: Check labels
uses: actions/github-script@v7
id: check-labels
with:
script: |
if (context.eventName !== "pull_request") {
return {
enable_dev_tests: true,
only_latest: false,
};
}
const labels = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const labelNames = labels.data.map(({ name }) => name);
return {
enable_dev_tests: labelNames.includes("enable-dev-tests"),
only_latest: labelNames.includes("only-latest"),
};
- name: Test set_matrix.py
run: |
python -m pytest --noconftest dev/tests
- id: set-matrix
name: Set matrix
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
EVENT_NAME="${{ github.event_name }}"
if [ "$EVENT_NAME" = "pull_request" ]; then
REPO="${{ github.repository }}"
PR_NUMBER="${{ github.event.pull_request.number }}"
BASE_REF="${{ github.base_ref }}"
REF_VERSIONS_YAML="https://raw.githubusercontent.com/$REPO/$BASE_REF/mlflow/ml-package-versions.yml"
CHANGED_FILES="$(python dev/list_changed_files.py --repository $REPO --pr-num $PR_NUMBER)"
ENABLE_DEV_TESTS="${{ fromJson(steps.check-labels.outputs.result).enable_dev_tests }}"
NO_DEV_FLAG=$([ "$ENABLE_DEV_TESTS" == "true" ] && echo "" || echo "--no-dev")
ONLY_LATEST="${{ fromJson(steps.check-labels.outputs.result).only_latest }}"
ONLY_LATEST_FLAG=$([ "$ONLY_LATEST" == "true" ] && echo "--only-latest" || echo "")
python dev/set_matrix.py --ref-versions-yaml $REF_VERSIONS_YAML --changed-files "$CHANGED_FILES" $NO_DEV_FLAG $ONLY_LATEST_FLAG
elif [ "$EVENT_NAME" = "workflow_dispatch" ]; then
python dev/set_matrix.py --flavors "${{ github.event.inputs.flavors }}" --versions "${{ github.event.inputs.versions }}"
else
python dev/set_matrix.py
fi
test1:
needs: set-matrix
if: ${{ needs.set-matrix.outputs.is_matrix1_empty == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.set-matrix.outputs.matrix1) }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
repository: ${{ github.event_name == 'schedule' && 'mlflow/mlflow' || github.event.inputs.repository }}
ref: ${{ github.event.inputs.ref }}
- uses: ./.github/actions/free-disk-space
if: matrix.free_disk_space
- uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python }}
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
with:
java-version: ${{ matrix.java }}
- name: Install mlflow & test dependencies
run: |
pip install wheel
pip install .[extras]
pip install -r requirements/test-requirements.txt
- name: Install ${{ matrix.package }} ${{ matrix.version }}
run: |
${{ matrix.install }}
- uses: ./.github/actions/show-versions
- uses: ./.github/actions/pipdeptree
- name: Pre-test
if: matrix.pre_test
run: |
${{ matrix.pre_test }}
- name: Run tests
env:
MLFLOW_CONDA_HOME: /usr/share/miniconda
SPARK_LOCAL_IP: localhost
JOHNSNOWLABS_LICENSE_JSON: ${{ secrets.JOHNSNOWLABS_LICENSE_JSON }}
HF_HUB_ENABLE_HF_TRANSFER: 1
run: |
${{ matrix.run }}
test2:
needs: set-matrix
if: ${{ needs.set-matrix.outputs.is_matrix2_empty == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.set-matrix.outputs.matrix2) }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
repository: ${{ github.event_name == 'schedule' && 'mlflow/mlflow' || github.event.inputs.repository }}
ref: ${{ github.event.inputs.ref }}
- uses: ./.github/actions/free-disk-space
if: matrix.free_disk_space
- uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python }}
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
with:
java-version: ${{ matrix.java }}
- name: Install mlflow & test dependencies
run: |
pip install wheel
pip install .[extras]
pip install -r requirements/test-requirements.txt
- name: Install ${{ matrix.package }} ${{ matrix.version }}
run: |
${{ matrix.install }}
- uses: ./.github/actions/show-versions
- uses: ./.github/actions/pipdeptree
- name: Pre-test
if: matrix.pre_test
run: |
${{ matrix.pre_test }}
- name: Run tests
env:
MLFLOW_CONDA_HOME: /usr/share/miniconda
SPARK_LOCAL_IP: localhost
JOHNSNOWLABS_LICENSE_JSON: ${{ secrets.JOHNSNOWLABS_LICENSE_JSON }}
HF_HUB_ENABLE_HF_TRANSFER: 1
run: |
${{ matrix.run }}