Update actions/setup-python action to v5 #107
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: CI/CD | |
on: push | |
jobs: | |
test: | |
name: Test Python | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
steps: | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run checks for Python ${{ matrix.python-version }} | |
env: | |
CI: true | |
run: | | |
python -V | |
make .venv/requirements.timestamp | |
make git-attributes | |
make lint | |
make test | |
ls -ls ./ | |
- name: Send coverage | |
run: | | |
bash <(curl -s https://codecov.io/bash) | |
deploy-dev: | |
name: Deploy to PyPI Test | |
needs: | |
- test | |
if: ${{ github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- name: Build packages | |
run: | | |
pip install wheel -r requirements.txt | |
sed -i "s/\(version='[0-9]*\.[0-9]*\.[0-9]*\)\('\)/\1.dev$(date +%Y%m%d%H%M%S)\2/g" setup.py | |
sed -i "s/5 - Production\/Stable/4 - Beta/g" setup.py | |
python setup.py clean check sdist bdist_wheel | |
- name: Upload to PyPI Test | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.TEST_PYPI_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
deploy-tag: | |
name: Deploy to PyPI | |
needs: | |
- test | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- name: Build packages | |
run: | | |
pip install wheel -r requirements.txt | |
python setup.py clean check sdist bdist_wheel | |
- name: Upload to PyPI | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.PYPI_TOKEN }} | |
build-doc: | |
name: Build docs for each version | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Build docs | |
run: | | |
python -V | |
pip install -r requirements.txt | |
sphinx-build -b html doc/source/ doc/build/html/ | |
touch doc/build/html/.nojekyll | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs | |
path: doc/build/html/ | |
retention-days: 1 | |
deploy-doc: | |
name: Deploy docs to GitHub Pages | |
needs: | |
- build-doc | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | ${{ github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: docs | |
path: doc/build/html/ | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: doc/build/html |