mirror of
https://github.com/YuzuZensai/spleeter.git
synced 2026-01-06 04:32:43 +00:00
refactor: Makefile
test: improve separator test test: start pypi dist test
This commit is contained in:
@@ -18,8 +18,8 @@ jobs:
|
|||||||
name: install python dependencies
|
name: install python dependencies
|
||||||
command: pip install -r requirements.txt && pip install pytest pytest-xdist
|
command: pip install -r requirements.txt && pip install pytest pytest-xdist
|
||||||
- run:
|
- run:
|
||||||
name: pytest
|
name: run tests
|
||||||
command: pytest -W ignore::FutureWarning -W ignore::DeprecationWarning -vv --forked
|
command: make test
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: models-{{ checksum "spleeter/model/__init__.py" }}
|
key: models-{{ checksum "spleeter/model/__init__.py" }}
|
||||||
paths:
|
paths:
|
||||||
@@ -42,8 +42,8 @@ jobs:
|
|||||||
name: install python dependencies
|
name: install python dependencies
|
||||||
command: pip install -r requirements.txt && pip install pytest pytest-xdist
|
command: pip install -r requirements.txt && pip install pytest pytest-xdist
|
||||||
- run:
|
- run:
|
||||||
name: pytest
|
name: run tests
|
||||||
command: pytest -W ignore::FutureWarning -W ignore::DeprecationWarning -vv --forked
|
command: make test
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: models-{{ checksum "spleeter/model/__init__.py" }}
|
key: models-{{ checksum "spleeter/model/__init__.py" }}
|
||||||
paths:
|
paths:
|
||||||
@@ -57,8 +57,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
name: package
|
name: package source distribution
|
||||||
command: python setup.py sdist
|
command: make build
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: sdist-{{ .Branch }}-{{ checksum "setup.py" }}
|
key: sdist-{{ .Branch }}-{{ checksum "setup.py" }}
|
||||||
paths:
|
paths:
|
||||||
@@ -78,7 +78,7 @@ jobs:
|
|||||||
# TODO: Infer destination regarding of branch.
|
# TODO: Infer destination regarding of branch.
|
||||||
# - master => production PyPi
|
# - master => production PyPi
|
||||||
# - development => testing PyPi
|
# - development => testing PyPi
|
||||||
command: pip install twine && twine upload dist/*
|
command: make deploy
|
||||||
|
|
||||||
# =======================================================================================
|
# =======================================================================================
|
||||||
# Conda distribution.
|
# Conda distribution.
|
||||||
|
|||||||
23
Makefile
23
Makefile
@@ -1,5 +1,5 @@
|
|||||||
# =======================================================
|
# =======================================================
|
||||||
# Build script for distribution packaging.
|
# Library lifecycle management.
|
||||||
#
|
#
|
||||||
# @author Deezer Research <research@deezer.com>
|
# @author Deezer Research <research@deezer.com>
|
||||||
# @licence MIT Licence
|
# @licence MIT Licence
|
||||||
@@ -9,22 +9,29 @@ clean:
|
|||||||
rm -Rf *.egg-info
|
rm -Rf *.egg-info
|
||||||
rm -Rf dist
|
rm -Rf dist
|
||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@echo "=== Build CPU bdist package"
|
@echo "=== Build CPU bdist package"
|
||||||
@python3 setup.py sdist
|
python3 setup.py sdist
|
||||||
@echo "=== CPU version checksum"
|
@echo "=== CPU version checksum"
|
||||||
@openssl sha256 dist/*.tar.gz
|
@openssl sha256 dist/*.tar.gz
|
||||||
|
|
||||||
build-gpu:
|
build-gpu:
|
||||||
@echo "=== Build GPU bdist package"
|
@echo "=== Build GPU bdist package"
|
||||||
@python3 setup.py sdist --target gpu
|
python3 setup.py sdist --target gpu
|
||||||
@echo "=== GPU version checksum"
|
@echo "=== GPU version checksum"
|
||||||
@openssl sha256 dist/*.tar.gz
|
@openssl sha256 dist/*.tar.gz
|
||||||
|
|
||||||
upload:
|
pip-dependencies:
|
||||||
|
pip install twine
|
||||||
|
|
||||||
|
test: pip-dependencies
|
||||||
|
pytest -W ignore::FutureWarning -W ignore::DeprecationWarning -vv --forked
|
||||||
|
|
||||||
|
test-distribution: pip-dependencies
|
||||||
|
bash tests/test_pypi_sdist.sh
|
||||||
|
|
||||||
|
deploy: pip-dependencies
|
||||||
twine upload dist/*
|
twine upload dist/*
|
||||||
|
|
||||||
test-upload:
|
all: clean test build build-gpu upload
|
||||||
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
|
|
||||||
|
|
||||||
all: clean build build-gpu upload
|
|
||||||
|
|||||||
10
tests/test_pypi_sdist.sh
Normal file
10
tests/test_pypi_sdist.sh
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Script that performs PyPi packaging test.
|
||||||
|
#
|
||||||
|
# @author Deezer Research <research@deezer.com>
|
||||||
|
# @version 1.0.0
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
|
||||||
@@ -7,6 +7,8 @@ __email__ = 'research@deezer.com'
|
|||||||
__author__ = 'Deezer Research'
|
__author__ = 'Deezer Research'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
|
||||||
|
import filecmp
|
||||||
|
|
||||||
from os.path import exists, join
|
from os.path import exists, join
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
@@ -33,6 +35,12 @@ def test_separate(configuration, instruments):
|
|||||||
assert len(prediction) == len(instruments)
|
assert len(prediction) == len(instruments)
|
||||||
for instrument in instruments:
|
for instrument in instruments:
|
||||||
assert instrument in prediction
|
assert instrument in prediction
|
||||||
|
for instrument in instruments:
|
||||||
|
track = prediction[instrument]
|
||||||
|
assert not (waveform == track).all()
|
||||||
|
for compared in instruments:
|
||||||
|
if instrument != compared:
|
||||||
|
assert not (track == prediction[compared]).all()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('configuration, instruments', TEST_CONFIGURATIONS)
|
@pytest.mark.parametrize('configuration, instruments', TEST_CONFIGURATIONS)
|
||||||
@@ -45,4 +53,9 @@ def test_separate_to_file(configuration, instruments):
|
|||||||
directory)
|
directory)
|
||||||
for instrument in instruments:
|
for instrument in instruments:
|
||||||
assert exists(join(directory, '{}.wav'.format(instrument)))
|
assert exists(join(directory, '{}.wav'.format(instrument)))
|
||||||
# TODO: Consider testing generated file as well.
|
for instrument in instruments:
|
||||||
|
for compared in instrument:
|
||||||
|
if instrument != compared:
|
||||||
|
assert not filecmp.cmp(
|
||||||
|
join(directory, '{}.wav'.format(instrument)),
|
||||||
|
join(directory, '{}.wav'.format(compared)))
|
||||||
|
|||||||
Reference in New Issue
Block a user