-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
4 changed files
with
158 additions
and
47 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,79 @@ | ||
# from https://cruft.github.io/cruft/#automating-updates-with-github-actions | ||
|
||
name: Update repository with Cruft | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 2 * * 1" # Every Monday at 2am | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
include: | ||
- add-paths: . | ||
body: Use this to merge the changes to this repository. | ||
branch: cruft/update | ||
commit-message: "chore: accept new Cruft update" | ||
title: New updates detected with Cruft | ||
- add-paths: .cruft.json | ||
body: Use this to reject the changes in this repository. | ||
branch: cruft/reject | ||
commit-message: "chore: reject new Cruft update" | ||
title: Reject new updates detected with Cruft | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install Cruft | ||
run: pip3 install cruft | ||
|
||
- name: Check if update is available | ||
continue-on-error: false | ||
id: check | ||
run: | | ||
CHANGES=0 | ||
if [ -f .cruft.json ]; then | ||
if ! cruft check; then | ||
CHANGES=1 | ||
fi | ||
else | ||
echo "No .cruft.json file" | ||
fi | ||
echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT" | ||
- name: Run update if available | ||
if: steps.check.outputs.has_changes == '1' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub" | ||
cruft update --skip-apply-ask --refresh-private-variables | ||
git restore --staged . | ||
- name: Create pull request | ||
if: steps.check.outputs.has_changes == '1' | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
add-paths: ${{ matrix.add-paths }} | ||
commit-message: ${{ matrix.commit-message }} | ||
branch: ${{ matrix.branch }} | ||
delete-branch: true | ||
branch-suffix: timestamp | ||
title: ${{ matrix.title }} | ||
body: | | ||
This is an autogenerated PR. ${{ matrix.body }} | ||
[Cruft](https://cruft.github.io/cruft/) has detected updates from the Cookiecutter repository. |
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,78 @@ | ||
# This file configures the continuous integration (CI) system on GitHub. | ||
# Introductory materials can be found here: https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions. | ||
# Documentation for editing this file can be found here: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | ||
|
||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
lint: | ||
name: Code Quality | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ "3.12", "3.9" ] | ||
tox-command: ["manifest", "lint", "pyroma", "mypy"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: "Install uv" | ||
uses: "astral-sh/setup-uv@v3" | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: "pyproject.toml" | ||
- name: "Run command" | ||
run: | | ||
uvx -p ${{ matrix.python-version }} --with tox-uv tox -e ${{ matrix.tox-command }} | ||
docs: | ||
name: Documentation | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# We only test documentation on the latest version | ||
# sphinx 8.0 / sphinx-rtd-theme 3.0 discontinued Python 3.9 support | ||
# a year early, which prompted re-thinking about this. | ||
python-version: [ "3.12" ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: "Install uv" | ||
uses: "astral-sh/setup-uv@v3" | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: "pyproject.toml" | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get install graphviz | ||
- name: Check RST conformity with doc8 | ||
run: uvx -p ${{ matrix.python-version }} --with tox-uv tox -e doc8 | ||
- name: Check docstring coverage | ||
run: uvx -p ${{ matrix.python-version }} --with tox-uv tox -e docstr-coverage | ||
- name: Check documentation build with Sphinx | ||
run: uvx -p ${{ matrix.python-version }} --with tox-uv tox -e docs-test | ||
tests: | ||
name: Tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
python-version: [ "3.12", "3.9" ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: "Install uv" | ||
uses: "astral-sh/setup-uv@v3" | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: "pyproject.toml" | ||
- name: Test with pytest and generate coverage file | ||
run: | ||
uvx -p ${{ matrix.python-version }} --with tox-uv tox -e py | ||
- name: Upload coverage report to codecov | ||
uses: codecov/codecov-action@v4 | ||
if: success() | ||
with: | ||
file: coverage.xml |