diff --git a/.gitignore b/.gitignore index fa7e81c..c88de7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +#test pr only # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/.travis.yml b/.travis.yml index 9b3b276..1ad923d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,57 @@ +# +# Copyright 2018-2020 IBM Corp. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + language: python + python: - 3.6 + services: - docker + +before_install: + # Replace all slashes (which are common in branch names) in VERSION with dashes for Docker compatibility + - if [[ "$TRAVIS_BRANCH" == "master" ]]; then + VERSION=latest; + else + VERSION=${TRAVIS_BRANCH//\//-}; + fi + + # Default variables (used by Jenkins) + - '[[ -z "$DOCKERFILE" ]] && export DOCKERFILE=Dockerfile || /bin/true' + - '[[ -z "$IMAGE" ]] && export IMAGE=test || /bin/true' + - '[[ -z "$ARCH" ]] && export ARCH=x86_64 || /bin/true' + - '[[ -z "$VERSION" ]] && export VERSION=jenkins || /bin/true' + install: - - docker build -t max-audio-classifier . - - docker run -it -d -p 5000:5000 max-audio-classifier + - docker build -f "$DOCKERFILE" -t codait/max-audio-classifier:"$IMAGE"-"$ARCH"-"$VERSION" . + - docker run -it -d --rm -p 5000:5000 codait/max-audio-classifier:"$IMAGE"-"$ARCH"-"$VERSION" - pip install pytest requests flake8 + before_script: - flake8 . --max-line-length=127 - sleep 30 + script: - pytest tests/test.py + +matrix: + include: + - os: linux + env: DOCKERFILE=Dockerfile IMAGE=test ARCH=x86_64 + - os: linux + arch: arm64 + env: DOCKERFILE=Dockerfile.arm32v7 IMAGE=arm ARCH=arm32v7