Skip to content

Commit

Permalink
Add GitHub workflow (#2)
Browse files Browse the repository at this point in the history
* Add github issue template

* Add github pr template

* Add CODEOWNERS

* Add release drafter

* Add code format linting

* Add pypi distribution workflow

* Change branch name develop -> dev

* Add pyproject.toml for ruff
  • Loading branch information
Only-bottle authored Sep 10, 2024
1 parent d81020d commit ec2de83
Show file tree
Hide file tree
Showing 12 changed files with 264 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @cbpark-nota
* @Only-bottle
66 changes: 66 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This issue template is modified from https://github.com/gradio-app/gradio/blob/main/.github/ISSUE_TEMPLATE/bug_report_template.yml
name: "\U0001F41E Bug report"
description: Create a report to help us improve
title: "[BUG] Please write your own title"
labels: ["bug"]
assignees:
- Only-bottle

body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! Before you get started, please search if an issue already exists for the bug you encountered
- type: textarea
id: bug-description
attributes:
label: Describe the bug
description: Please provide a concise description.
placeholder: A clear and concise description of what the bug is.
validations:
required: true

- type: checkboxes
attributes:
label: Have you searched existing issues? 🔎
description: Please search to see if an issue already exists for the issue you encountered.
options:
- label: I have searched and found no existing issues
required: true

- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Please provide a minimal example, with code, that can be run to reproduce the issue. Do NOT provide screenshots of code, or link to external repos or applications. Use ``` to format code blocks.
placeholder: Reproduction
validations:
required: true

- type: textarea
id: screenshot
attributes:
label: Screenshot
description: If relevant, please include screenshot(s) so that we can understand what the issue is.

- type: textarea
id: logs
attributes:
label: Logs
description: Please include the full stacktrace of the errors you get from the code.
render: shell

- type: textarea
id: system-info
attributes:
label: System Info
description: Please ensure that you use the latest version of this package. If you use the customized version of this package, you may fill out the system information in more details.
render: shell
validations:
required: true

- type: markdown
attributes:
value: |
📌 Please ensure that you have filled all of the required sections above, and that the reproduction you have provided is [minimal, complete, and reproducible](https://stackoverflow.com/help/minimal-reproducible-example). Incomplete issues will be closed.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: "\U0001F3A8 Feature request"
about: Suggest an improvement or new feature for this repository
title: "[Feature Request] Please write your own title"
labels: help wanted
assignees: Only-bottle

---

- [ ] I have searched to see if a similar issue already exists.

**Is there any feature that you would like to add?**
Please write a clear and concise description.

**Is there any suggestion (or solution) to solve this issue?**
Please write a clear and concise description.

**Additional context**
All other contexts or screenshots are welcome.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/project-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: "\U0001F4AA Project issue (ticket)"
about: Create a ticket to attain the goal in this project
title: "[Sprint] Please write your own title"
labels: enhancement
assignees: ''

---

## Description

- Write a description for this ticket.

## Checklists

- [ ] I would create a corresponding branch for this issue from the designated (mostly `dev`) branch.
- [ ] This issue only contains a preceding agreement between project owners.
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Description

Please include a summary in English, of the changes in this pull request. If it closes an issue, please mention it here.

Closes: #(issue)

You should link at least one existing issue for PR. Before your create a PR, please check to see if there is an issue for this change.
PRs from forked repository not accepted.

## Change(s)

- (Please write a description for this change.)
35 changes: 35 additions & 0 deletions .github/release-drafter-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '✨ Features'
labels:
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'bug'
- title: '📘 Documents'
labels:
- 'documentation'
- title: '🙈 Other changes'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: minor

exclude-labels:
- 'skip-changelog'

template: |
# What's Changed 🚀
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
24 changes: 24 additions & 0 deletions .github/workflows/check-code-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Code format check with Ruff

on:
pull_request:
branches:
- dev
types: [opened, synchronize, labeled, unlabeled]
push:
branches:
- dev

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: chartboost/ruff-action@v1
with:
src: "./netspresso_inference_package"
version: 0.0.259
41 changes: 41 additions & 0 deletions .github/workflows/pypi-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Python distributions 📦 to PyPI

on:
push:
tags:
- 'v*.*.*'

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: '3.8'

- name: Install pypa/setuptools
run: |
python -m pip install wheel twine
- name: Extract tag name
run: |
VERSION_TAG=${GITHUB_REF_NAME#v}
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV
- name: Extract version in package
run: |
VERSION_PKG=$(cat netspresso_inference_package/VERSION)
echo "VERSION_PKG=$VERSION_PKG" >> $GITHUB_ENV
- name: Build a binary wheel if tag is valid
if: ${{ env.VERSION_TAG == env.VERSION_PKG }}
run: |
python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter
on:
push:
branches:
- dev

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- name: Release Drafter
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter-config.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions netspresso_inference_package/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.5
26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[tool.ruff]
target-version = "py38"
line-length = 120

extend-select = [
"B",
"C",
"I",
"SIM",
"INP001",
"W"
]

ignore = [
"E501",
"F401",
"C901",
"B008",
"SIM115",
]

[tool.ruff.per-file-ignores]

"netspresso_inference_package/__init__.py" = [
"F401", # "Imported but unused"
]
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
from pathlib import Path
from setuptools import setup, find_packages

version = (Path("netspresso_inference_package") / "VERSION").read_text().strip()

install_requires = Path("requirements.txt").read_text().split('\n')

setup(
name="netspresso_inference_package",
version="0.1.5",
version=version,
author="NetsPresso",
author_email="[email protected]",
description="Inference module.",
long_description=open('README.md').read(),
long_description_content_type="text/markdown",
url="https://github.com/nota-github/netspresso_inference_package",
url="https://github.com/nota-github/netspresso-inference-package",
install_requires=install_requires,
packages=find_packages(),
package_data={"netspresso_inference_package": ["VERSION"]},
classifiers=[
"Programming Language :: Python :: 3.8",
"License :: OSI Approved :: MIT License",
Expand Down

0 comments on commit ec2de83

Please sign in to comment.