Skip to content

Commit ec2c8ad

Browse files
authored
Merge pull request #2956 from casperdcl/snap
add snap tests
2 parents 430b9bb + f80626b commit ec2c8ad

File tree

6 files changed

+43
-7
lines changed

6 files changed

+43
-7
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
- sudo /snap/bin/lxd init --auto
9090
install:
9191
script:
92-
- sudo snapcraft --use-lxd
92+
- ./scripts/build_snap.sh
9393
after_failure:
9494
- sudo journalctl -u snapd
9595

@@ -135,7 +135,7 @@ deploy:
135135
stage: build
136136
- provider: snap
137137
snap: dvc_*.snap
138-
channel: ${TRAVIS_TAG:+stable}${TRAVIS_TAG:-edge}
138+
channel: $SNAP_CHANNEL
139139
skip_cleanup: true
140140
on:
141141
all_branches: true

scripts/build_package.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
set -x
55

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

@@ -17,12 +17,12 @@ python setup.py bdist_wheel --universal
1717
if [[ -n "$TRAVIS_TAG" ]]; then
1818
pip uninstall -y dvc
1919
if which dvc; then
20-
echo "ERROR: dvc command still exists! Unable to verify dvc version."
20+
echo "ERROR: dvc command still exists! Unable to verify dvc version." >&2
2121
exit 1
2222
fi
2323
pip install dist/dvc-*.whl
2424
if [[ "$(dvc --version)" != "$TRAVIS_TAG" ]]; then
25-
echo "ERROR: 'dvc --version'$(dvc -V) doesn't match '$TRAVIS_TAG'"
25+
echo "ERROR: 'dvc --version'$(dvc -V) doesn't match '$TRAVIS_TAG'" >&2
2626
exit 1
2727
fi
2828
pip uninstall -y dvc

scripts/build_posix.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fi
2929

3030
print_error()
3131
{
32-
echo -e "\e[31m$1\e[0m"
32+
echo -e "\e[31m$1\e[0m" >&2
3333
}
3434

3535
if [ ! -d "dvc" ]; then

scripts/build_snap.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -e
3+
set -x
4+
5+
if [ ! -d "dvc" ]; then
6+
echo "Please run this script from repository root"
7+
exit 1
8+
fi
9+
10+
sudo snapcraft --use-lxd
11+
12+
pip uninstall -y dvc
13+
if which dvc; then
14+
echo "ERROR: dvc command still exists! Unable to verify dvc version." >&2
15+
exit 1
16+
fi
17+
sudo snap install --dangerous --classic dvc_*.snap
18+
if [[ -n "$TRAVIS_TAG" ]]; then
19+
# Make sure we have a correct version
20+
if [[ "$(dvc --version)" != "$TRAVIS_TAG" ]]; then
21+
echo "ERROR: 'dvc --version'$(dvc -V) doesn't match '$TRAVIS_TAG'" >&2
22+
exit 1
23+
fi
24+
fi
25+
# ensure basic commands can run
26+
# N.B.: cannot run `dvc get` on travis (#2956)
27+
dvc version
28+
dvc.git status
29+
dvc.git fetch --all
30+
sudo snap remove dvc

scripts/ci/before_install.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,9 @@ elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
5050
ln -s -f /usr/local/bin/python3 /usr/local/bin/python
5151
ln -s -f /usr/local/bin/pip3 /usr/local/bin/pip
5252
fi
53+
54+
if [[ -n "$TRAVIS_TAG" ]]; then
55+
echo "export SNAP_CHANNEL=stable" >> env.sh
56+
else
57+
echo "export SNAP_CHANNEL=edge" >> env.sh
58+
fi

snap/snapcraft.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ summary: Data Version Control
33
description: Git for Data & Models https://dvc.org
44
adopt-info: dvc
55
grade: stable
6-
confinement: classic # for same reasons as snap `git-ubuntu`
6+
confinement: classic # for `dvc run`ning external binaries
77
base: core18
88
license: Apache-2.0
99
layout:

0 commit comments

Comments
 (0)