aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml43
-rwxr-xr-xci/snap/after_success.sh14
-rwxr-xr-xci/snap/deploy.sh21
-rwxr-xr-xci/snap/install.sh10
-rwxr-xr-xci/snap/script.sh8
-rw-r--r--ci/snap/travis_snapcraft.cfgbin0 -> 2448 bytes
-rw-r--r--snap/snapcraft.yaml43
7 files changed, 128 insertions, 11 deletions
diff --git a/.travis.yml b/.travis.yml
index d8a1d2ddf0..e4ced8ceb5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,6 +4,19 @@ language: c
env:
global:
+ # Encrypted environment variables, see
+ # http://docs.travis-ci.com/user/encryption-keys/
+ #
+ # SNAP_SECRET_KEY: generated by:
+ # travis encrypt SNAP_SECRET_KEY=xx --add
+ # https://github.com/neovim/neovim/pull/11428
+ # snapcraft key expires after 1 year. Steps to refresh it:
+ # 1. snapcraft enable-ci travis --refresh
+ # 2. mv .snapcraft/travis_snapcraft.cfg ci/snap/travis_snapcraft.cfg
+ # 3. Copy after_success command to ci/snap/deploy.sh from .travis.yml
+ # 4. Undo changes to .travis.yml
+ - secure: hd0qn2u8ABbJg5Bx4pBRcUQbKYFmcSHoecyHIPTCnGJT+NI41Bvm/IkN/N5DhBF+LbD3Q2nmR/dzI5H/dqS7RxMFvEx1DuFLendFHHX3MYf0AuKpXYY3gwgMTmqx8p/v6srlU7RBGWNGzHCWqksAem+EIWCe3I7WvfdKo1/DV/Y=
+
# Set "false" to force rebuild of third-party dependencies.
- CACHE_ENABLE=true
# Build directory for Neovim.
@@ -145,6 +158,36 @@ jobs:
env:
- CLANG_SANITIZER=TSAN
- *common-job-env
+ - if: type != pull_request
+ name: snap
+ os: linux
+ env:
+ - LC_ALL: C.UTF-8
+ - LANG: C.UTF-8
+ - SNAPCRAFT_ENABLE_SILENT_REPORT: y
+ - SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: y
+ addons:
+ snaps:
+ - name: snapcraft
+ channel: stable
+ classic: true
+ - name: http
+ - name: transfer
+ - name: lxd
+ channel: stable
+ # Override default before_install, before_cache.
+ before_install: /bin/true
+ before_cache: /bin/true
+ install: ci/snap/install.sh
+ before_script: echo "Building snap..."
+ script: ci/snap/script.sh
+ after_success: ci/snap/after_success.sh
+ deploy:
+ skip_cleanup: true
+ provider: script
+ script: ci/snap/deploy.sh
+ on:
+ branch: master
fast_finish: true
before_install: ci/before_install.sh
diff --git a/ci/snap/after_success.sh b/ci/snap/after_success.sh
new file mode 100755
index 0000000000..e66721a5e2
--- /dev/null
+++ b/ci/snap/after_success.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+
+RESULT_SNAP=$(find ./ -name "*.snap")
+
+sudo snap install "$RESULT_SNAP" --dangerous --classic
+
+/snap/bin/nvim --version
+
+SHA256=$(sha256sum "$RESULT_SNAP")
+echo "SHA256: ${SHA256} ."
diff --git a/ci/snap/deploy.sh b/ci/snap/deploy.sh
new file mode 100755
index 0000000000..3f959c05e5
--- /dev/null
+++ b/ci/snap/deploy.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+# not a tagged release, abort
+# [[ "$TRAVIS_TAG" != "$TRAVIS_BRANCH" ]] && exit 0
+
+mkdir -p .snapcraft
+openssl aes-256-cbc -K $encrypted_ece1c4844832_key -iv $encrypted_ece1c4844832_iv
+ -in ci/snap/travis_snapcraft.cfg -out .snapcraft/snapcraft.cfg -d
+
+SNAP=$(find ./ -name "*.snap")
+
+# TODO(justinmk): This always does `edge` until we enable tagged builds.
+if [[ "$SNAP" =~ "dirty" || "$SNAP" =~ "nightly" ]]; then
+ snapcraft push "$SNAP" --release edge
+else
+ snapcraft push "$SNAP" --release candidate
+fi
+
diff --git a/ci/snap/install.sh b/ci/snap/install.sh
new file mode 100755
index 0000000000..23e0bc5eb8
--- /dev/null
+++ b/ci/snap/install.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+sudo apt update
+sudo /snap/bin/lxd.migrate -yes
+sudo /snap/bin/lxd waitready
+sudo /snap/bin/lxd init --auto
+
diff --git a/ci/snap/script.sh b/ci/snap/script.sh
new file mode 100755
index 0000000000..647cda4874
--- /dev/null
+++ b/ci/snap/script.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+mkdir -p "$TRAVIS_BUILD_DIR/snaps-cache"
+sudo snapcraft --use-lxd
+
diff --git a/ci/snap/travis_snapcraft.cfg b/ci/snap/travis_snapcraft.cfg
new file mode 100644
index 0000000000..3e6a60c30d
--- /dev/null
+++ b/ci/snap/travis_snapcraft.cfg
Binary files differ
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 81ffb9adf3..da3e74d3e7 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,5 +1,6 @@
-name: neovim
-version: git
+name: nvim
+base: core18
+adopt-info: nvim
summary: Vim-fork focused on extensibility and agility.
description: |
Neovim is a project that seeks to aggressively refactor Vim in order to:
@@ -9,22 +10,41 @@ description: |
Enable the implementation of new/modern user interfaces without any modifications to the core source
Improve extensibility with a new plugin architecture
For lots more details, see the wiki!
+
+grade: stable # must be 'stable' to release into candidate/stable channels
confinement: classic
apps:
- neovim:
- command: usr/local/bin/nvim
- plugs: [network, network-bind, x11]
+ nvim:
+ command: usr/bin/nvim
environment:
HOME: /home/$USER
- VIM: $SNAP/usr/local/share/nvim/runtime
+ VIM: $SNAP/usr/share/nvim
+ VIMRUNTIME: $SNAP/usr/share/nvim/runtime
+ desktop: usr/share/applications/nvim.desktop
parts:
- neovim:
+ nvim:
source: .
+ override-pull: |
+ snapcraftctl pull
+ major="$(awk '/NVIM_VERSION_MAJOR/{gsub(")","",$2); print $2}' CMakeLists.txt)"
+ minor="$(awk '/NVIM_VERSION_MINOR/{gsub(")","",$2); print $2}' CMakeLists.txt)"
+ patch="$(awk '/NVIM_VERSION_PATCH/{gsub(")","",$2); print $2}' CMakeLists.txt)"
+ version_prefix="v$major.$minor.$patch"
+ git_described="$(git describe --first-parent --dirty 2> /dev/null | perl -lpe 's/v\d.\d.\d-//g')"
+ git_described="${git_described:-$(git describe --first-parent --tags --always --dirty)}"
+ snapcraftctl set-version "${version_prefix}-${git_described}"
plugin: make
make-parameters:
- CMAKE_BUILD_TYPE=Release
+ - CMAKE_INSTALL_PREFIX=/usr
+ override-build: |
+ snapcraftctl build
+ # Fix Desktop file
+ sed -i 's|^Exec=nvim|Exec=/snap/bin/nvim.nvim|' ${SNAPCRAFT_PART_INSTALL}/usr/share/applications/nvim.desktop
+ sed -i 's|^TryExec=nvim|TryExec=/snap/bin/nvim.nvim|' ${SNAPCRAFT_PART_INSTALL}/usr/share/applications/nvim.desktop
+ sed -i 's|^Icon=.*|Icon=${SNAP}/usr/share/pixmaps/nvim.png|' ${SNAPCRAFT_PART_INSTALL}/usr/share/applications/nvim.desktop
build-packages:
- ninja-build
- libtool
@@ -33,9 +53,10 @@ parts:
- automake
- cmake
- g++
+ - git
+ - gettext
- pkg-config
- unzip
- snap:
- - usr/local/bin
- - usr/local/share/nvim
- - -usr/local/share/man
+ prime:
+ - -usr/share/man
+