Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add snap tests #2956

Merged
merged 11 commits into from
Jan 19, 2020
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -135,7 +135,7 @@ deploy:
stage: build
- provider: snap
snap: dvc_*.snap
channel: ${TRAVIS_TAG:+stable}${TRAVIS_TAG:-edge}
channel: $SNAP_CHANNEL
skip_cleanup: true
on:
all_branches: true
Expand Down
6 changes: 3 additions & 3 deletions scripts/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
set -x

if [ ! -d "dvc" ]; then
echo "Please run this script from repository root"
echo "Please run this script from repository root" >&2
exit 1
fi

Expand All @@ -17,12 +17,12 @@ python setup.py bdist_wheel --universal
if [[ -n "$TRAVIS_TAG" ]]; then
pip uninstall -y dvc
if which dvc; then
echo "ERROR: dvc command still exists! Unable to verify dvc version."
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'"
echo "ERROR: 'dvc --version'$(dvc -V) doesn't match '$TRAVIS_TAG'" >&2
exit 1
fi
pip uninstall -y dvc
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_posix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fi

print_error()
{
echo -e "\e[31m$1\e[0m"
echo -e "\e[31m$1\e[0m" >&2
}

if [ ! -d "dvc" ]; then
Expand Down
30 changes: 30 additions & 0 deletions scripts/build_snap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/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

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 [[ -n "$TRAVIS_TAG" ]]; then
# Make sure we have a correct version
if [[ "$(dvc --version)" != "$TRAVIS_TAG" ]]; then
echo "ERROR: 'dvc --version'$(dvc -V) doesn't match '$TRAVIS_TAG'" >&2
exit 1
fi
fi
# ensure basic commands can run
# N.B.: cannot run `dvc get` on travis (#2956)
dvc version
dvc.git status
dvc.git fetch --all
sudo snap remove dvc
6 changes: 6 additions & 0 deletions scripts/ci/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
ln -s -f /usr/local/bin/python3 /usr/local/bin/python
ln -s -f /usr/local/bin/pip3 /usr/local/bin/pip
fi

if [[ -n "$TRAVIS_TAG" ]]; then
echo "export SNAP_CHANNEL=stable" >> env.sh
else
echo "export SNAP_CHANNEL=edge" >> env.sh
fi
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ summary: Data Version Control
description: Git for Data & Models https://dvc.org
adopt-info: dvc
grade: stable
confinement: classic # for same reasons as snap `git-ubuntu`
confinement: classic # for `dvc run`ning external binaries
base: core18
license: Apache-2.0
layout:
Expand Down