Skip to content

ODH Sync

ODH Sync #890

Workflow file for this run

# Build a wheel for MLflow and upload it as an artifact.
name: build-wheel
on:
push:
branches:
- master
- branch-[0-9]+.[0-9]+
- main
- rhoai-*
pull_request:
types:
- opened
- synchronize
- reopened
paths-ignore:
- "docs/**"
- "**.md"
- "dev/clint/**"
- ".github/workflows/docs.yml"
- ".github/workflows/preview-docs.yml"
- "mlflow/server/js/**"
- ".github/workflows/js.yml"
workflow_dispatch:
inputs:
ref:
description: "The branch, tag or SHA to build the wheel from."
required: true
default: "master"
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
build:
if: github.event_name != 'pull_request' || (github.event.pull_request.draft == false || github.event.pull_request.user.login == 'Copilot' && github.event.pull_request.user.type == 'Bot')
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
strategy:
fail-fast: false
matrix:
type: ["dev", "skinny", "tracing"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
ref: ${{ github.event.inputs.ref }}
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- if: matrix.type == 'dev'
uses: ./.github/actions/setup-node
- name: Build UI
if: matrix.type == 'dev'
working-directory: mlflow/server/js
run: |
yarn install --immutable
yarn build
- name: Create placeholder UI
if: matrix.type != 'dev'
run: |
mkdir -p mlflow/server/js/build
echo "<html></html>" > mlflow/server/js/build/index.html
- name: Install dependencies
run: |
uv pip install --system build setuptools twine wheel
- name: Build distribution files
id: build-dist
env:
EVENT_NAME: ${{ github.event_name }}
MATRIX_TYPE: ${{ matrix.type }}
run: |
# if workflow_dispatch is triggered, use the specified ref
if [ "$EVENT_NAME" == "workflow_dispatch" ]; then
SHA_OPT="--sha $(git rev-parse HEAD)"
else
SHA_OPT=""
fi
python dev/build.py --package-type "$MATRIX_TYPE" $SHA_OPT
# List distribution files and check their file sizes
ls -lh dist
# Set step outputs
sdist_path=$(find dist -type f -name "*.tar.gz")
wheel_path=$(find dist -type f -name "*.whl")
wheel_name=$(basename $wheel_path)
wheel_size=$(stat -c %s $wheel_path)
echo "sdist-path=${sdist_path}" >> $GITHUB_OUTPUT
echo "wheel-path=${wheel_path}" >> $GITHUB_OUTPUT
echo "wheel-name=${wheel_name}" >> $GITHUB_OUTPUT
echo "wheel-size=${wheel_size}" >> $GITHUB_OUTPUT
- name: List files in source distribution
env:
SDIST_PATH: ${{ steps.build-dist.outputs.sdist-path }}
run: |
tar -tf $SDIST_PATH
- name: List files in binary distribution
env:
WHEEL_PATH: ${{ steps.build-dist.outputs.wheel-path }}
run: |
unzip -l $WHEEL_PATH
- name: Compare files in source and binary distributions
env:
SDIST_PATH: ${{ steps.build-dist.outputs.sdist-path }}
WHEEL_PATH: ${{ steps.build-dist.outputs.wheel-path }}
run: |
tar -tzf $SDIST_PATH | grep -v '/$' | cut -d'/' -f2- | sort > /tmp/source.txt
zipinfo -1 $WHEEL_PATH | sort > /tmp/wheel.txt
diff /tmp/source.txt /tmp/wheel.txt || true
- name: Run twine check
env:
WHEEL_PATH: ${{ steps.build-dist.outputs.wheel-path }}
run: |
twine check --strict $WHEEL_PATH
- name: Test installation from tarball
env:
SDIST_PATH: ${{ steps.build-dist.outputs.sdist-path }}
run: |
uv pip install --system $SDIST_PATH
python -c "import mlflow; print(mlflow.__version__)"
python -c "from mlflow import *"
- name: Test installation from wheel
env:
WHEEL_PATH: ${{ steps.build-dist.outputs.wheel-path }}
run: |
uv pip install --system --force-reinstall $WHEEL_PATH
python -c "import mlflow; print(mlflow.__version__)"
python -c "from mlflow import *"
- name: Test installation from GitHub
env:
REPO: ${{ github.repository }}
REF: ${{ github.ref }}
MATRIX_TYPE: ${{ matrix.type }}
run: |
if [ "$MATRIX_TYPE" == "skinny" ]; then
URL="git+https://github.com/${REPO}.git@${REF}#subdirectory=libs/skinny"
elif [ "$MATRIX_TYPE" == "tracing" ]; then
URL="git+https://github.com/${REPO}.git@${REF}#subdirectory=libs/tracing"
else
URL="git+https://github.com/${REPO}.git@${REF}"
fi
uv run --isolated --no-project --with $URL python -I -c 'import mlflow; print(mlflow.__version__)'
- name: Test dev/install-skinny.sh
if: github.event_name == 'pull_request'
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
dev/install-skinny.sh pull/$PR_NUMBER/merge
# Anyone with read access can download the uploaded wheel on GitHub.
- name: Upload wheel
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: github.event_name == 'workflow_dispatch'
id: upload-wheel
with:
name: ${{ steps.build-dist.outputs.wheel-name }}
path: ${{ steps.build-dist.outputs.wheel-path }}
retention-days: 7
if-no-files-found: error
- name: Generate summary
if: github.event_name == 'workflow_dispatch'
env:
ARTIFACT_URL: ${{ steps.upload-wheel.outputs.artifact-url }}
run: |
echo "### Download URL" >> $GITHUB_STEP_SUMMARY
echo "$ARTIFACT_URL" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Notes" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- The artifact will be deleted after 7 days." >> $GITHUB_STEP_SUMMARY
echo "- Unzip the downloaded artifact to get the wheel." >> $GITHUB_STEP_SUMMARY