Skip to content

Commit e0bda5f

Browse files
CI: Add GitHub Actions workflows and issue templates (#22)
* CI: Add pytest-xdist to dev dependencies in pyproject.toml * CI: Add GitHub Actions workflow to run tests on push and PRs * CI: Add GitHub Actions workflow for pre-commit checks on PRs * MNT: Add issue template for bug reports * MNT: Add issue template for documentation improvements * MNT: Add issue template for feature requests * MNT: Add general issue template for uncategorized reports * MNT: Add template for pull request
1 parent 2767a67 commit e0bda5f

File tree

8 files changed

+273
-1
lines changed

8 files changed

+273
-1
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 🐛 Bug report
2+
description: Report a bug currently impacting orca_python.
3+
title: "BUG: "
4+
labels: ["bug"]
5+
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: >
10+
#### You can see if the bug has already been addressed by searching
11+
through the open and closed [issues](https://github.com/ayrna/orca_python/issues?q=is%3Aissue).
12+
- type: textarea
13+
attributes:
14+
label: Describe the bug
15+
description: >
16+
A clear and concise description of what the bug is.
17+
validations:
18+
required: true
19+
- type: textarea
20+
attributes:
21+
label: Steps/Code to reproduce the bug
22+
description: |
23+
Please include a [minimal reproducible example](https://stackoverflow.com/help/mcve) so users can reproduce the error when running it. Be as succinct as possible, and do not depend on external data files.
24+
25+
If the code is too long, feel free to put it in a public [gist](https://gist.github.com) and link it in the issue.
26+
placeholder: |
27+
```python
28+
Your code here. placing your code between three backticks will format it like the above example.
29+
```
30+
- type: textarea
31+
attributes:
32+
label: Expected results
33+
description: >
34+
Please provide a clear and concise description of the expected results or paste the correct output if available.
35+
placeholder: >
36+
For example: No error is thrown, or y_name1 == y_name2.
37+
validations:
38+
required: true
39+
- type: textarea
40+
attributes:
41+
label: Actual results
42+
description: |
43+
Please provide a clear and concise description of the actual seen results or paste the incorrect output if available.
44+
45+
If you observe an error, please paste the error message including the full traceback of the exception.
46+
placeholder: |
47+
```python-traceback
48+
Place traceback error here if applicable. If your issue has no traceback, please describe the observed output without formatting.
49+
```
50+
validations:
51+
required: true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: 📖 Documentation improvement
2+
description: Create a report to help us improve the orca_python documentation.
3+
title: "DOC: "
4+
labels: ["documentation"]
5+
6+
body:
7+
- type: textarea
8+
attributes:
9+
label: Describe the issue linked to the documentation
10+
description: >
11+
Tell us what part of the documentation you think needs improvement.
12+
validations:
13+
required: true
14+
- type: textarea
15+
attributes:
16+
label: Suggest a potential alternative/fix
17+
description: >
18+
Tell us how you think the documentation could be improved.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 🚀 Feature request
2+
description: Suggest a new feature or idea for orca_python.
3+
title: "ENH: "
4+
labels: ["enhancement"]
5+
6+
body:
7+
- type: textarea
8+
attributes:
9+
label: Describe the feature or idea you want to propose
10+
description: >
11+
Please provide a clear and concise description of the feature or idea you are proposing.
12+
validations:
13+
required: true
14+
- type: textarea
15+
attributes:
16+
label: Describe your proposed solution
17+
description: >
18+
Please provide a description of your desired outcome, ideally aligning with the existing toolbox design, classes, and methods.
19+
validations:
20+
required: true
21+
- type: textarea
22+
attributes:
23+
label: Describe alternatives you have considered, if relevant
24+
description: >
25+
Please provide any alternative solutions or features you have considered.
26+
- type: textarea
27+
attributes:
28+
label: Additional context
29+
description: >
30+
Add any other context about the problem here.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: ❗ Other issue
2+
description: Other issue not covered by the other templates.
3+
title: "MNT: "
4+
labels: ["maintenance"]
5+
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: >
10+
If the issue is maintenance related, please start the title with MNT: and add the maintenance tag, or use any other tag available in the repository.
11+
- type: textarea
12+
attributes:
13+
label: Describe the issue
14+
validations:
15+
required: true
16+
- type: textarea
17+
attributes:
18+
label: Suggest a potential alternative/fix
19+
- type: textarea
20+
attributes:
21+
label: Additional context

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!--
2+
Thanks for contributing with a pull request!
3+
Feel free to delete sections the template if they do not apply to the PR.
4+
-->
5+
6+
#### Reference Issues/PRs
7+
8+
<!--
9+
i.e. Fixes #1234 or See #3456.
10+
-->
11+
12+
#### What does this implement/fix? Explain your changes
13+
14+
<!--
15+
A clear and concise description of what you have implemented.
16+
-->
17+
18+
#### Any other comments?
19+
20+
<!--
21+
Please be aware that we are a team of volunteers so patience is necessary.
22+
-->

.github/workflows/pr_precommit.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: PR pre-commit
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request_target:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
13+
cancel-in-progress: true
14+
15+
16+
jobs:
17+
pre-commit:
18+
runs-on: ubuntu-24.04
19+
20+
steps:
21+
- uses: actions/create-github-app-token@v2
22+
id: app-token
23+
with:
24+
app-id: ${{ vars.APP_ID }}
25+
private-key: ${{ secrets.APP_KEY }}
26+
27+
- uses: actions/checkout@v4
28+
with:
29+
repository: ${{ github.event.pull_request.head.repo.full_name }}
30+
ref: ${{ github.head_ref }}
31+
token: ${{ steps.app-token.outputs.token }}
32+
33+
- uses: actions/setup-python@v5
34+
with:
35+
python-version: "3.11"
36+
37+
- uses: tj-actions/changed-files@v46.0.5
38+
id: changed-files
39+
40+
- name: List changed files
41+
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
42+
43+
# only check the full repository if PR and correctly labelled
44+
- if: ${{ github.event_name != 'pull_request_target' || contains(github.event.pull_request.labels.*.name, 'full pre-commit') }}
45+
name: Full pre-commit
46+
uses: pre-commit/action@v3.0.1
47+
with:
48+
extra_args: --all-files
49+
- if: ${{ github.event_name == 'pull_request_target' && !contains(github.event.pull_request.labels.*.name, 'full pre-commit') }}
50+
name: Local pre-commit
51+
uses: pre-commit/action@v3.0.1
52+
with:
53+
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}
54+
55+
# push fixes if pre-commit fails and PR is eligible
56+
- if: ${{ failure() && github.event_name == 'pull_request_target' && !github.event.pull_request.draft && !contains(github.event.pull_request.labels.*.name, 'stop pre-commit fixes') }}
57+
name: Push pre-commit fixes
58+
uses: stefanzweifel/git-auto-commit-action@v6
59+
with:
60+
commit_message: Automatic `pre-commit` fixes
61+
commit_user_name: ayrna-actions-bot[bot]
62+
create_branch: false

.github/workflows/pr_pytest.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "orca_python/**"
9+
- ".github/workflows/**"
10+
- "pyproject.toml"
11+
pull_request:
12+
branches:
13+
- main
14+
paths:
15+
- "orca_python/**"
16+
- ".github/workflows/**"
17+
- "pyproject.toml"
18+
19+
jobs:
20+
pytest:
21+
runs-on: ${{ matrix.os }}
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os: [ubuntu-24.04]
27+
python-version: ["3.8", "3.9", "3.10", "3.11"]
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
38+
- name: Install dependencies
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install -e ".[dev]"
42+
43+
- name: Run tests
44+
run: pytest -n auto
45+
46+
tests-dev-docs:
47+
runs-on: ubuntu-22.04
48+
strategy:
49+
matrix:
50+
python-version: ["3.8", "3.9", "3.10", "3.11"]
51+
52+
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v4
55+
56+
- name: Set up Python ${{ matrix.python-version }}
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
61+
- name: Install dependencies
62+
run: |
63+
python -m pip install --upgrade pip
64+
pip install -e ".[dev,docs]"
65+
66+
- name: Run tests
67+
run: pytest

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ dev = [
3737
"black",
3838
"pre-commit",
3939
"pytest",
40-
"pytest-cov"
40+
"pytest-cov",
41+
"pytest-xdist[psutil]"
4142
]
4243

4344
[project.urls]

0 commit comments

Comments
 (0)