-
Notifications
You must be signed in to change notification settings - Fork 708
130 lines (109 loc) · 3.18 KB
/
wheels.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
name: Build Wheels & Publish to PyPI
on:
pull_request:
workflow_dispatch:
release:
types: [published]
env:
USE_BAZEL_VERSION: "7.2.1"
jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: install python dependencies
run: pip install build twine
- name: build sdist
run: |
python -m build --sdist -o wheelhouse
- name: List and check sdist
run: |
ls -lh wheelhouse/
twine check wheelhouse/*
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: ./wheelhouse/*.tar.gz
build_wheels:
name: >
build ${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }}
${{ (matrix.arch) || '' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu]
python-version: ['cp39', 'cp310']
runs-on: ${{ format('{0}-latest', matrix.os) }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install python build dependencies
run: |
pip install wheel
- uses: bazel-contrib/setup-bazel@0.8.5
name: Set up Bazel
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}-${{ hashFiles('.github/workflows/wheels.yml') }}
# Share repository cache between workflows.
repository-cache: true
- name: Verify bazel installation
run: |
which bazel
bazel info
bazel version
- name: Install build
run: python -m pip install --upgrade pip build
- name: Build wheels
run: |
package_build/initialize.sh
python -m build --wheel package_build/tfx/
python -m build --wheel package_build/ml-pipelines-sdk/
mkdir wheelhouse
mv dist/*.whl wheelhouse/
- name: List and check wheels
run: |
pip install twine pkginfo>=1.10.0
${{ matrix.ls || 'ls -lh' }} wheelhouse/
twine check wheelhouse/*
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.python-version }}-${{ matrix.os }}
path: ./wheelhouse/*.whl
upload_to_pypi:
name: Upload to PyPI
runs-on: ubuntu-latest
if: (github.event_name == 'release' && startsWith(github.ref, 'refs/tags')) || (github.event_name == 'workflow_dispatch')
needs: [build_wheels, build_sdist]
environment:
name: pypi
url: https://pypi.org/p/tfx
permissions:
id-token: write
steps:
- name: Retrieve wheels and sdist
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: wheels/
- name: List the build artifacts
run: |
ls -lAs wheels/
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.9
with:
packages_dir: wheels/