Update CITATION #2
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: Tests & Publishes to PyPI | |
on: | |
release: | |
types: [published] | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "*" | |
env: | |
PROJECT_NAME: unilvq | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] # "3.13" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 9 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v3 | |
id: depcache | |
with: | |
path: deps | |
key: requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }} | |
- name: Download dependencies | |
if: steps.depcache.outputs.cache-hit != 'true' | |
run: | | |
pip download --dest=deps -r requirements.txt | |
- name: Install dependencies | |
run: | | |
pip install -U --no-index --find-links=deps $(find deps -name '*.whl') | |
pip install pytest pytest-cov flake8 | |
pip install -r requirements.txt | |
- name: Run tests | |
run: | | |
pytest --doctest-modules --junitxml=junit/pytest-results-${{ matrix.python-version }}.xml --cov=$PROJECT_NAME --cov-report=xml tests/ | |
flake8 tests/ | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: junit/pytest-results-${{ matrix.python-version }}.xml | |
if: always() | |
- name: Install build dependencies (only for Python 3.11) | |
if: matrix.python-version == '3.11' | |
run: | | |
pip install -r requirements.txt | |
pip install --upgrade setuptools wheel twine | |
- name: Build package (only for Python 3.11) | |
if: matrix.python-version == '3.11' | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Upload dist as artifact (only for Python 3.11) | |
if: matrix.python-version == '3.11' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-package | |
path: dist | |
publish: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'release' | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Download dist artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist-package | |
path: dist | |
- name: Publish to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
attestations: false | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
attestations: true |