Skip to content

test full workflow

test full workflow #76

Workflow file for this run

name: publish
on:
push:
# REMOVE
release:
types: [published] # Runs both for releases and prereleases
jobs:
# test:
# uses: google/temporian/.github/workflows/test.yaml@main
# secrets: inherit
build-linux:
runs-on: ubuntu-latest
container: gcr.io/tfx-oss-public/manylinux2014-bazel:bazel-5.3.0
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build package
run: |
version="${{ matrix.python-version }}"
versionstr=${version//./}
PYTHON_VERSION=$versionstr ./tools/build_manylinux.sh
- name: Save package for following jobs
uses: actions/upload-artifact@v3
with:
name: dist-ubuntu-${{ matrix.python-version }}
path: dist
# macos-XXX-large are Intel runners, macos-XXX-xlarge are arm64 runners
# https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners
build-macos-intel:
runs-on: macos-13-large
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: pip install poetry
- name: Build package
run: poetry build
- name: Save package for following jobs
uses: actions/upload-artifact@v3
with:
name: dist-macos-intel-${{ matrix.python-version }}
path: dist
build-macos-arm:
runs-on: macos-13-xlarge
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3
# actions/setup-python doesn't support py < 3.10 on macos arm
# https://github.com/actions/setup-python/issues/696#issuecomment-1637587760
- name: Install Python
run: |
brew update
brew install python@${{ matrix.python-version }}
- name: Install pip
run: |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python${{ matrix.python-version }} get-pip.py
- name: Install poetry
run: pip install poetry
- name: Build package
run: poetry build
- name: Save package for following jobs
uses: actions/upload-artifact@v3
with:
name: dist-macos-arm-${{ matrix.python-version }}
path: dist
test-install:
# needs: [build-linux, build-macos-intel, build-macos-arm]
needs: [build-macos-arm]
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
platform:
[
{ runner: ubuntu-latest, artifact: ubuntu },
{ runner: macos-13-large, artifact: macos-intel },
]
runs-on: ${{ matrix.platform.runner }}
env:
# Workaround for macos pip compatibility issue
# See https://github.com/actions/setup-python/issues/469
SYSTEM_VERSION_COMPAT: 0
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download build
uses: actions/download-artifact@v3
with:
name: dist-${{ matrix.platform.artifact }}-${{ matrix.python-version }}
path: dist
- name: Install from wheel
run: pip install dist/*.whl
- name: Test installation
run: python tools/check_install.py
test-macos-arm-install:
needs: [build-macos-arm]
runs-on: macos-13-xlarge
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python
run: |
brew update
brew install python@${{ matrix.python-version }}
- name: Install pip
run: |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python${{ matrix.python-version }} get-pip.py
- name: Download build
uses: actions/download-artifact@v3
with:
name: dist-macos-arm-${{ matrix.python-version }}
path: dist
- name: Install from wheel
run: pip install dist/*.whl
- name: Test installation
run: python${{ matrix.python-version }} tools/check_install.py
publish:
# needs: [test, test-install, test-macos-arm-install]
needs: [test-install, test-macos-arm-install]
runs-on: ubuntu-latest
environment: pypi
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install poetry
run: pip install poetry
- name: Download builds for all Python versions and platforms
uses: actions/download-artifact@v3
with:
# Skipping `name` key to download all artifacts from this workflow
# Artifacts are are downloaded to dist/<artifact-name>
path: dist
- name: Move wheels and sources to dist/
run: |
mv dist/*/*.whl dist/
mv -n dist/*/*.tar.gz dist/
- name: Publish to PyPI
run: poetry publish --no-interaction --skip-existing