Update all dependencies #307
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: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
permissions: | |
# https://github.community/t/permissions-nesecary-to-comment-on-a-pr/179047/5 | |
pull-requests: write | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
python-version: [ '3.9', '3.10', 'pypy3.9' ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Update version number | |
if: startsWith(github.ref, 'refs/tags/') | |
run: sed -i -e "s/0.0.0/${GITHUB_REF##*/}/" pyproject.toml | |
- name: Set up Python | |
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Check isort, black, and flake8 | |
run: | | |
pip install black flake8 isort | |
isort --profile black . | |
black . | |
flake8 . | |
- name: Install poetry | |
run: | | |
python -m pip install poetry==1.4.2 | |
- name: Configure poetry | |
run: | | |
python -m poetry config virtualenvs.in-project true | |
- name: Upload logs on failure | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 | |
if: failure() | |
with: | |
name: logs | |
path: "*.log" | |
- name: Cache the virtualenv | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 | |
with: | |
path: ./.venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
run: | | |
python -m poetry install | |
- name: Run tests with coverage | |
run: | | |
# Run the unit tests | |
python -m poetry run coverage run -a -m unittest discover -v src | |
# Run the example plugin | |
python -m poetry run coverage run -a ./example_plugin.py -f example.yaml | |
# Test the example plugin | |
python -m poetry run coverage run -a ./test_example_plugin.py | |
# Generate the coverage HTML report | |
python -m poetry run coverage html | |
- name: Publish coverage report to job summary | |
# publishing only once | |
if: ${{ matrix.python-version == '3.9'}} | |
run: | | |
poetry run html2text --ignore-images --ignore-links -b 0 htmlcov/index.html >> $GITHUB_STEP_SUMMARY | |
- name: Generate documentation | |
run: | | |
poetry run sphinx-apidoc -o docs/ -f -a -e src/ --doc-project "Python SDK for Arcaflow" | |
poetry run make -C docs html | |
- name: Build | |
run: poetry build | |
- name: Upload dist artifact | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 | |
with: | |
name: dist | |
path: dist | |
if-no-files-found: error | |
- name: Upload coverage HTML artifact | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 | |
with: | |
name: coverage | |
path: htmlcov | |
if-no-files-found: error | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Check out code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3 | |
with: | |
name: dist | |
path: dist | |
- name: Install twine | |
run: pip install -U twine | |
- name: Publish | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{secrets.PYPI_TOKEN}} | |
TWINE_NON_INTERACTIVE: true | |
run: twine upload dist/* |