Skip to content

Commit 0b4a686

Browse files
authored
feat(workflow): add useful actions (#442)
1 parent 8620dfb commit 0b4a686

File tree

5 files changed

+170
-19
lines changed

5 files changed

+170
-19
lines changed

.github/workflows/close-issue.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Close Inactive Issues
2+
on:
3+
schedule:
4+
- cron: "0 4 * * *"
5+
6+
jobs:
7+
close-issues:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
steps:
13+
- uses: actions/stale@v5
14+
with:
15+
exempt-issue-labels: "help wanted,good first issue,documentation,following up,todo list"
16+
days-before-issue-stale: 30
17+
days-before-issue-close: 15
18+
stale-issue-label: "stale"
19+
close-issue-message: "This issue was closed because it has been inactive for 15 days since being marked as stale."
20+
days-before-pr-stale: -1
21+
days-before-pr-close: -1
22+
operations-per-run: 10000
23+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/push-format.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Standardize Code Format
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
9+
jobs:
10+
push_format:
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
ref: ${{github.ref_name}}
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
25+
- name: Install Black
26+
run: pip install "black[jupyter]"
27+
28+
- name: Run Black
29+
# run: black $(git ls-files '*.py')
30+
run: black .
31+
32+
- name: Commit Back
33+
continue-on-error: true
34+
id: commitback
35+
run: |
36+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
37+
git config --local user.name "github-actions[bot]"
38+
git add --all
39+
git commit -m "chore(format): run black on ${{github.ref_name}}"
40+
41+
- name: Create Pull Request
42+
if: steps.commitback.outcome == 'success'
43+
continue-on-error: true
44+
uses: peter-evans/create-pull-request@v5
45+
with:
46+
delete-branch: true
47+
body: "Automatically apply code formatter change"
48+
title: "chore(format): run black on ${{github.ref_name}}"
49+
commit-message: "chore(format): run black on ${{github.ref_name}}"
50+
branch: formatter-${{github.ref_name}}

.github/workflows/unitest.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Unit Test
2+
on: [ push, pull_request ]
3+
jobs:
4+
build:
5+
runs-on: ${{ matrix.os }}
6+
strategy:
7+
matrix:
8+
python-version: ["3.8", "3.9", "3.10"]
9+
os: [ubuntu-latest]
10+
fail-fast: true
11+
12+
steps:
13+
14+
- uses: actions/checkout@master
15+
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: Install dependencies
22+
run: |
23+
pip install -r requirements.txt
24+
25+
- name: Run Test
26+
run: |
27+
echo "TODO"

.github/workflows/upload-pypi.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Upload to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-22.04
11+
12+
steps:
13+
14+
- uses: actions/checkout@v4
15+
with:
16+
ref: ${{github.ref_name}}
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
21+
- name: Install Dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
python -m pip install --upgrade setuptools
25+
python -m pip install --upgrade wheel
26+
pip install twine
27+
28+
- name: Build Package
29+
run: |
30+
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
31+
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
32+
python setup.py build_py
33+
34+
- name: Upload Package
35+
run: |
36+
twine upload dist/* -u "__token__" -p ${{ secrets.PYPI_TOKEN }}

setup.py

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
1+
import os
12
from setuptools import setup, find_packages
2-
setup(name='chattts',
3-
version='0.1.0',
4-
author='2noise',
5-
url='https://github.com/2noise/ChatTTS',
6-
package_data={
7-
'ChatTTS.res': ['homophones_map.json'], # 指定路径和文件
8-
},
9-
install_requires=['omegaconf>=2.3.0',
10-
'numpy<2.0.0',
11-
'numba',
12-
'pybase16384',
13-
'torch>=2.1.0',
14-
'tqdm',
15-
'vector_quantize_pytorch',
16-
'transformers>=4.41.1',
17-
'vocos',
18-
], # 定义依赖哪些模块
19-
packages=find_packages(), # 系统自动从当前目录开始找包
20-
)
3+
4+
setup(
5+
name='chattts',
6+
version=os.environ.get("CHTTS_VER", "develop"),
7+
description='A generative speech model for daily dialogue',
8+
long_description=open('README.md').read(),
9+
long_description_content_type='text/markdown',
10+
author='2noise',
11+
author_email='[email protected]',
12+
maintainer='fumiama',
13+
url='https://github.com/2noise/ChatTTS',
14+
packages=find_packages(include=["ChatTTS", "ChatTTS.*"]),
15+
package_data={
16+
'ChatTTS.res': ['homophones_map.json', 'sha256_map.json'],
17+
},
18+
license="CC BY-NC 4.0",
19+
install_requires=[
20+
'numba',
21+
'numpy<2.0.0',
22+
'omegaconf>=2.3.0',
23+
'pybase16384',
24+
'torch>=2.1.0',
25+
'tqdm',
26+
'transformers>=4.41.1',
27+
'vector_quantize_pytorch',
28+
'vocos',
29+
],
30+
platforms='any',
31+
classifiers=[
32+
"Programming Language :: Python :: 3",
33+
"Operating System :: OS Independent",
34+
],
35+
)

0 commit comments

Comments
 (0)