Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See e.g. https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Build and test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

defaults:
run:
shell: bash -l {0}
jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with pytest
run: |
pip install pytest pytest-cov
pytest tests
46 changes: 46 additions & 0 deletions .github/workflows/publish_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Adapted from https://coderefinery.github.io/documentation/gh_workflow/
name: documentation

on:
push:
tags:
- 'v*'
workflow_dispatch:

permissions:
contents: write
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
docs:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
pip install -e .
- name: Sphinx build
run: |
sphinx-build docs/source _build
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '_build'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
74 changes: 74 additions & 0 deletions .github/workflows/publish_github_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#
# Create a new GitHub release (do not run if one already exists!).
#
# Adapted from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish Python distribution to Github

on:
workflow_dispatch:

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

github-release:
name: >-
Sign the Python distribution with Sigstore
and upload them to GitHub Release
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
58 changes: 58 additions & 0 deletions .github/workflows/publish_pypi_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# Creates a new PyPI release when a tag is pushed from git
# - trigger only when a tag pushed, use the format 'v1.2.3'
# - uploads the new version on PyPI https://pypi.org/p/dyson-equalizer
# Adapted from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish Python distribution to PyPI

on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python distribution to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/dyson-equalizer
permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
5 changes: 5 additions & 0 deletions locat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Get the version from _version.py (added when building using scm)
try:
from .version import __version__ # noqa
except ModuleNotFoundError as e:
__version__ = '0.0.0-dev'
Loading
Loading