Add testing workflow #6
Workflow file for this run
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
name: Build | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
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: data-validation-wheel-py${{ matrix.python-version }} | |
path: dist/*.whl | |
- name: Install built wheel | |
run: | | |
pip install twine | |
twine check dist/* | |
pip install dist/*.whl | |
- name: Install test dependencies | |
run: | | |
pip install pytest scikit-learn scipy | |
- name: Run Test | |
run: | | |
rm -rf bazel-* | |
# run tests | |
pytest -vv | |
# - name: Debugging with tmate | |
# if: failure() | |
# uses: mxschmitt/[email protected] | |
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/tensorflow-data-validation/ | |
permissions: | |
id-token: write | |
steps: | |
- name: Retrieve wheels | |
uses: actions/[email protected] | |
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/ |