-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## Related issues and pull requests | ||
|
||
- Closes #XXX (any issues closed by this pull request) | ||
- Related to #XXX (any issues or pull requests related to this pull request) | ||
|
||
## Description | ||
|
||
Short description of the pull request. | ||
|
||
## Checklist | ||
|
||
- [ ] Add tests | ||
- [ ] Add docs | ||
- [ ] Update CHANGELOG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Continuous Integration | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
cache: "pip" | ||
- name: Install with development dependencies | ||
run: pip install .[dev] | ||
- name: Check with pre-commit | ||
run: pre-commit run --all-files | ||
- name: Test | ||
run: pytest | ||
min-dependencies: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
cache: "pip" | ||
- name: Install with development dependencies | ||
run: pip install .[dev] | ||
- name: Install minimum versions of dependencies | ||
run: scripts/install-min-dependencies | ||
- name: Check with pre-commit | ||
run: pre-commit run --all-files | ||
- name: Test | ||
run: pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
workflow_dispatch: | ||
concurrency: | ||
group: "release" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Install build | ||
run: pip install build | ||
- name: Build | ||
run: python -m build | ||
- name: Publish to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository-url: https://test.pypi.org/legacy/ | ||
skip-existing: true | ||
- name: Publish to PyPI | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Installs the minimum version of all dependencies, with pip. | ||
Assumptions: | ||
- You've installed the development dependencies: `pip install '.[dev]'` | ||
- All of the dependencies in pyproject.toml are specified with `>=` | ||
""" | ||
|
||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
|
||
from packaging.requirements import Requirement | ||
|
||
assert sys.version_info[0] == 3 | ||
if sys.version_info[1] < 11: | ||
import tomli as toml | ||
else: | ||
import tomllib as toml | ||
|
||
|
||
root = Path(__file__).parents[1] | ||
with open(root / "pyproject.toml", "rb") as f: | ||
pyproject_toml = toml.load(f) | ||
requirements = [] | ||
for install_requires in filter( | ||
bool, | ||
(i.strip() for i in pyproject_toml["project"]["dependencies"]), | ||
): | ||
requirement = Requirement(install_requires) | ||
assert len(requirement.specifier) == 1 | ||
specifier = list(requirement.specifier)[0] | ||
assert specifier.operator == ">=" | ||
install_requires = install_requires.replace(">=", "==") | ||
requirements.append(install_requires) | ||
|
||
subprocess.run(["pip", "install", *requirements], check=True) |