Skip to content

Commit

Permalink
feat(workflow): add useful actions (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama authored Jun 25, 2024
1 parent 8620dfb commit 0b4a686
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 19 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/close-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Close Inactive Issues
on:
schedule:
- cron: "0 4 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
exempt-issue-labels: "help wanted,good first issue,documentation,following up,todo list"
days-before-issue-stale: 30
days-before-issue-close: 15
stale-issue-label: "stale"
close-issue-message: "This issue was closed because it has been inactive for 15 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
operations-per-run: 10000
repo-token: ${{ secrets.GITHUB_TOKEN }}
50 changes: 50 additions & 0 deletions .github/workflows/push-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Standardize Code Format

on:
push:
branches:
- main
- dev

jobs:
push_format:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
ref: ${{github.ref_name}}

- name: Set up Python
uses: actions/setup-python@v5

- name: Install Black
run: pip install "black[jupyter]"

- name: Run Black
# run: black $(git ls-files '*.py')
run: black .

- name: Commit Back
continue-on-error: true
id: commitback
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add --all
git commit -m "chore(format): run black on ${{github.ref_name}}"
- name: Create Pull Request
if: steps.commitback.outcome == 'success'
continue-on-error: true
uses: peter-evans/create-pull-request@v5
with:
delete-branch: true
body: "Automatically apply code formatter change"
title: "chore(format): run black on ${{github.ref_name}}"
commit-message: "chore(format): run black on ${{github.ref_name}}"
branch: formatter-${{github.ref_name}}
27 changes: 27 additions & 0 deletions .github/workflows/unitest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Unit Test
on: [ push, pull_request ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest]
fail-fast: true

steps:

- uses: actions/checkout@master

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run Test
run: |
echo "TODO"
36 changes: 36 additions & 0 deletions .github/workflows/upload-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Upload to PyPI

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-22.04

steps:

- uses: actions/checkout@v4
with:
ref: ${{github.ref_name}}

- name: Set up Python
uses: actions/setup-python@v5

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade wheel
pip install twine
- name: Build Package
run: |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
python setup.py build_py
- name: Upload Package
run: |
twine upload dist/* -u "__token__" -p ${{ secrets.PYPI_TOKEN }}
53 changes: 34 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
import os
from setuptools import setup, find_packages
setup(name='chattts',
version='0.1.0',
author='2noise',
url='https://github.com/2noise/ChatTTS',
package_data={
'ChatTTS.res': ['homophones_map.json'], # 指定路径和文件
},
install_requires=['omegaconf>=2.3.0',
'numpy<2.0.0',
'numba',
'pybase16384',
'torch>=2.1.0',
'tqdm',
'vector_quantize_pytorch',
'transformers>=4.41.1',
'vocos',
], # 定义依赖哪些模块
packages=find_packages(), # 系统自动从当前目录开始找包
)

setup(
name='chattts',
version=os.environ.get("CHTTS_VER", "develop"),
description='A generative speech model for daily dialogue',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
author='2noise',
author_email='[email protected]',
maintainer='fumiama',
url='https://github.com/2noise/ChatTTS',
packages=find_packages(include=["ChatTTS", "ChatTTS.*"]),
package_data={
'ChatTTS.res': ['homophones_map.json', 'sha256_map.json'],
},
license="CC BY-NC 4.0",
install_requires=[
'numba',
'numpy<2.0.0',
'omegaconf>=2.3.0',
'pybase16384',
'torch>=2.1.0',
'tqdm',
'transformers>=4.41.1',
'vector_quantize_pytorch',
'vocos',
],
platforms='any',
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
],
)

0 comments on commit 0b4a686

Please sign in to comment.