Skip to content

Commit c2a5c50

Browse files
authored
chore: Reusable workflows to reuse build_wheels workflow in publish (#2880)
* Update reusable workflows Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Update reusable workflows Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Update reusable workflows Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Fix Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Fix Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Fix Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Fix Signed-off-by: Kevin Zhang <kzhang@tecton.ai>
1 parent c87da51 commit c2a5c50

File tree

2 files changed

+8
-156
lines changed

2 files changed

+8
-156
lines changed

.github/workflows/build_wheels.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: build_wheels
22

3-
on: workflow_dispatch
3+
# Call this workflow from other workflows in the repository by specifying "uses: ./.github/workflows/build_wheels.yml"
4+
on: [workflow_dispatch, workflow_call]
45

56
jobs:
67
get-version:
@@ -76,6 +77,7 @@ jobs:
7677
make install-go-ci-dependencies
7778
git status
7879
CIBW_BEFORE_TEST: "cd {project} && git status"
80+
# py3.10 on MacOS does not work with Go so we have to install separately. Issue is tracked here: https://github.com/feast-dev/feast/issues/2881.
7981
- name: Build py310 specific wheels for macos
8082
if: matrix.os == 'macos-10.15'
8183
uses: pypa/cibuildwheel@v2.7.0
@@ -169,6 +171,7 @@ jobs:
169171
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26.0
170172
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0
171173
pip install dist/*tar.gz
174+
# py3.10 on MacOS does not work with Go so we have to install separately. Issue is tracked here: https://github.com/feast-dev/feast/issues/2881
172175
- name: Install dist w/o go
173176
if: ${{ matrix.from-source && matrix.python-version == '3.10' && matrix.os == 'macos-10.15'}}
174177
run: pip install dist/*tar.gz

.github/workflows/publish.yml

Lines changed: 4 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,12 @@ jobs:
125125
- name: Publish Helm charts
126126
run: ./infra/scripts/helm/push-helm-charts.sh $VERSION_WITHOUT_PREFIX
127127

128+
build_wheels:
129+
uses: ./.github/workflows/build_wheels.yml
130+
128131
publish-python-sdk:
129132
runs-on: ubuntu-latest
130-
needs: [verify-python-wheel]
133+
needs: [build_wheels]
131134
steps:
132135
- uses: actions/download-artifact@v2
133136
with:
@@ -138,160 +141,6 @@ jobs:
138141
user: __token__
139142
password: ${{ secrets.PYPI_PASSWORD }}
140143

141-
build-python-wheel:
142-
name: Build wheels on ${{ matrix.os }}
143-
runs-on: ${{ matrix.os }}
144-
strategy:
145-
matrix:
146-
os: [ ubuntu-latest, macos-10.15 ]
147-
steps:
148-
- uses: actions/checkout@v2
149-
- name: Setup Node
150-
uses: actions/setup-node@v2
151-
with:
152-
node-version: '17.x'
153-
registry-url: 'https://registry.npmjs.org'
154-
- name: Build UI
155-
run: make build-ui
156-
- name: Build wheels
157-
uses: pypa/cibuildwheel@v2.7.0
158-
env:
159-
CIBW_BUILD: "cp3*_x86_64"
160-
CIBW_SKIP: "cp36-* *-musllinux_x86_64 cp310-macosx_x86_64"
161-
CIBW_ARCHS: "native"
162-
CIBW_ENVIRONMENT: >
163-
COMPILE_GO=True PATH=$PATH:/usr/local/go/bin
164-
CIBW_BEFORE_ALL_LINUX: |
165-
curl -o go.tar.gz https://dl.google.com/go/go1.18.2.linux-amd64.tar.gz
166-
tar -C /usr/local -xzf go.tar.gz
167-
go version
168-
CIBW_BEFORE_ALL_MACOS: |
169-
curl -o python.pkg https://www.python.org/ftp/python/3.9.12/python-3.9.12-macosx10.9.pkg
170-
sudo installer -pkg python.pkg -target /
171-
CIBW_BEFORE_BUILD: |
172-
make install-protoc-dependencies
173-
make install-go-proto-dependencies
174-
make install-go-ci-dependencies
175-
git status
176-
CIBW_BEFORE_TEST: "cd {project} && git status"
177-
- name: Build py310 specific wheels for macos
178-
if: matrix.os == 'macos-10.15'
179-
uses: pypa/cibuildwheel@v2.7.0
180-
env:
181-
CIBW_BUILD: "cp310-macosx_x86_64"
182-
CIBW_ARCHS: "native"
183-
- uses: actions/upload-artifact@v2
184-
with:
185-
name: wheels
186-
path: ./wheelhouse/*.whl
187-
188-
build-source-distribution:
189-
name: Build source distribution
190-
runs-on: macos-10.15
191-
steps:
192-
- uses: actions/checkout@v2
193-
- name: Setup Python
194-
id: setup-python
195-
uses: actions/setup-python@v2
196-
with:
197-
python-version: "3.10"
198-
architecture: x64
199-
- name: Setup Node
200-
uses: actions/setup-node@v2
201-
with:
202-
node-version: '17.x'
203-
registry-url: 'https://registry.npmjs.org'
204-
- name: Build and install dependencies
205-
run: |
206-
pip install -U pip setuptools wheel twine
207-
make install-protoc-dependencies
208-
make install-go-proto-dependencies
209-
make install-go-ci-dependencies
210-
make build-ui
211-
- name: Build
212-
run: |
213-
python3 setup.py sdist
214-
- uses: actions/upload-artifact@v2
215-
with:
216-
name: wheels
217-
path: dist/*
218-
219-
verify-python-wheel:
220-
runs-on: ${{ matrix.os }}
221-
needs: [build-python-wheel, build-source-distribution]
222-
strategy:
223-
matrix:
224-
os: [ubuntu-latest, macos-10.15 ]
225-
python-version: [ "3.7", "3.8", "3.9", "3.10"]
226-
from-source: [ True, False ]
227-
env:
228-
# this script is for testing servers
229-
# it starts server with timeout and checks whether process killed by timeout (started healthy) or died by itself
230-
TEST_SCRIPT: |
231-
timeout 10s $@ & pid=$!
232-
wait $pid
233-
ret=$?
234-
if [[ $ret -ne 124 ]]
235-
then
236-
exit $ret
237-
else
238-
echo "Succeeded!"
239-
fi
240-
steps:
241-
- name: Setup Python
242-
id: setup-python
243-
uses: actions/setup-python@v2
244-
with:
245-
python-version: ${{ matrix.python-version }}
246-
architecture: x64
247-
- uses: actions/setup-go@v3
248-
with:
249-
go-version: '>=1.17.0'
250-
- uses: actions/download-artifact@v2
251-
with:
252-
name: wheels
253-
path: dist
254-
- name: Install wheel
255-
if: ${{ !matrix.from-source }}
256-
# try to install all wheels; only the current platform wheel should be actually installed
257-
run: |
258-
cd dist/
259-
pip install wheel
260-
for f in *.whl; do pip install $f || true; done
261-
- name: Install dist with go
262-
if: ${{ matrix.from-source && (matrix.python-version != '3.10' || matrix.os == 'ubuntu-latest')}}
263-
env:
264-
COMPILE_GO: "True"
265-
run: |
266-
pip install 'grpcio-tools==1.44.0' 'pybindgen==0.22.0'
267-
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26.0
268-
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0
269-
pip install dist/*tar.gz
270-
- name: Install dist w/o go
271-
if: ${{ matrix.from-source && matrix.python-version == '3.10' && matrix.os == 'macos-10.15'}}
272-
run: pip install dist/*tar.gz
273-
- name: Install OS X dependencies
274-
if: matrix.os == 'macos-10.15'
275-
run: brew install coreutils
276-
- name: Smoke test
277-
run: |
278-
feast init test_repo
279-
cd test_repo/
280-
feast apply
281-
echo "$TEST_SCRIPT" > run-and-wait.sh
282-
bash run-and-wait.sh feast serve
283-
bash run-and-wait.sh feast ui
284-
# We disable this test for the Python 3.10 binary since it does not include Go.
285-
- name: Smoke test with go
286-
if: matrix.python-version != '3.10' || matrix.os == 'ubuntu-latest'
287-
run: |
288-
cd test_repo/
289-
feast apply
290-
echo "$TEST_SCRIPT" > run-and-wait.sh
291-
pip install cffi
292-
printf "\ngo_feature_retrieval: True" >> feature_store.yaml
293-
bash run-and-wait.sh feast serve
294-
295144
publish-java-sdk:
296145
container: maven:3.6-jdk-11
297146
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)