Main workflow #126
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: Main workflow | |
env: | |
PKG_NAME: pash-annotations | |
PKG_NAME_WHEEL: pash_annotations | |
on: | |
pull_request: | |
push: | |
schedule: | |
- cron: '5 14 * * *' | |
jobs: | |
package-python: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Upgrade pip and build | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --upgrade build | |
- name: Build wheel | |
run: python3 -m build | |
- name: Upload binary wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./dist/*.whl | |
build-and-test: | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- ubuntu-latest | |
python-version: ["3.8", "3.9", "3.10"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# we don't reuse the wheels so that all of the CI runs can happen concurrently | |
- name: Install AnnotationLibrary directly | |
run: sudo python setup.py install | |
- name: Install pytest | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Test Annotation Library | |
run: | | |
pytest | |
deploy: | |
needs: | |
- package-python | |
- build-and-test | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Download distributions | |
uses: actions/download-artifact@v4 | |
- name: Deploy test distribution to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
verbose: true | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
- name: Deploy tagged release on PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
verbose: true |