Skip to content

wip migration to mkdocs #34

wip migration to mkdocs

wip migration to mkdocs #34

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: segysak actions
on: [push, pull_request]
jobs:
build-test:
name: Build and test segysak
strategy:
max-parallel: 1
fail-fast: true
matrix:
os: ["windows-latest", "ubuntu-latest", "macos-latest"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
exclude:
- os: macos-latest
python-version: "3.9"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
# required for `git describe --tags` to work
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false
# get zgy submodule
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
#cache: 'pip'
- name: Install package and deps
run: |
python -m pip install --upgrade pip
pip install .[test]
- name: Run tests
run: |
pytest -v
- name: Build wheels
run: pip wheel . -w dist --no-deps
- name: Upload wheel as artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }} Python ${{ matrix.python }} wheel
path: dist/*
docs-build-publish:
name: Build Notebook Examples and RTD Publish
runs-on: ubuntu-latest
needs: [build-test]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Need to fetch more than the last commit so that setuptools_scm can
# create the correct version string. If the number of commits since
# the last release is greater than this, the version will still be
# wrong. Increase if necessary.
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false
# get zgy submodule
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
#cache: 'pip'
- name: Install dependencies and pacakge
run: |
python -m pip install --upgrade pip
pip install .[docs]
- name: What is my env spec?
run: pip list
- name: What are my kernels?
run: jupyter kernelspec list
- name: Execute the notebooks
run: |
xvfb-run jupytext --to ipynb --execute examples/*.py
mv examples/*.ipynb examples/notebooks/.
- name: Artifact Upload
if: success()
uses: actions/upload-artifact@v3
with:
name: example-notebooks-${{ github.sha }}
path: examples/notebooks
- name: Trigger RTDs build
if: success()
uses: dfm/rtds-action@v1
with:
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }}
webhook_token: ${{ secrets.RTDS_WEBHOOK_TOKEN }}
commit_ref: ${{ github.ref }}
publish:
if: github.event_name == 'push'
name: Publish to test.PyPI and PyPI
runs-on: ubuntu-latest
needs: [build-test]
steps:
- name: Get wheels
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Move to dist/
run: |
mkdir dist
find artifacts -name "*.whl" -exec mv '{}' dist/ \;
- name: Publish package to test.PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository_url: https://test.pypi.org/legacy/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
# If this is a tagged release
if: startsWith(github.ref, 'refs/tags')