Skip to content

Commit 1e34c4f

Browse files
committed
Add github files
1 parent 268e6cf commit 1e34c4f

10 files changed

Lines changed: 404 additions & 0 deletions

File tree

.github/ISSUE_TEMPLATE/bug.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Bug report
3+
about: Report a bug
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
## Describe the bug
11+
<!--- A clear and concise description of what the bug is. -->
12+
13+
## Failing Test
14+
<!---
15+
Please put the code (ideally in the form of a unit test) which fails below.
16+
17+
e.g.
18+
19+
```python
20+
def test_bug_12():
21+
# Python code here which fails because of the bug
22+
# This is best if other developers can simply copy and paste this test in
23+
# order to run it
24+
```
25+
-->
26+
27+
## Expected behavior
28+
<!--- A clear and concise description of what you expected to happen. -->
29+
30+
## Screenshots
31+
<!--- If applicable, add screenshots to help explain your problem. -->
32+
33+
## System
34+
<!--- Please complete the following information. -->
35+
36+
- OS: [e.g. Windows, Linux, macOS]
37+
- Python version [e.g. Python 3.11]
38+
39+
## Additional context
40+
<!--- Add any other context about the problem here. -->

.github/ISSUE_TEMPLATE/default.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Default
3+
about: Report an issue or problem
4+
title: ''
5+
labels: triage
6+
assignees: ''
7+
8+
---
9+
10+
## The problem
11+
<!--- Useful to breakdown to "As a [persona], I [want to do], so that [reason] -->
12+
13+
## Definition of "done"
14+
<!---
15+
What are the things that must be true in order to close this issue
16+
17+
We find that describing these as dot points works well.
18+
-->
19+
20+
## Additional context
21+
<!--- Add any additional context can go here -->
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Feature Request
3+
about: Request a feature or suggest an idea for this project
4+
title: ''
5+
labels: feature
6+
assignees: ''
7+
8+
---
9+
10+
## The motivation
11+
12+
<!--- Useful to breakdown to "As a [persona], I [want to do], so that [reason] -->
13+
14+
## The proposed solution
15+
16+
<!---
17+
If you'd like, please provide a description of the solution you would like to see
18+
19+
If you don't have any ideas for the solution, simply leave this blank
20+
-->
21+
22+
## Alternatives
23+
24+
<!---
25+
If you've considered any alternatives, please describe them here
26+
27+
If you don't have any alternatives, simply leave this blank
28+
-->
29+
30+
## Additional context
31+
32+
<!--- Add any additional context can go here -->

.github/actions/setup/action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Setup Python and uv"
2+
description: "setup Python and uv"
3+
4+
inputs:
5+
python-version:
6+
description: "Python version to use"
7+
required: true
8+
uv-dependency-install-flags:
9+
description: "Flags to pass to uv when running `uv install`"
10+
required: true
11+
run-uv-install:
12+
description: "Should we run the uv install steps"
13+
required: false
14+
default: true
15+
16+
runs:
17+
using: "composite"
18+
steps:
19+
- name: Setup uv
20+
id: setup-uv
21+
uses: astral-sh/setup-uv@v4
22+
with:
23+
version: "0.5.11"
24+
python-version: ${{ inputs.python-version }}
25+
- name: Install dependencies
26+
shell: bash
27+
if: ${{ (inputs.run-uv-install == 'true') }}
28+
run: |
29+
uv sync ${{ inputs.uv-dependency-install-flags }}

.github/pull_request_template.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Description
2+
3+
## Checklist
4+
5+
Please confirm that this pull request has done the following:
6+
7+
- [ ] Tests added
8+
- [ ] Documentation added (where applicable)
9+
- [ ] Changelog item added to `changelog/`

.github/release_template.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Announcements
2+
3+
* Announcement 1

.github/workflows/bump.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Bump version
2+
# For the time being, we still do this with pdm.
3+
# Honestly, it doesn't really matter,
4+
# but one day uv will have a bump command too and we can switch to that.
5+
# Relevant issue in uv: https://github.com/astral-sh/uv/issues/6298
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
bump_rule:
11+
type: choice
12+
description: How to bump the project's version (see https://github.com/carstencodes/pdm-bump#usage)
13+
options:
14+
- no-pre-release
15+
# no micro because we always sit on a pre-release in main,
16+
# so we would always use no-pre-release instead of micro
17+
# - micro
18+
- minor
19+
- major
20+
- "pre-release --pre alpha"
21+
- "pre-release --pre beta"
22+
- "pre-release --pre release-candidate"
23+
required: true
24+
25+
jobs:
26+
bump_version:
27+
name: "Bump version and create changelog"
28+
if: "!startsWith(github.event.head_commit.message, 'bump:')"
29+
strategy:
30+
matrix:
31+
os: [ "ubuntu-latest" ]
32+
python-version: [ "3.9" ]
33+
runs-on: "${{ matrix.os }}"
34+
env:
35+
CI_COMMIT_EMAIL: "ci-runner@mkdocstrings-python-accessors.invalid"
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
41+
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
42+
43+
- name: Setup PDM
44+
uses: pdm-project/setup-pdm@v4.1
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
48+
- name: Install pdm-bump
49+
run: |
50+
pdm self add pdm-bump
51+
52+
- uses: ./.github/actions/setup
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
uv-dependency-install-flags: "--all-extras --group dev"
56+
57+
- name: Create bump and changelog
58+
run: |
59+
git config --global user.name "$GITHUB_ACTOR"
60+
git config --global user.email "$CI_COMMIT_EMAIL"
61+
62+
BASE_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
63+
echo "Bumping from version $BASE_VERSION"
64+
65+
# Bump
66+
pdm bump ${{ github.event.inputs.bump_rule }}
67+
68+
NEW_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
69+
echo "Bumping to version $NEW_VERSION"
70+
71+
# Build CHANGELOG
72+
uv run towncrier build --yes --version v$NEW_VERSION
73+
74+
# Commit, tag and push
75+
git commit -a -m "bump: version $BASE_VERSION -> $NEW_VERSION"
76+
git tag v$NEW_VERSION
77+
git push && git push --tags
78+
79+
# Bump to alpha (so that future commits do not have the same
80+
# version as the tagged commit)
81+
BASE_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
82+
83+
# Bump to pre-release of next version
84+
pdm bump pre-release --pre alpha
85+
86+
NEW_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
87+
echo "Bumping version $BASE_VERSION > $NEW_VERSION"
88+
89+
# Commit and push
90+
git commit -a -m "bump(pre-release): version $BASE_VERSION > $NEW_VERSION"
91+
git push

.github/workflows/ci.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
tags: ['v*']
8+
9+
jobs:
10+
mypy:
11+
if: ${{ !github.event.pull_request.draft }}
12+
strategy:
13+
matrix:
14+
os: [ "ubuntu-latest" ]
15+
python-version: [ "3.9" ]
16+
runs-on: "${{ matrix.os }}"
17+
steps:
18+
- name: Check out repository
19+
uses: actions/checkout@v4
20+
- uses: ./.github/actions/setup
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
uv-dependency-install-flags: "--all-extras --group dev"
24+
- name: mypy
25+
run: |
26+
MYPYPATH=stubs uv run mypy src
27+
28+
urls:
29+
if: ${{ !github.event.pull_request.draft }}
30+
runs-on: "ubuntu-latest"
31+
steps:
32+
- name: Check out repository
33+
uses: actions/checkout@v4
34+
- name: check-urls-are-valid
35+
uses: lycheeverse/lychee-action@v2
36+
with:
37+
# Exclude local links
38+
# and the template link in pyproject.toml
39+
args: "--exclude 'file://' --exclude '^https://github\\.com/climate-resource/mkdocstrings-python-accessors/pull/\\{issue\\}$' ."
40+
41+
check-build:
42+
strategy:
43+
matrix:
44+
os: [ "ubuntu-latest" ]
45+
python-version: [ "3.11" ]
46+
runs-on: "${{ matrix.os }}"
47+
steps:
48+
- name: Check out repository
49+
uses: actions/checkout@v4
50+
- name: Setup uv
51+
id: setup-uv
52+
uses: astral-sh/setup-uv@v4
53+
with:
54+
version: "0.5.11"
55+
python-version: ${{ matrix.python-version }}
56+
- name: Build package
57+
run: |
58+
uv build
59+
- name: Check build
60+
run: |
61+
tar -tvf dist/mkdocstrings_python_accessors-*.tar.gz --wildcards '*mkdocstrings_python_accessors/py.typed'
62+
tar -tvf dist/mkdocstrings_python_accessors-*.tar.gz --wildcards 'mkdocstrings_python_accessors-*/LICENCE'
63+
64+
check-dependency-licences:
65+
strategy:
66+
matrix:
67+
os: [ "ubuntu-latest" ]
68+
python-version: [ "3.11" ]
69+
runs-on: "${{ matrix.os }}"
70+
steps:
71+
- name: Check out repository
72+
uses: actions/checkout@v4
73+
- uses: ./.github/actions/setup
74+
with:
75+
python-version: ${{ matrix.python-version }}
76+
uv-dependency-install-flags: "--group dev"
77+
- name: Check licences of dependencies
78+
shell: bash
79+
run: |
80+
TEMP_FILE=$(mktemp)
81+
uv export --no-dev > $TEMP_FILE
82+
uv run liccheck -r $TEMP_FILE -R licence-check.txt
83+
cat licence-check.txt

.github/workflows/deploy.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
defaults:
8+
run:
9+
shell: bash
10+
11+
jobs:
12+
deploy-pypi:
13+
name: Deploy to PyPI
14+
# Having an environment for deployment is strongly recommend by PyPI
15+
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/#github-actions
16+
# You can comment this line out if you don't want it.
17+
environment: deploy
18+
strategy:
19+
matrix:
20+
os: [ "ubuntu-latest" ]
21+
python-version: [ "3.11" ]
22+
runs-on: "${{ matrix.os }}"
23+
permissions:
24+
# this permission is mandatory for trusted publishing with PyPI
25+
id-token: write
26+
steps:
27+
- name: Check out repository
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
- name: Setup uv
32+
id: setup-uv
33+
uses: astral-sh/setup-uv@v4
34+
with:
35+
version: "0.5.11"
36+
python-version: ${{ matrix.python-version }}
37+
- name: Publish to PyPI
38+
run: |
39+
uv build
40+
uv publish

0 commit comments

Comments
 (0)