Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
a47dca4f
Unverified
Commit
a47dca4f
authored
Apr 24, 2020
by
moto
Committed by
GitHub
Apr 24, 2020
Browse files
Run unit test on CCI (#576)
* wip * Add test * add caching * fixup! add caching * fixup! fixup! add caching
parent
14cc5c05
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
177 additions
and
13 deletions
+177
-13
.circleci/config.yml
.circleci/config.yml
+41
-1
.circleci/config.yml.in
.circleci/config.yml.in
+35
-3
.circleci/regenerate.py
.circleci/regenerate.py
+24
-5
.circleci/unittest/environment.yml
.circleci/unittest/environment.yml
+12
-0
.circleci/unittest/install.sh
.circleci/unittest/install.sh
+15
-0
.circleci/unittest/run_test.sh
.circleci/unittest/run_test.sh
+9
-0
.circleci/unittest/setup_env.sh
.circleci/unittest/setup_env.sh
+39
-0
test/test_librosa_compatibility.py
test/test_librosa_compatibility.py
+2
-4
No files found.
.circleci/config.yml
View file @
a47dca4f
...
@@ -233,6 +233,36 @@ jobs:
...
@@ -233,6 +233,36 @@ jobs:
docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} 308535385114.dkr.ecr.us-east-1.amazonaws.com/${image_name}:${CIRCLE_WORKFLOW_ID}
docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} 308535385114.dkr.ecr.us-east-1.amazonaws.com/${image_name}:${CIRCLE_WORKFLOW_ID}
docker push 308535385114.dkr.ecr.us-east-1.amazonaws.com/${image_name}:${CIRCLE_WORKFLOW_ID}
docker push 308535385114.dkr.ecr.us-east-1.amazonaws.com/${image_name}:${CIRCLE_WORKFLOW_ID}
unittest_linux
:
<<
:
*binary_common
docker
:
-
image
:
"
pytorch/manylinux-cuda100"
resource_class
:
2xlarge+
steps
:
-
checkout
-
restore_cache
:
keys
:
-
env-v1-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum "./packaging/build_from_source.sh" }}-{{ checksum ".circleci/unittest/environment.yml" }}
-
run
:
name
:
Setup
command
:
.circleci/unittest/setup_env.sh
-
save_cache
:
key
:
env-v1-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum "./packaging/build_from_source.sh" }}-{{ checksum ".circleci/unittest/environment.yml" }}
paths
:
-
conda
-
env
-
third_party
-
run
:
name
:
Installation
command
:
.circleci/unittest/install.sh
-
run
:
name
:
Run test
command
:
.circleci/unittest/run_test.sh
workflows
:
workflows
:
build
:
build
:
jobs
:
jobs
:
...
@@ -276,7 +306,17 @@ workflows:
...
@@ -276,7 +306,17 @@ workflows:
-
binary_win_conda
:
-
binary_win_conda
:
name
:
torchaudio_win_py3.6
name
:
torchaudio_win_py3.6
python_version
:
"
3.6"
python_version
:
"
3.6"
unittest
:
jobs
:
-
unittest_linux
:
name
:
unittest_linux_py3.6
python_version
:
'
3.6'
-
unittest_linux
:
name
:
unittest_linux_py3.7
python_version
:
'
3.7'
-
unittest_linux
:
name
:
unittest_linux_py3.8
python_version
:
'
3.8'
nightly
:
nightly
:
jobs
:
jobs
:
-
circleci_consistency
-
circleci_consistency
...
...
.circleci/config.yml.in
View file @
a47dca4f
...
@@ -233,19 +233,51 @@ jobs:
...
@@ -233,19 +233,51 @@ jobs:
docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} 308535385114.dkr.ecr.us-east-1.amazonaws.com/${image_name}:${CIRCLE_WORKFLOW_ID}
docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} 308535385114.dkr.ecr.us-east-1.amazonaws.com/${image_name}:${CIRCLE_WORKFLOW_ID}
docker push 308535385114.dkr.ecr.us-east-1.amazonaws.com/${image_name}:${CIRCLE_WORKFLOW_ID}
docker push 308535385114.dkr.ecr.us-east-1.amazonaws.com/${image_name}:${CIRCLE_WORKFLOW_ID}
unittest_linux:
<<: *binary_common
docker:
- image: "pytorch/manylinux-cuda100"
resource_class: 2xlarge+
steps:
- checkout
- restore_cache:
{% raw %}
keys:
- env-v1-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum "./packaging/build_from_source.sh" }}-{{ checksum ".circleci/unittest/environment.yml" }}
{% endraw %}
- run:
name: Setup
command: .circleci/unittest/setup_env.sh
- save_cache:
{% raw %}
key: env-v1-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum "./packaging/build_from_source.sh" }}-{{ checksum ".circleci/unittest/environment.yml" }}
{% endraw %}
paths:
- conda
- env
- third_party
- run:
name: Installation
command: .circleci/unittest/install.sh
- run:
name: Run test
command: .circleci/unittest/run_test.sh
workflows:
workflows:
build:
build:
jobs:
jobs:
- circleci_consistency
- circleci_consistency
{{ workflows() }}
{{
build_
workflows() }}
- binary_win_conda:
- binary_win_conda:
name: torchaudio_win_py3.6
name: torchaudio_win_py3.6
python_version: "3.6"
python_version: "3.6"
unittest:
jobs:
{{ unittest_workflows() }}
nightly:
nightly:
jobs:
jobs:
- circleci_consistency
- circleci_consistency
{{ workflows(prefix="nightly_", filter_branch="nightly", upload=True) }}
{{
build_
workflows(prefix="nightly_", filter_branch="nightly", upload=True) }}
docker_build:
docker_build:
triggers:
triggers:
- schedule:
- schedule:
...
...
.circleci/regenerate.py
View file @
a47dca4f
...
@@ -19,17 +19,20 @@ import yaml
...
@@ -19,17 +19,20 @@ import yaml
import
os.path
import
os.path
def
workflows
(
prefix
=
''
,
upload
=
False
,
filter_branch
=
None
,
indentation
=
6
):
PYTHON_VERSIONS
=
[
"3.6"
,
"3.7"
,
"3.8"
]
def
build_workflows
(
prefix
=
''
,
upload
=
False
,
filter_branch
=
None
,
indentation
=
6
):
w
=
[]
w
=
[]
for
btype
in
[
"wheel"
,
"conda"
]:
for
btype
in
[
"wheel"
,
"conda"
]:
for
os_type
in
[
"linux"
,
"macos"
]:
for
os_type
in
[
"linux"
,
"macos"
]:
for
python_version
in
[
"3.6"
,
"3.7"
,
"3.8"
]
:
for
python_version
in
PYTHON_VERSIONS
:
w
+=
workflow_pair
(
btype
,
os_type
,
python_version
,
filter_branch
,
prefix
,
upload
)
w
+=
build_
workflow_pair
(
btype
,
os_type
,
python_version
,
filter_branch
,
prefix
,
upload
)
return
indent
(
indentation
,
w
)
return
indent
(
indentation
,
w
)
def
workflow_pair
(
btype
,
os_type
,
python_version
,
filter_branch
,
prefix
=
''
,
upload
=
False
):
def
build_
workflow_pair
(
btype
,
os_type
,
python_version
,
filter_branch
,
prefix
=
''
,
upload
=
False
):
w
=
[]
w
=
[]
base_workflow_name
=
"{prefix}binary_{os_type}_{btype}_py{python_version}"
.
format
(
base_workflow_name
=
"{prefix}binary_{os_type}_{btype}_py{python_version}"
.
format
(
...
@@ -107,6 +110,19 @@ def indent(indentation, data_list):
...
@@ -107,6 +110,19 @@ def indent(indentation, data_list):
return
(
"
\n
"
+
" "
*
indentation
).
join
(
yaml
.
dump
(
data_list
).
splitlines
())
return
(
"
\n
"
+
" "
*
indentation
).
join
(
yaml
.
dump
(
data_list
).
splitlines
())
def
unittest_workflows
(
indentation
=
6
):
w
=
[]
for
os_type
in
[
"linux"
]:
for
python_version
in
PYTHON_VERSIONS
:
w
.
append
({
f
"unittest_
{
os_type
}
"
:
{
"name"
:
f
"unittest_
{
os_type
}
_py
{
python_version
}
"
,
"python_version"
:
python_version
,
}
})
return
indent
(
indentation
,
w
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
d
=
os
.
path
.
dirname
(
__file__
)
d
=
os
.
path
.
dirname
(
__file__
)
env
=
jinja2
.
Environment
(
env
=
jinja2
.
Environment
(
...
@@ -116,4 +132,7 @@ if __name__ == "__main__":
...
@@ -116,4 +132,7 @@ if __name__ == "__main__":
)
)
with
open
(
os
.
path
.
join
(
d
,
'config.yml'
),
'w'
)
as
f
:
with
open
(
os
.
path
.
join
(
d
,
'config.yml'
),
'w'
)
as
f
:
f
.
write
(
env
.
get_template
(
'config.yml.in'
).
render
(
workflows
=
workflows
))
f
.
write
(
env
.
get_template
(
'config.yml.in'
).
render
(
build_workflows
=
build_workflows
,
unittest_workflows
=
unittest_workflows
,
))
.circleci/unittest/environment.yml
0 → 100644
View file @
a47dca4f
channels
:
-
conda-forge
-
defaults
dependencies
:
-
flake8
-
numpy
-
pytest
-
librosa
-
pip
-
pip
:
-
kaldi-io
-
scipy
.circleci/unittest/install.sh
0 → 100755
View file @
a47dca4f
#!/usr/bin/env bash
unset
PYTORCH_VERSION
# For unittest, nightly PyTorch is used, and we do not want to fixiate on the version
set
-e
eval
"
$(
./conda/bin/conda shell.bash hook
)
"
conda activate ./env
printf
"* Installing PyTorch nightly build"
conda
install
-c
pytorch-nightly pytorch cpuonly
printf
"* Setting up torchaudio
\n
"
IS_CONDA
=
true
python setup.py develop
.circleci/unittest/run_test.sh
0 → 100755
View file @
a47dca4f
#!/usr/bin/env bash
set
-e
eval
"
$(
./conda/bin/conda shell.bash hook
)
"
conda activate ./env
python
-m
torch.utils.collect_env
pytest
-v
test
.circleci/unittest/setup_env.sh
0 → 100755
View file @
a47dca4f
#!/usr/bin/env bash
# This script is for setting up environment for running unit test on CircleCI.
# To speed up the CI time, the result of environment is cached.
# PyTorch is not included here, so that it won't be cached.
set
-e
this_dir
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
>
/dev/null 2>&1
&&
pwd
)
"
root_dir
=
"
$(
git rev-parse
--show-toplevel
)
"
conda_dir
=
"
${
root_dir
}
/conda"
env_dir
=
"
${
root_dir
}
/env"
cd
"
${
root_dir
}
"
# 1. Install conda at ./conda
if
[
!
-d
"
${
conda_dir
}
"
]
;
then
printf
"* Installing conda
\n
"
wget
-O
miniconda.sh http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./miniconda.sh
-b
-f
-p
"
${
conda_dir
}
"
fi
printf
"* Checking conda update
\n
"
eval
"
$(
${
conda_dir
}
/bin/conda shell.bash hook
)
"
conda update
-n
base
-c
defaults conda
# 2. Create test environment at ./env
if
[
!
-d
"
${
env_dir
}
"
]
;
then
printf
"* Creating a test environment
\n
"
conda create
--prefix
"
${
env_dir
}
"
-y
python
=
"
$PYTHON_VERSION
"
fi
printf
"* Installing dependencies (except PyTorch)
\n
"
conda activate
"
${
env_dir
}
"
conda
env
update
--file
"
${
this_dir
}
/environment.yml"
--prune
# 3. Build codecs at ./third_party
if
[
!
-d
"./third_party"
]
;
then
printf
"* Building Codecs"
./packaging/build_from_source.sh
"
$PWD
"
fi
test/test_librosa_compatibility.py
View file @
a47dca4f
...
@@ -243,10 +243,8 @@ class TestTransforms(_LibrosaMixin, unittest.TestCase):
...
@@ -243,10 +243,8 @@ class TestTransforms(_LibrosaMixin, unittest.TestCase):
}
}
_test_compatibilities
(
**
kwargs
)
_test_compatibilities
(
**
kwargs
)
# NOTE: Test passes offline, but fails on TravisCI, see #372.
# NOTE: Test passes offline, but fails on TravisCI (and CircleCI), see #372.
@
unittest
.
skipIf
(
@
unittest
.
skipIf
(
'CI'
in
os
.
environ
,
'Test is known to fail on CI'
)
os
.
environ
.
get
(
'CI'
)
==
'true'
and
os
.
environ
.
get
(
'TRAVIS'
)
==
'true'
,
'Test is known to fail on TravisCI'
)
def
test_basics3
(
self
):
def
test_basics3
(
self
):
kwargs
=
{
kwargs
=
{
'n_fft'
:
200
,
'n_fft'
:
200
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment