Packaging #96
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: Packaging | |
on: | |
push: | |
schedule: | |
- cron: '0 2 * * 3' | |
jobs: | |
format: | |
name: Check formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install tox | |
run: python -m pip install tox | |
- name: Run yapf | |
run: tox -e format | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install tox | |
run: python -m pip install tox | |
- name: Run flake8 | |
run: tox -e lint | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: | |
- version: "3.11" | |
toxenv: "py311" | |
- version: "3.10" | |
toxenv: "py310" | |
- version: "3.9" | |
toxenv: "py39" | |
- version: "3.8" | |
toxenv: "py38" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python.version }} | |
- name: Install tox | |
run: python -m pip install tox | |
- name: Run pytest | |
run: tox -e ${{ matrix.python.toxenv }} | |
- name: Test tutorials | |
run: | | |
python3 -m pip install papermill ipykernel . | |
cd docs/tutorial | |
papermill explorative_analysis.ipynb --help-notebook | |
papermill log_reg.ipynb --help-notebook | |
papermill explorative_analysis.ipynb explorative_analysis_tested.ipynb | |
papermill log_reg.ipynb log_reg_tested.ipynb | |
build_source_dist: | |
name: Build source distribution | |
if: startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install build | |
run: python -m pip install build | |
- name: Run build | |
run: python -m build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./dist/*.tar.gz | |
# build_wheels: | |
# name: Build wheels on ${{ matrix.os }} | |
# if: startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/tags') | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# matrix: | |
# os: [ubuntu-20.04, windows-2019, macOS-10.15] | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: actions/setup-python@v5 | |
# with: | |
# python-version: "3.10" | |
# - name: Install cibuildwheel | |
# run: python -m pip install cibuildwheel==2.3.1 | |
# - name: Build wheels | |
# run: python -m cibuildwheel --output-dir wheels | |
# - uses: actions/upload-artifact@v4 | |
# with: | |
# path: ./wheels/*.whl | |
publish: | |
name: Publish package | |
if: startsWith(github.ref, 'refs/tags') | |
needs: | |
- format | |
- lint | |
- test | |
- build_source_dist | |
# - build_wheels | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: ./dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |