Skip to content

Latest commit

 

History

History
123 lines (87 loc) · 3.75 KB

File metadata and controls

123 lines (87 loc) · 3.75 KB

nshm-github-actions

A repo for NZSHM GitHub actions and reusable workflows.

Python Repos

Test workflow for Python repos. Runs poetry run tox and uploads coverage data to Codecove.

The repo needs to have the secret CODECOV_TOKEN available.

See the workflow file for available inputs.

Minimal setup:

jobs:
  call-test-workflow:
    uses: GNS-Science/nshm-github-actions/.github/workflows/python-run-tests.yml@feature/create-test-workflow
    with:
      operating-systems: "['ubuntu-latest', 'macos-latest', 'windows.latest']"
      python-versions: "['3.10', '3.11', '3.12']"
    secrets: inherit

Creates a GitHub release and publishes the package to PyPI. Would commonly be one of two jobs along with with Python Deploy Docs in a repo workflow triggered by e.g. tagging a version.

Requires the secret PYPI_API_TOKEN.

Example use:

jobs:
  release-and-distribute:
    uses:  GNS-Science/nshm-github-actions/.github/workflows/python-release.yml@main
    with:
      python-version:  '3.12'
    secrets: inherit

Publishes documentation for a python package to GitHub pages. Uses mkdocs for building documentation. Would commonly be one of two jobs along with with Python Release Workflow in a repo workflow triggered by e.g. tagging a version.

Requires that the branch or tag you want to use has permission to do so in the github-pages environment; see GitHub documentation.

Example use:

jobs:
  deploy-docs:
    uses:  GNS-Science/nshm-github-actions/.github/workflows/python-deploy-docs.yml@main
    with:
      python-version:  '3.12'
    secrets: inherit

uv Workflows

The workflows below are uv-based equivalents of the Poetry workflows above. Use them for projects that have migrated from Poetry to uv.

Equivalent of the Poetry tests workflow. Runs uv run tox and uploads coverage data to Codecov.

Minimal setup:

jobs:
  call-test-workflow:
    uses: GNS-Science/nshm-github-actions/.github/workflows/python-run-tests-uv.yml@main
    with:
      operating-systems: "['ubuntu-latest', 'macos-latest', 'windows-latest']"
      python-versions: "['3.10', '3.11', '3.12']"
    secrets: inherit

Creates a GitHub release and publishes the package to PyPI using uv build. Requires the secret PYPI_API_TOKEN.

jobs:
  release-and-distribute:
    uses: GNS-Science/nshm-github-actions/.github/workflows/python-release-uv.yml@main
    with:
      python-version: '3.12'
    secrets: inherit

Publishes mkdocs documentation to GitHub Pages using uv.

jobs:
  deploy-docs:
    uses: GNS-Science/nshm-github-actions/.github/workflows/python-deploy-docs-uv.yml@main
    with:
      python-version: '3.12'
    secrets: inherit

API Deployment

deploy-to-aws.yml deploys Python and JS APIs to AWS.

Example use:

  call-deploy-workflow:
    needs: call-test-workflow
    uses: GNS-Science/nshm-github-actions/.github/workflows/deploy-to-aws.yml@main
    with:
      python-version: '3.10'
    secrets: inherit

See deploy-to-aws.yml for a list of supported and required list of secrets and environment variables as well as workflow inputs.