Skip to content

Commit

Permalink
chore(.github): update issue and PR templates and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan committed Oct 21, 2022
1 parent 6604625 commit aaec9a9
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Bug report
name: Bug Report
about: Create a report to help us improve
title: "[BUG]"
labels: ["bug"]
Expand Down Expand Up @@ -59,6 +59,6 @@ If you know or suspect the reason for this bug, paste the code lines and suggest

## Checklist

- [ ] I have checked that there is no similar issue in the repo (**required**)
- [ ] I have read the [documentation](https://torchopt.readthedocs.io/) (**required**)
- [ ] I have provided a minimal working example to reproduce the bug (**required**)
- [ ] I have checked that there is no similar issue in the repo. (**required**)
- [ ] I have read the [documentation](https://torchopt.readthedocs.io). (**required**)
- [ ] I have provided a minimal working example to reproduce the bug. (**required**)
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Feature request
name: Feature Request
about: Suggest an idea for this project
title: "[Feature Request]"
labels: ["enhancement"]
Expand All @@ -10,7 +10,7 @@ assignees: Benjamin-eecs
## Motivation

Please outline the motivation for the proposal.
Is your feature request related to a problem? e.g., "I'm always frustrated when [...]".
Is your feature request related to a problem? E.g., "I'm always frustrated when [...]".
If this is related to another issue, please link here too.

## Solution
Expand All @@ -27,4 +27,4 @@ Add any other context or screenshots about the feature request here.

## Checklist

- [ ] I have checked that there is no similar issue in the repo (**required**)
- [ ] I have checked that there is no similar issue in the repo. (**required**)
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/questions_help_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ assignees: Benjamin-eecs

## Checklist

- [ ] I have checked that there is no similar issue in the repo (**required**)
- [ ] I have read the [documentation](https://torchopt.readthedocs.io/) (**required**)
- [ ] I have checked that there is no similar issue in the repo. (**required**)
- [ ] I have read the [documentation](https://torchopt.readthedocs.io). (**required**)
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ What types of changes does your code introduce? Put an `x` in all the boxes that
Go over all the following points, and put an `x` in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

- [ ] I have read the [CONTRIBUTION](https://torchopt.readthedocs.io/en/latest/developer/contributing.html) guide (**required**)
- [ ] I have read the [CONTRIBUTION](https://torchopt.readthedocs.io/en/latest/developer/contributing.html) guide. (**required**)
- [ ] My change requires a change to the documentation.
- [ ] I have updated the tests accordingly (*required for a bug fix or a new feature*).
- [ ] I have updated the tests accordingly. (*required for a bug fix or a new feature*)
- [ ] I have updated the documentation accordingly.
- [ ] I have reformatted the code using `make format` (**required**)
- [ ] I have checked the code using `make lint` (**required**)
- [ ] I have reformatted the code using `make format`. (**required**)
- [ ] I have checked the code using `make lint`. (**required**)
- [ ] I have ensured `make test` pass. (**required**)
26 changes: 21 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ jobs:
update-environment: true

- name: Set __release__
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
if: |
startsWith(github.ref, 'refs/tags/') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.task == 'build-and-publish')
run: |
sed -i -E 's/^__release__\s*=.*$/__release__ = True/' torchopt/version.py
python .github/workflows/set_release.py
- name: Print version
run: python setup.py --version
Expand Down Expand Up @@ -99,15 +101,17 @@ jobs:
update-environment: true

- name: Set __release__
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
if: |
startsWith(github.ref, 'refs/tags/') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.task == 'build-and-publish')
run: |
sed -i -E 's/^__release__\s*=.*$/__release__ = True/' torchopt/version.py
python .github/workflows/set_release.py
- name: Print version
run: python setup.py --version

- name: Build wheels
uses: pypa/cibuildwheel@v2.10.2
uses: pypa/cibuildwheel@v2.11.1
with:
package-dir: .
output-dir: wheelhouse
Expand Down Expand Up @@ -141,6 +145,14 @@ jobs:
python-version: "3.7 - 3.10" # sync with requires-python in pyproject.toml
update-environment: true

- name: Set __release__
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
run: |
python .github/workflows/set_release.py
- name: Print version
run: python setup.py --version

- name: Check consistency between the package version and release tag
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand All @@ -167,6 +179,10 @@ jobs:
name: wheels
path: dist

- name: List distributions
run:
ls -lh dist/*

- name: Publish to TestPyPI
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
uses: pypa/gh-action-pypi-publish@v1.5.0
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/set_release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import pathlib
import re


ROOT = pathlib.Path(__file__).absolute().parent.parent.parent

VERSION_FILE = ROOT / 'torchopt' / 'version.py'

VERSION_CONTENT = VERSION_FILE.read_text()

VERSION_FILE.write_text(
data=re.sub(
r'__release__\s*=.*',
'__release__ = True',
string=VERSION_CONTENT,
),
encoding='UTF-8',
)
2 changes: 1 addition & 1 deletion conda-recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dependencies:
- flake8-bugbear
- doc8 < 1.0.0a0
- pydocstyle
- clang-format
- clang-format >= 14
- clang-tools # clang-tidy
- cpplint
- pre-commit

0 comments on commit aaec9a9

Please sign in to comment.