From 39ef3dba1a6d8b67e1a9e77064714e8a769063df Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sat, 14 Dec 2019 16:57:59 +0000 Subject: [PATCH] add snap tests - fixes #2954 --- .travis.yml | 2 +- scripts/build_package.sh | 27 +++++++++++++-------------- scripts/build_snap.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 15 deletions(-) create mode 100755 scripts/build_snap.sh diff --git a/.travis.yml b/.travis.yml index 9aa2cca1fc..0bf07cd4fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -89,7 +89,7 @@ jobs: - sudo /snap/bin/lxd init --auto install: script: - - sudo snapcraft --use-lxd + - ./scripts/build_snap.sh after_failure: - sudo journalctl -u snapd diff --git a/scripts/build_package.sh b/scripts/build_package.sh index 1b95366974..e65e4d75bf 100755 --- a/scripts/build_package.sh +++ b/scripts/build_package.sh @@ -1,11 +1,10 @@ #!/bin/bash - set -e set -x if [ ! -d "dvc" ]; then - echo "Please run this script from repository root" - exit 1 + echo "Please run this script from repository root" + exit 1 fi echo 'PKG = "pip"' > dvc/utils/build.py @@ -15,15 +14,15 @@ python setup.py bdist_wheel --universal # Make sure we have a correct version if [[ -n "$TRAVIS_TAG" ]]; then - pip uninstall -y dvc - if which dvc; then - echo "ERROR: dvc command still exists! Unable to verify dvc version." - exit 1 - fi - pip install dist/dvc-*.whl - if [[ "$(dvc --version)" != "$TRAVIS_TAG" ]]; then - echo "ERROR: 'dvc --version'$(dvc -V) doesn't match '$TRAVIS_TAG'" - exit 1 - fi - pip uninstall -y dvc + pip uninstall -y dvc + if which dvc; then + echo "ERROR: dvc command still exists! Unable to verify dvc version." >&2 + exit 1 + fi + pip install dist/dvc-*.whl + if [[ "$(dvc --version)" != "$TRAVIS_TAG" ]]; then + echo "ERROR: 'dvc --version'$(dvc -V) doesn't match '$TRAVIS_TAG'" >&2 + exit 1 + fi + pip uninstall -y dvc fi diff --git a/scripts/build_snap.sh b/scripts/build_snap.sh new file mode 100755 index 0000000000..c6208d1d50 --- /dev/null +++ b/scripts/build_snap.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e +set -x + +if [ ! -d "dvc" ]; then + echo "Please run this script from repository root" + exit 1 +fi + +sudo snapcraft --use-lxd + +# Make sure we have a correct version +if [[ -n "$TRAVIS_TAG" ]]; then + pip uninstall -y dvc + if which dvc; then + echo "ERROR: dvc command still exists! Unable to verify dvc version." >&2 + exit 1 + fi + sudo snap install --dangerous --classic dvc_*.snap + if [[ "$(dvc --version)" != "$TRAVIS_TAG" ]]; then + echo "ERROR: 'dvc --version'$(dvc -V) doesn't match '$TRAVIS_TAG'" >&2 + exit 1 + fi + dvc version + dvc get https://github.com/iterative/dvc scripts/innosetup/dvc.ico + sudo snap remove dvc +fi