Skip to content

Commit

Permalink
Merge branch 'main' into fix-release
Browse files Browse the repository at this point in the history
  • Loading branch information
barneydobson authored Sep 25, 2024
2 parents db07bd8 + dca97fd commit 7aa847c
Show file tree
Hide file tree
Showing 30 changed files with 1,310 additions and 1,184 deletions.
31 changes: 6 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
name: Test

on: [push,pull_request,workflow_call]
on:
push:
branches:
- main
pull_request:

jobs:
qa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pre-commit/[email protected]

test:
needs: qa
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [ "3.10" ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -r dev-requirements.txt
- name: Run tests
run: pytest
uses: ./.github/workflows/ci_template.yml
38 changes: 38 additions & 0 deletions .github/workflows/ci_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test

on:
workflow_call:
inputs:
os:
description: 'Operating system'
default: '["ubuntu-latest", "windows-latest"]'
type: string
python-version:
description: 'Python version'
default: '["3.10"]'
type: string

jobs:
qa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pre-commit/[email protected]

test:
needs: qa
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{fromJson(inputs.os)}}
python-version: ${{fromJson(inputs.python-version)}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install .[dev]
- name: Run tests
run: pytest
91 changes: 67 additions & 24 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,73 @@
on: [release]

permissions:
contents: write
attestations: write
id-token: write

jobs:
test:
uses: ./.github/workflows/ci.yml
uses: ./.github/workflows/ci_template.yml
with:
os: '["ubuntu-latest", "windows-latest", "macos-latest"]'
python-version: '["3.10", "3.11", "3.12"]'

build-wheel:
needs: test
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v2
with:
attest-build-provenance-github: true

publish-TestPyPI:
needs: build-wheel
name: Publish SWMManywhere to TestPyPI
runs-on: ubuntu-latest

steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Generate artifact attestation for sdist and wheel
uses: actions/attest-build-provenance@v1
with:
subject-path: dist

- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true

publish-PyPI:
needs: publish-TestPyPI
name: Publish SWMManywhere to PyPI
runs-on: ubuntu-latest

steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Generate artifact attestation for sdist and wheel
uses: actions/attest-build-provenance@v1
with:
subject-path: dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1


publish-docs:
needs: publish-PyPI
Expand All @@ -16,29 +81,7 @@ jobs:
python-version: "3.11"

- name: Install dependencies
run: pip install -r doc-requirements.txt
run: pip install .[doc]

- name: Deploy Docs
run: mkdocs gh-deploy --force

# publish:
# runs-on: ubuntu-latest
# needs: test
# # The following steps to build a Docker image and publish to the GitHub container registry on release. Alternatively, can replace with other publishing steps (ie. publishing to PyPI, deploying documentation etc.)
# steps:
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Get image metadata
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ghcr.io/${{ github.repository }}
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# push: true
# tags: ${{ steps.meta.outputs.tags }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,8 @@ dmypy.json
cache/

# Documentation generated models
swmmanywhere_models/
swmmanywhere_models/
whiteboxtools_binaries.zip

# Hatch
_version.py
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ repos:
- id: refurb
name: Modernizing Python codebases using Refurb
additional_dependencies:
- numpy
- numpy
Loading

0 comments on commit 7aa847c

Please sign in to comment.