AIP-9641: Update to publish to pypi. Fix code for updated dependencies. #284
Workflow file for this run
This file contains hidden or 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: Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| - tz/strong-typed-factory | |
| release: | |
| types: | |
| - created | |
| jobs: | |
| test: | |
| name: ${{ matrix.lang }} tests on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| lang: [Python] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.10' | |
| - name: Install Poetry | |
| run: | | |
| pip install --upgrade pip | |
| pip install poetry coveragepy-lcov==0.1.1 | |
| - name: Configure poetry | |
| run: poetry config virtualenvs.in-project true | |
| - name: Tell Poetry to use Python 3.10 | |
| run: poetry env use python3.10 | |
| - name: Setup Cache Poetry virtualenv | |
| uses: actions/cache@v4 | |
| id: cached-poetry-dependencies | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/test.yml') }} | |
| - name: Ensure cache is healthy | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit == 'true' | |
| run: | | |
| poetry show || rm -rf .venv | |
| - name: Install Dependencies | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| run: | | |
| poetry install -E dask -E spark -E kubernetes | |
| poetry run pip install --upgrade git+https://github.com/zillow/metaflow.git@feature/kfp | |
| - name: Code Quality Check | |
| run: | | |
| poetry run black zdatasets --check | |
| poetry run flake8 zdatasets | |
| - name: Execute Python tests | |
| run: | | |
| poetry run pytest zdatasets | |
| pip install coverage==6.1.2 | |
| coveragepy-lcov | |
| - name: Publish to coveralls.io | |
| uses: coverallsapp/github-action@master | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| path-to-lcov: lcov.info | |
| - name: Poetry Build | |
| run: | | |
| poetry build | |
| - name: Publish distribution to Test PyPI | |
| uses: pypa/gh-action-pypi-publish@master | |
| with: | |
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| repository_url: https://test.pypi.org/legacy/ | |
| skip_existing: true | |
| - name: Publish distribution to PyPI | |
| if: github.event_name == 'release' && github.event.action == 'created' | |
| uses: pypa/gh-action-pypi-publish@master | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} |