Skip to content

Commit

Permalink
ci: simplify ci setup
Browse files Browse the repository at this point in the history
  • Loading branch information
eginhard committed Oct 15, 2024
1 parent 2f13956 commit d4a0b5d
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 160 deletions.
25 changes: 4 additions & 21 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
pip install dist/*.tar.gz
- uses: actions/upload-artifact@v4
with:
name: sdist
name: build-sdist
path: dist/*.tar.gz
build-wheels:
runs-on: ubuntu-latest
Expand All @@ -50,7 +50,7 @@ jobs:
python -m pip install dist/*.whl
- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.python-version }}
name: build-wheel-${{ matrix.python-version }}
path: dist/*.whl
publish-artifacts:
runs-on: ubuntu-latest
Expand All @@ -61,28 +61,11 @@ jobs:
permissions:
id-token: write
steps:
- run: |
mkdir dist
- uses: actions/download-artifact@v4
with:
name: "sdist"
path: "dist/"
- uses: actions/download-artifact@v4
with:
name: "wheel-3.9"
path: "dist/"
- uses: actions/download-artifact@v4
with:
name: "wheel-3.10"
path: "dist/"
- uses: actions/download-artifact@v4
with:
name: "wheel-3.11"
path: "dist/"
- uses: actions/download-artifact@v4
with:
name: "wheel-3.12"
path: "dist/"
pattern: build-*
merge-multiple: true
- run: |
ls -lh dist/
- name: Publish package distributions to PyPI
Expand Down
24 changes: 8 additions & 16 deletions .github/workflows/style_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,13 @@ jobs:
python-version: [3.9]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
cache-dependency-path: 'requirements*'
- name: check OS
run: cat /etc/os-release
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y git make gcc
- name: Install/upgrade dev dependencies
run: python3 -m pip install -r requirements.dev.txt
version: "0.4.21"
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Lint check
run: |
make lint
run: make lint
42 changes: 16 additions & 26 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,18 @@ jobs:
uv-resolution: ["lowest-direct", "highest"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
cache-dependency-path: 'requirements*'
- name: check OS
run: cat /etc/os-release
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends git make gcc
- name: Install/upgrade Python setup deps
run: python3 -m pip install --upgrade pip setuptools uv
- name: Install Trainer
run: |
python3 -m uv pip install --resolution=${{ matrix.uv-resolution }} --system "coqui-tts-trainer[dev,test] @ ."
version: "0.4.21"
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Unit tests
run: make test_all
run: |
uv sync --resolution=${{ matrix.uv-resolution }} --all-extras
make test_all
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
Expand All @@ -49,18 +41,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: "3.12"
version: "0.4.21"
- uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true
- name: Combine coverage
run: |
python -Im pip install --upgrade coverage[toml]
python -Im coverage combine
python -Im coverage html --skip-covered --skip-empty
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
uvx coverage combine
uvx coverage html --skip-covered --skip-empty
uvx coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
11 changes: 2 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
repos:
- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.10
rev: v0.6.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: local
hooks:
- id: generate_requirements.py
name: generate_requirements.py
language: system
entry: python bin/generate_requirements.py
files: "pyproject.toml|requirements.*\\.txt|tools/generate_requirements.py"
43 changes: 27 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,36 @@ If you have a new feature or a bug to squash, go ahead and send a ✨**PR**✨.
Please use the following steps for a ✨**PR**✨.
Let us know if you encounter a problem along the way.

The following steps are tested on an Ubuntu system.
The following steps are tested on an Ubuntu system and require
[uv](https://docs.astral.sh/uv/) for virtual environment management. Choose your
preferred [installation
method](https://docs.astral.sh/uv/getting-started/installation/), e.g. the
standalone installer:

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

1. Fork 👟[https://github.com/idiap/coqui-ai-Trainer] by clicking the fork button at the top right corner of the project page.

2. Clone 👟 and add the main repo as a new remote named ```upsteam```.

```bash
$ git clone git@github.com:<your Github name>/coqui-ai-Trainer.git
$ cd coqui-ai-Trainer
$ git remote add upstream https://github.com/idiap/coqui-ai-Trainer.git
git clone git@github.com:<your Github name>/coqui-ai-Trainer.git
cd coqui-ai-Trainer
git remote add upstream https://github.com/idiap/coqui-ai-Trainer.git
```

3. Install 👟 for development.

```bash
$ make install
make install
```

4. Create a new branch with an informative name for your goal.

```bash
$ git checkout -b an_informative_name_for_my_branch
git checkout -b an_informative_name_for_my_branch
```

5. Implement your changes on your new branch.
Expand All @@ -62,42 +70,45 @@ The following steps are tested on an Ubuntu system.
8. Run the tests to see how your updates work with the rest of the project. You can repeat this step multiple times as you implement your changes to make sure you are on the right direction.

```bash
$ make test # stop at the first error
$ make test_all # run all the tests, report all the errors
make test # stop at the first error
make test_all # run all the tests, report all the errors
```

9. Format your code. We use ```ruff``` for code formatting.

```bash
$ make style
make style
```

10. Run the linter and correct the issues raised. We use ```ruff``` for linting. It helps to enforce a coding standard, offers simple refactoring suggestions.
10. Run the linter and correct the issues raised. We use ```ruff``` for linting.
It helps to enforce a coding standard, offers simple refactoring
suggestions. The formatter and linter are also run automatically via
pre-commit.

```bash
$ make lint
make lint
```

11. When things are good, add new files and commit your changes.

```bash
$ git add my_file1.py my_file2.py ...
$ git commit
git add my_file1.py my_file2.py ...
git commit
```

It's a good practice to regularly sync your local copy of the project with the upstream code to keep up with the recent updates.
```bash
$ git fetch upstream
$ git rebase upstream/main
git fetch upstream
git rebase upstream/main
```
12. Send a PR to ```main``` branch.
Push your branch to your fork.
```bash
$ git push -u origin an_informative_name_for_my_branch
git push -u origin an_informative_name_for_my_branch
```
Then go to your fork's Github page and click on 'Pull request' to send your ✨**PR**✨.
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include README.md
include LICENSE.txt
include requirements.dev.txt
recursive-include trainer *.json
recursive-include trainer *.html
recursive-include trainer *.png
Expand Down
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@ help:
target_dirs := bin examples tests trainer

test_all: ## run tests and don't stop on an error.
coverage run -m pytest trainer tests
uv run coverage run -m pytest trainer tests

test: ## run tests.
coverage run -m pytest -x trainer tests
uv run coverage run -m pytest -x trainer tests

test_failed: ## only run tests failed the last time.
coverage run -m pytest --ff trainer tests
uv run coverage run -m pytest --ff trainer tests

style: ## update code style.
ruff format ${target_dirs}
uv run --only-dev ruff format ${target_dirs}

lint: ## run linter.
ruff check ${target_dirs}

dev-deps: ## install development deps
pip install -r requirements.dev.txt
uv run --only-dev ruff check ${target_dirs}
uv run --only-dev ruff format --check ${target_dirs}

install: ## install 🐸 Trainer for development.
pip install -e .[dev,test]
pre-commit install
uv sync --all-extras
uv run pre-commit install
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ Fork of the [original, unmaintained repository](https://github.com/coqui-ai/Trai

## Installation

From Github:
From PyPI:

```console
git clone https://github.com/idiap/coqui-ai-Trainer
cd coqui-ai-Trainer
make install
pip install coqui-tts-trainer
```

From PyPI:
From Github:

```console
pip install coqui-tts-trainer
git clone https://github.com/idiap/coqui-ai-Trainer
cd coqui-ai-Trainer
pip install -e .
```

## Implementing a model
Expand Down
39 changes: 0 additions & 39 deletions bin/generate_requirements.py

This file was deleted.

Loading

0 comments on commit d4a0b5d

Please sign in to comment.