forked from mlflow/mlflow
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (119 loc) · 4.4 KB
/
build-wheel.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# 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:
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