Skip to content

DOCS: replace napolean with numpydoc for the API docs. #3210

DOCS: replace napolean with numpydoc for the API docs.

DOCS: replace napolean with numpydoc for the API docs. #3210

Workflow file for this run

# Reference:
# - https://github.com/actions/checkout
# - https://github.com/actions/download-artifact
# - https://github.com/actions/upload-artifact
# - https://github.com/pypa/build
# - https://github.com/pypa/gh-action-pypi-publish
# - https://test.pypi.org/help/#apitoken
name: ci-wheels
on:
pull_request:
push:
tags:
- "v*"
branches-ignore:
- "auto-update-lockfiles"
- "pre-commit-ci-update-config"
- "dependabot/*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: "build sdist & wheel"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "building"
shell: bash
run: |
pipx run build
- uses: actions/upload-artifact@v4
with:
name: pypi-artifacts
path: ${{ github.workspace }}/dist/*
test-wheel:
needs: build
name: "test wheel (py${{ matrix.python-version }})"
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
session: ["wheel"]
env:
ENV_NAME: "ci-wheels"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: pypi-artifacts
path: ${{ github.workspace }}/dist
- name: "environment configure"
env:
# Maximum cache period (in weeks) before forcing a cache refresh.
CACHE_WEEKS: 2
run: |
echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV}
echo "LOCK_FILE=requirements/locks/py$(echo ${{ matrix.python-version }} | tr -d '.')-linux-64.lock" >> ${GITHUB_ENV}
- name: "conda package cache"
uses: ./.github/workflows/composite/conda-pkg-cache
with:
cache_build: 0
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}
- name: "conda install"
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
channels: conda-forge,defaults
activate-environment: ${{ env.ENV_NAME }}
auto-update-conda: false
use-only-tar-bz2: true
- name: "conda environment cache"
uses: ./.github/workflows/composite/conda-env-cache
with:
cache_build: 0
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}
install_packages: "nox pip"
- name: "nox cache"
uses: ./.github/workflows/composite/nox-cache
with:
cache_build: 1
env_name: ${{ env.ENV_NAME }}
lock_file: ${{ env.LOCK_FILE }}
- name: "nox install and test wheel"
env:
PY_VER: ${{ matrix.python-version }}
run: |
nox --session ${{ matrix.session }} -- --verbose
show-artifacts:
needs: build
name: "show artifacts"
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: pypi-artifacts
path: ${{ github.workspace }}/dist
- shell: bash
run: |
ls -l ${{ github.workspace }}/dist
publish-artifacts-test-pypi:
needs: test-wheel
name: "publish to test.pypi"
runs-on: ubuntu-latest
# upload to Test PyPI for every commit on main branch
# and check for the SciTools repo
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'SciTools'
steps:
- uses: actions/download-artifact@v4
with:
name: pypi-artifacts
path: ${{ github.workspace }}/dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
print_hash: true
publish-artifacts-pypi:
needs: test-wheel
name: "publish to pypi"
runs-on: ubuntu-latest
# upload to PyPI for every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && github.repository_owner == 'SciTools'
steps:
- uses: actions/download-artifact@v4
with:
name: pypi-artifacts
path: ${{ github.workspace }}/dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
print_hash: true