-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
re-usable build workflow and upload to pypi
- Loading branch information
Showing
3 changed files
with
67 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Resusable steps to build tfx-bsl | ||
|
||
inputs: | ||
python-version: | ||
description: 'Python version' | ||
required: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
|
||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Upgrade pip | ||
shell: bash | ||
run: | | ||
python -m pip install --upgrade pip pytest | ||
- name: Build the package for Python ${{ inputs.python-version }} | ||
shell: bash | ||
run: | | ||
version="${{ inputs.python-version }}" | ||
docker compose run -e PYTHON_VERSION=$(echo "$version" | sed 's/\.//') manylinux2010 | ||
- name: Upload wheel artifact for Python ${{ inputs.python-version }} | ||
uses: actions/[email protected] | ||
with: | ||
name: tfx-bsl-wheel-py${{ inputs.python-version }} | ||
path: dist/*.whl | ||
|
||
- name: Install built wheel | ||
shell: bash | ||
run: | | ||
pip install twine | ||
twine check dist/* | ||
pip install dist/*.whl |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,28 +33,34 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
- name: Build tfx-bsl | ||
id: build-tfx-bsl | ||
uses: ./.github/reusable-build | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
|
||
- name: Build the manylinux2010 image | ||
run: docker compose build manylinux2010 | ||
|
||
- name: Build the package for Python ${{ matrix.python-version }} | ||
run: | | ||
version="${{ matrix.python-version }}" | ||
docker compose run -e PYTHON_VERSION=$(echo "$version" | sed 's/\.//') manylinux2010 | ||
- name: Upload wheel artifact for Python ${{ matrix.python-version }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: tfx-bsl-wheel-py${{ matrix.python-version }} | ||
path: dist/*.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] | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/struct2tensor/ | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Retrieve wheels | ||
uses: actions/[email protected] | ||
with: | ||
merge-multiple: true | ||
path: wheels | ||
|
||
- name: Install built wheel | ||
run: pip install dist/*.whl | ||
- 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/ |
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