mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 04:18:18 +00:00
Merge #11428 'Update SNAP packaging'
This commit is contained in:
43
.travis.yml
43
.travis.yml
@@ -4,6 +4,19 @@ language: c
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
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.
|
# Set "false" to force rebuild of third-party dependencies.
|
||||||
- CACHE_ENABLE=true
|
- CACHE_ENABLE=true
|
||||||
# Build directory for Neovim.
|
# Build directory for Neovim.
|
||||||
@@ -145,6 +158,36 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
- CLANG_SANITIZER=TSAN
|
- CLANG_SANITIZER=TSAN
|
||||||
- *common-job-env
|
- *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
|
fast_finish: true
|
||||||
|
|
||||||
before_install: ci/before_install.sh
|
before_install: ci/before_install.sh
|
||||||
|
14
ci/snap/after_success.sh
Executable file
14
ci/snap/after_success.sh
Executable file
@@ -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} ."
|
21
ci/snap/deploy.sh
Executable file
21
ci/snap/deploy.sh
Executable file
@@ -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
|
||||||
|
|
10
ci/snap/install.sh
Executable file
10
ci/snap/install.sh
Executable file
@@ -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
|
||||||
|
|
8
ci/snap/script.sh
Executable file
8
ci/snap/script.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
mkdir -p "$TRAVIS_BUILD_DIR/snaps-cache"
|
||||||
|
sudo snapcraft --use-lxd
|
||||||
|
|
BIN
ci/snap/travis_snapcraft.cfg
Normal file
BIN
ci/snap/travis_snapcraft.cfg
Normal file
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
name: neovim
|
name: nvim
|
||||||
version: git
|
base: core18
|
||||||
|
adopt-info: nvim
|
||||||
summary: Vim-fork focused on extensibility and agility.
|
summary: Vim-fork focused on extensibility and agility.
|
||||||
description: |
|
description: |
|
||||||
Neovim is a project that seeks to aggressively refactor Vim in order to:
|
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
|
Enable the implementation of new/modern user interfaces without any modifications to the core source
|
||||||
Improve extensibility with a new plugin architecture
|
Improve extensibility with a new plugin architecture
|
||||||
For lots more details, see the wiki!
|
For lots more details, see the wiki!
|
||||||
|
|
||||||
|
grade: stable # must be 'stable' to release into candidate/stable channels
|
||||||
confinement: classic
|
confinement: classic
|
||||||
|
|
||||||
apps:
|
apps:
|
||||||
neovim:
|
nvim:
|
||||||
command: usr/local/bin/nvim
|
command: usr/bin/nvim
|
||||||
plugs: [network, network-bind, x11]
|
|
||||||
environment:
|
environment:
|
||||||
HOME: /home/$USER
|
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:
|
parts:
|
||||||
neovim:
|
nvim:
|
||||||
source: .
|
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
|
plugin: make
|
||||||
make-parameters:
|
make-parameters:
|
||||||
- CMAKE_BUILD_TYPE=Release
|
- 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:
|
build-packages:
|
||||||
- ninja-build
|
- ninja-build
|
||||||
- libtool
|
- libtool
|
||||||
@@ -33,9 +53,10 @@ parts:
|
|||||||
- automake
|
- automake
|
||||||
- cmake
|
- cmake
|
||||||
- g++
|
- g++
|
||||||
|
- git
|
||||||
|
- gettext
|
||||||
- pkg-config
|
- pkg-config
|
||||||
- unzip
|
- unzip
|
||||||
snap:
|
prime:
|
||||||
- usr/local/bin
|
- -usr/share/man
|
||||||
- usr/local/share/nvim
|
|
||||||
- -usr/local/share/man
|
|
||||||
|
Reference in New Issue
Block a user