v2.6.0 #92
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: Release - pip package | |
on: | |
push: | |
branches: [ 'release/*' ] | |
tags: ['v*'] | |
pull_request: | |
branches: [ 'release/*' ] | |
release: | |
types: [published] | |
jobs: | |
# long running tests and check of image generation | |
full_test: | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r tests/requirements-test.txt | |
- name: Run all test with pytest | |
run: | | |
pytest -k "slow" tests/ | |
- name: Check images generation for documentation | |
run: | | |
cd docs/images_generation && ./run.sh | |
# test if package generation works and optional package upload to pypi (only on release) | |
make_and_upload_package: | |
runs-on: ubuntu-latest | |
needs: [full_test] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Make wheel package and validate it | |
run: | | |
pip install wheel twine | |
# first call to version method would generate VERSION file | |
PYTHONPATH=. python pymchelper/run.py --version | |
python setup.py bdist_wheel | |
twine check dist/*.whl | |
# makes source package | |
python setup.py sdist | |
- name: publish package to pypi | |
uses: pypa/gh-action-pypi-publish@v1.8.10 | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
with: | |
# Password for your PyPI user or an access token | |
password: ${{ secrets.TWINE_PASSWORD }} | |
# The target directory for distribution | |
packages_dir: dist/ | |
# Show verbose output. | |
verbose: true | |
# sphinx documentation generation and optional upload to github pages (on release) | |
docs: | |
runs-on: ubuntu-latest | |
needs: [make_and_upload_package] | |
permissions: | |
id-token: write | |
pages: write | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Build and Commit | |
uses: sphinx-notes/pages@3.0 | |
with: | |
documentation_path: docs | |
requirements_path: docs/requirements.txt | |
- name: Push changes to gh-pages branch | |
# this action is being triggered on release tags (named v*) | |
if: "github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')" | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages |