Run python3 dev/update_mlflow_versions.py post-release...
(#13772)
#5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build a wheel for MLflow and upload it as an artifact. | |
name: build-wheel | |
on: | |
push: | |
branches: | |
- master | |
- branch-[0-9]+.[0-9]+ | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: "The branch, tag or SHA to build the wheel from." | |
required: true | |
default: "master" | |
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} | |
jobs: | |
build: | |
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
type: ["full", "skinny"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.ref }} | |
submodules: recursive | |
- uses: ./.github/actions/untracked | |
- uses: ./.github/actions/setup-python | |
- uses: ./.github/actions/setup-node | |
- name: Build UI | |
working-directory: mlflow/server/js | |
run: | | |
yarn | |
yarn build | |
- name: Install dependencies | |
run: | | |
pip install build twine | |
- name: Build distribution files | |
id: build-dist | |
run: | | |
# if workflow_dispatch is triggered, use the specified ref | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
SHA_OPT="--sha $(git rev-parse HEAD)" | |
else | |
SHA_OPT="" | |
fi | |
if [ "${{ matrix.type }}" == "skinny" ]; then | |
PACKAGE_TYPE_OPT="--package-type skinny" | |
else | |
PACKAGE_TYPE_OPT="" | |
fi | |
python dev/build.py $PACKAGE_TYPE_OPT $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 | |
run: | | |
tar -tf ${{ steps.build-dist.outputs.sdist-path }} | |
- name: List files in binary distribution | |
run: | | |
unzip -l ${{ steps.build-dist.outputs.wheel-path }} | |
- name: Compare files in source and binary distributions | |
run: | | |
tar -tzf ${{ steps.build-dist.outputs.sdist-path }} | grep -v '/$' | cut -d'/' -f2- | sort > /tmp/source.txt | |
zipinfo -1 ${{ steps.build-dist.outputs.wheel-path }} | sort > /tmp/wheel.txt | |
diff /tmp/source.txt /tmp/wheel.txt || true | |
- name: Run twine check | |
run: | | |
twine check --strict ${{ steps.build-dist.outputs.wheel-path }} | |
- name: Test installation from tarball | |
run: | | |
pip install ${{ steps.build-dist.outputs.sdist-path }} | |
python -c "import mlflow; print(mlflow.__version__)" | |
- name: Test installation from wheel | |
run: | | |
pip install --force-reinstall ${{ steps.build-dist.outputs.wheel-path }} | |
python -c "import mlflow; print(mlflow.__version__)" | |
# Anyone with read access can download the uploaded wheel on GitHub. | |
- name: Upload wheel | |
uses: actions/upload-artifact@v4 | |
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' | |
run: | | |
echo "### Download URL" >> $GITHUB_STEP_SUMMARY | |
echo "${{ steps.upload-wheel.outputs.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 |