Migration to python3 #99
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
# GitHub Action workflow to build and test the library | |
# | |
name: Build and test pysap | |
on: [push, pull_request] | |
jobs: | |
health: | |
name: Check code health | |
runs-on: ubuntu-latest | |
if: | |
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != | |
github.repository | |
steps: | |
- name: Checkout pysap | |
uses: actions/checkout@v3 | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install Python dependencies | |
run: | | |
python -m pip install flake8 | |
- name: Check syntax errors | |
run: | | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
- name: Check PEP8 warnings | |
run: | | |
flake8 . --count --ignore=E1,E2,E3,E501,W291,W293 --exit-zero --max-complexity=65 --max-line-length=127 --statistics | |
test: | |
name: Run unit tests and build wheel | |
needs: health | |
runs-on: ${{ matrix.os }} | |
if: | |
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != | |
github.repository | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.12"] | |
experimental: [false] | |
continue-on-error: ${{ matrix.experimental }} | |
steps: | |
- name: Checkout pysap | |
uses: actions/checkout@v3 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip wheel tox tox-gh-actions | |
python -m pip install -r requirements.txt -r requirements-test.txt | |
- name: Run unit tests | |
run: | | |
tox | |
- name: Build wheel artifact | |
run: | | |
python -m pip wheel -w dist/ . | |
- name: Upload wheel artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: dist/*.whl | |
docs: | |
name: Build documentation and source package | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- name: Checkout pysap | |
uses: actions/checkout@v3 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Linux dependencies | |
run: | | |
sudo apt-get install pandoc texlive-latex-base ghostscript | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip wheel tox tox-gh-actions | |
python -m pip install -r requirements-docs.txt | |
- name: Install the library | |
run: | | |
python -m pip install . | |
- name: Pre-run documentation notebooks | |
run: | | |
tox -e notebooks | |
- name: Build documentation | |
run: | | |
tox -e doc | |
- name: Build source artifact | |
run: | | |
python setup.py sdist | |
- name: Upload source artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: dist/*.tar.gz | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [test, docs] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'v') }} | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: packages | |
path: dist | |
- name: Create release and upload assets | |
uses: meeDamian/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: pysap ${{ github.ref }} | |
draft: true | |
files: dist/ | |
gzip: folders |