Skip to content

Commit

Permalink
Merge pull request #69 from sp-nitech/maintenance
Browse files Browse the repository at this point in the history
Update action
  • Loading branch information
takenori-y committed Mar 14, 2024
2 parents 57d03e8 + c03120b commit 7fda5bf
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 79 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master

pull_request:
branches:
- '**'
Expand Down Expand Up @@ -39,7 +40,7 @@ jobs:
sudo apt-get install -qq -y libsndfile1
- name: Install
run: make PYTHON_VERSION=${{ matrix.python }} TORCH_VERSION=${{ matrix.torch }} TORCHAUDIO_VERSION=${{ matrix.torchaudio }} PLATFORM=cpu dev tool
run: make PYTHON_VERSION=${{ matrix.python }} TORCH_VERSION=${{ matrix.torch }} TORCHAUDIO_VERSION=${{ matrix.torchaudio }} PLATFORM=cpu venv tool

- name: Check
run: make check
Expand All @@ -48,10 +49,11 @@ jobs:
run: make test

- name: Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./coverage.xml
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
23 changes: 0 additions & 23 deletions .github/workflows/stale.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ coverage.xml
_build/

# tools
tools/SPTK/
tools/taplo/
tools/**/

# misc
__pycache__/
Expand Down
57 changes: 12 additions & 45 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ TORCH_VERSION := 1.11.0
TORCHAUDIO_VERSION := 0.11.0
PLATFORM := cu113

init:
pip install -e .

dev:
venv:
test -d venv || python$(PYTHON_VERSION) -m venv venv; \
. ./venv/bin/activate; python -m pip install pip --upgrade
. ./venv/bin/activate; python -m pip install torch==$(TORCH_VERSION)+$(PLATFORM) torchaudio==$(TORCHAUDIO_VERSION)+$(PLATFORM) \
Expand All @@ -48,41 +45,19 @@ doc-clean:
. ./venv/bin/activate; cd docs; make clean; \
fi

check:
@if [ ! -x ./tools/taplo/taplo ]; then \
echo ""; \
echo "Error: please install taplo-cli"; \
echo ""; \
echo " make tool"; \
echo ""; \
exit 1; \
fi
check: tool
. ./venv/bin/activate; python -m ruff check $(PROJECT) tests
. ./venv/bin/activate; python -m isort --check $(PROJECT) tests
./tools/taplo/taplo format --check pyproject.toml

format:
@if [ ! -x ./tools/taplo/taplo ]; then \
echo ""; \
echo "Error: please install taplo-cli"; \
echo ""; \
echo " make tool"; \
echo ""; \
exit 1; \
fi
./tools/taplo/taplo fmt --check pyproject.toml
./tools/yamlfmt/yamlfmt --lint *.yml .github/workflows/*.yml

format: tool
. ./venv/bin/activate; python -m ruff format $(PROJECT) tests
. ./venv/bin/activate; python -m isort $(PROJECT) tests
./tools/taplo/taplo format pyproject.toml

test:
@if [ ! -d tools/SPTK/bin ]; then \
echo ""; \
echo "Error: please install C++ version of SPTK"; \
echo ""; \
echo " make tool"; \
echo ""; \
exit 1; \
fi
./tools/taplo/taplo fmt pyproject.toml
./tools/yamlfmt/yamlfmt *.yml .github/workflows/*.yml

test: tool
[ -n "$(MODULE)" ] && module=tests/test_$(MODULE).py || module=; \
. ./venv/bin/activate; export PATH=tools/SPTK/bin:$$PATH; \
python -m pytest -s --cov=./ --cov-report=xml $$module
Expand All @@ -97,15 +72,7 @@ tool:
tool-clean:
cd tools; make clean

update:
@if [ ! -x ./tools/taplo/taplo ]; then \
echo ""; \
echo "Error: please install taplo-cli"; \
echo ""; \
echo " make tool"; \
echo ""; \
exit 1; \
fi
update: tool
. ./venv/bin/activate; python -m pip install --upgrade pip
@for package in $$(./tools/taplo/taplo get -f pyproject.toml project.optional-dependencies.dev); do \
. ./venv/bin/activate; python -m pip install --upgrade $$package; \
Expand All @@ -115,4 +82,4 @@ clean: dist-clean doc-clean test-clean tool-clean
rm -rf venv
find . -name "__pycache__" -type d | xargs rm -rf

.PHONY: init dev dist dist-clean doc doc-clean check format test test-clean tool tool-clean update clean
.PHONY: venv dist dist-clean doc doc-clean check format test test-clean tool tool-clean update clean
15 changes: 9 additions & 6 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License. #
# ------------------------------------------------------------------------ #

all: SPTK taplo
all: SPTK taplo yamlfmt

SPTK:
git clone https://github.com/sp-nitech/SPTK.git
Expand All @@ -25,12 +25,15 @@ taplo:
wget https://github.com/tamasfe/taplo/releases/download/0.8.1/taplo-linux-x86_64.gz -O taplo.gz
gunzip -c taplo.gz > taplo/taplo
chmod +x taplo/taplo
rm -rf taplo.gz
rm -f taplo.gz

update:
cd SPTK; git pull; make
yamlfmt:
mkdir -p yamlfmt
wget https://github.com/google/yamlfmt/releases/download/v0.11.0/yamlfmt_0.11.0_Linux_x86_64.tar.gz -O yamlfmt.tar.gz
tar xzf yamlfmt.tar.gz -C yamlfmt
rm -f yamlfmt.tar.gz

clean:
rm -rf SPTK taplo
rm -rf SPTK taplo yamlfmt

.PHONY: all update clean
.PHONY: all clean
3 changes: 3 additions & 0 deletions yamlfmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
formatter:
type: basic
retain_line_breaks_single: true

0 comments on commit 7fda5bf

Please sign in to comment.