Merge pull request #100 from tiagocoutinho/patch-1 #87
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: Test and Build | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install pytest | |
- name: Run tests | |
run: pytest | |
- name: Build | |
run: python setup.py build | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r docs/doc-requirements.txt | |
- name: Build documentation | |
run: | | |
cd docs | |
make html | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: sphinx-out | |
path: ./docs/_build/ | |
retention-days: 5 | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Build wheel and sdist | |
run: pipx run build | |
- name: Check build artifacts | |
run: pipx run twine check --strict dist/* | |
release: | |
needs: [test, build] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install pypa/build | |
run: | | |
python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: | | |
git clean -dfx | |
python -m build --sdist --wheel --outdir dist/ . | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip_existing: true | |
# - name: Publish GitHub release | |
# uses: softprops/action-gh-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |