diff --git a/.travis.yml b/.travis.yml index b9bb1b8ad..762ee0552 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ cache: directories: - $HOME/.cache/pip - $HOME/.pyenv -sudo: true dist: xenial env: global: @@ -15,18 +14,20 @@ stages: - test - build - name: deploy - if: tag is present + if: (branch = master OR tag is present) AND repo = iterative/dvc # Travis doesn't support testing python on Mac yet, so we need # to workaround it by installing it directly with brew. # # Note that we specify language as ruby-2.4.3 to help us satisfy # fpm dependencies, as travis runs el capitan with an old ruby # version, that causes fpm to crash. +# +# Each job will use the previous job's `stage` tag if not specified. jobs: include: # patch formatting checks - name: "Check patch formatting" - stage: "check" + stage: check os: linux language: python python: 3.7 @@ -41,35 +42,28 @@ jobs: env: - PY2=1 - name: "3.7 on Windows" - stage: test os: windows # Windows 10.0.17134 N/A Build 17134 language: shell # 'language: python' is an error on Travis CI Windows - name: "2.7 on Linux" - stage: test language: python python: 2.7 env: - PY2=1 - name: "3.5 on Linux" - stage: test language: python python: 3.5 - name: "3.6 on Linux" - stage: test language: python python: 3.6 - name: "3.7 on Linux" - stage: test language: python python: 3.7 - name: "2.7 on Mac" - stage: test os: osx osx_image: xcode9.4 env: - PY2=1 - name: "3.6 on Mac" - stage: test os: osx osx_image: xcode9.4 # build jobs @@ -82,25 +76,42 @@ jobs: install: script: ./scripts/build_posix.sh - name: "Windows pkg" - stage: build os: windows language: shell install: script: ./scripts/build_windows.cmd - name: "Linux pkgs" - stage: build language: python python: 3.7 before_install: install: script: ./scripts/build_posix.sh - name: "Pypi pkgs" - stage: build language: python python: 3.7 script: ./scripts/build_package.sh + - name: Snapcraft snap + addons: + snaps: + - name: snapcraft + channel: stable + confinement: classic + - name: lxd + channel: stable + env: + - SNAPCRAFT_IMAGE_INFO: '{"build_url": "$TRAVIS_BUILD_URL"}' + before_install: + - sudo /snap/bin/lxd.migrate -yes + - sudo /snap/bin/lxd waitready + - sudo /snap/bin/lxd init --auto + install: + script: + - sudo snapcraft --use-lxd + after_failure: + - sudo journalctl -u snapd # deploy jobs - name: "Pypi pkgs" + if: tag is present stage: deploy language: python python: 3.7 @@ -117,9 +128,6 @@ jobs: - dist/dvc*.whl - dist/dvc*.tar.gz skip_cleanup: true - on: - tags: true - repo: iterative/dvc before_install: - bash ./scripts/ci/before_install.sh @@ -140,6 +148,7 @@ deploy: - dvc*.deb - dvc*.pkg - dvc*.exe + - dvc*.snap skip_cleanup: true on: tags: true diff --git a/README.rst b/README.rst index 2ba9c2c25..407bc0d4e 100644 --- a/README.rst +++ b/README.rst @@ -30,6 +30,10 @@ :target: https://anaconda.org/conda-forge/dvc :alt: Conda-forge +.. image:: https://img.shields.io/badge/snap-install-82BEA0.svg?logo=snapcraft + :target: https://snapcraft.io/dvc + :alt: Snapcraft + | **Data Version Control** or **DVC** is an **open-source** tool for data science and machine @@ -146,6 +150,21 @@ Conda (Anaconda) Currently, it supports only python version 2.7, 3.6 and 3.7. +Snap (Snapcraft) +---------------- + +Download the latest ``dvc_*.snap`` from the +GitHub `releases page `_. + +.. code-block:: bash + + snap install dvc_*.snap --dangerous --classic + +Once ``dvc`` is released on the snap store +(`pending request `_) +there will be no need to download ``dvc_*.snap`` or use ``--dangerous`` +(``snap install dvc --classic`` would suffice). + Package ------- diff --git a/dvc/updater.py b/dvc/updater.py index 279d5d23a..2bb1d604d 100644 --- a/dvc/updater.py +++ b/dvc/updater.py @@ -48,7 +48,7 @@ class Updater(object): # pragma: no cover logger.debug(msg.format(self.lock.lockfile, action)) def check(self): - if os.getenv("CI") or env2bool("DVC_TEST"): + if os.getenv("CI") or env2bool("DVC_TEST") or PKG == "snap": return self._with_lock(self._check, "checking") diff --git a/scripts/build_package.sh b/scripts/build_package.sh index d64f3e6e4..1b9536697 100755 --- a/scripts/build_package.sh +++ b/scripts/build_package.sh @@ -8,7 +8,7 @@ if [ ! -d "dvc" ]; then exit 1 fi -echo "PKG = \"pip\"" > dvc/utils/build.py +echo 'PKG = "pip"' > dvc/utils/build.py python setup.py sdist python setup.py bdist_wheel --universal diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 000000000..1f8a0b39f --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,65 @@ +name: dvc +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` +base: core18 +license: Apache-2.0 +plugs: + config-dvc: + interface: system-files + read: + - /etc/host.conf + - /etc/resolv.conf + - /etc/hosts +layout: + /etc/dvc: + bind: $SNAP_DATA/etc/dvc + /usr/share/git-core: + bind: $SNAP/usr/share/git-core + /usr/share/gitweb: + bind: $SNAP/usr/share/gitweb + /usr/lib/git-core: + bind: $SNAP/usr/lib/git-core +parts: + dvc: + plugin: python + python-packages: [wheel] + source: . + build-packages: + - git + - libc-dev + stage-packages: + - git + override-pull: | + snapcraftctl pull + echo 'PKG = "snap"' > $SNAPCRAFT_PART_SRC/dvc/utils/build.py + snapcraftctl set-version `cd $SNAPCRAFT_PART_SRC && git describe --tags` + # install all optional extras + sed -ri 's/(=install_requires)/\1+all_remotes+hdfs/' $SNAPCRAFT_PART_SRC/setup.py + override-build: | + snapcraftctl build + cp $SNAPCRAFT_PART_BUILD/scripts/completion/dvc.bash $SNAPCRAFT_PART_INSTALL/completion.sh +apps: + dvc: + command: bin/dvc + completer: completion.sh + environment: + GIT_PYTHON_GIT_EXECUTABLE: $SNAP/usr/bin/git + XDG_CONFIG_DIRS: /etc + plugs: + - config-dvc + - home + - mount-observe + - network-control + - removable-media + git: + command: usr/bin/git + environment: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + plugs: + - home + - mount-observe + - network-control + - removable-media