Skip to content

Commit

Permalink
Merge pull request #2956 from casperdcl/snap
Browse files Browse the repository at this point in the history
add snap tests
  • Loading branch information
efiop authored Jan 19, 2020
2 parents 430b9bb + f80626b commit ec2c8ad
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 7 deletions.
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

0 comments on commit ec2c8ad

Please sign in to comment.