ci: improved cpack packaging

Addresses: #12571

- Added the following installers through CMake files:
    - Windows NSIS.
    - Windows MSI.
    - Windows zip.
    - MacOs tarball.
    - Linux tarball.
    - Linux Deb package.
- Tweaked pipeline CPack commands to build using new CMakeLists.txt configuration file.
- Added icons and relevant packaging files.
- Updated notes.md to reflect new installation instructions.

This isn't meant to be the perfect solution, it's simply a first pass at using a
simple packaging system to build Windows installers. A Debian package has also
been added since it's very easy but other packages have been left out due to
limiting the scope. Hopefully we can build further upon this and improve it
over time with code signing, better icons and more user-friendly installation
graphics and so on.
This commit is contained in:
Henry Fraser 2022-02-08 06:49:09 +10:00
parent f02a5a7bda
commit 087aad3dcd
9 changed files with 149 additions and 25 deletions

View File

@ -6,8 +6,26 @@ ${NVIM_VERSION}
### Windows
1. Extract **nvim-win64.zip**
2. Run `nvim-qt.exe`
#### Zip
1. Download **nvim-win64.zip**
2. Extract the zip.
3. Run `nvim-qt.exe`
#### MSI
1. Download **nvim-win64.msi**
2. Run the MSI
3. Add the Neovim location to your path.
- Default location is `C:\Program Files\Neovim`
4. Search and run `nvim-qt.exe` or run `nvim.exe` on your CLI of choice.
#### NSIS
1. Download **nvim-win64.exe**
2. Run the installer.
- Ensure that the option to add the installation location to your path is checked if it's your first installation.
3. Search and run `nvim-qt.exe` or run `nvim.exe` on your CLI of choice.
### macOS
@ -17,6 +35,19 @@ ${NVIM_VERSION}
### Linux (x64)
#### Tarball
1. Download **nvim-linux64.tar.gz**
2. Extract: `tar xzvf nvim-linux64.tar.gz`
3. Run `./nvim-linux64/bin/nvim`
#### Debian Package
1. Download **nvim-linux64.deb**
2. Install the package using `sudo apt install ./nvim-linux64.deb`
3. Run `nvim`
#### AppImage
1. Download **nvim.appimage**
2. Run `chmod u+x nvim.appimage && ./nvim.appimage`
- If your system does not have FUSE you can [extract the appimage](https://github.com/AppImage/AppImageKit/wiki/FUSE#type-2-appimage):
@ -32,9 +63,12 @@ ${NVIM_VERSION}
## SHA256 Checksums
```
${SHA_LINUX_64}
${SHA_LINUX_64_TAR}
${SHA_LINUX_64_DEB}
${SHA_APP_IMAGE}
${SHA_APP_IMAGE_ZSYNC}
${SHA_MACOS}
${SHA_WIN_64}
${SHA_WIN_64_ZIP}
${SHA_WIN_64_MSI}
${SHA_WIN_64_EXE}
```

View File

@ -39,12 +39,17 @@ jobs:
printf '::set-output name=version::%s\n' "$(./build/bin/nvim --version | head -n 3 | sed -z 's/\n/%0A/g')"
printf '::set-output name=release::%s\n' "$(./build/bin/nvim --version | head -n 1)"
make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-linux64" install
cd "$GITHUB_WORKSPACE/build/release"
tar cfz nvim-linux64.tar.gz nvim-linux64
cd "$GITHUB_WORKSPACE/build/"
cpack -C $NVIM_BUILD_TYPE
- uses: actions/upload-artifact@v2
with:
name: nvim-linux64
path: build/release/nvim-linux64.tar.gz
path: build/nvim-linux64.tar.gz
retention-days: 1
- uses: actions/upload-artifact@v2
with:
name: nvim-linux64
path: build/nvim-linux64.deb
retention-days: 1
appimage:
@ -131,12 +136,21 @@ jobs:
- run: powershell ci\build.ps1 -NoTests
env:
CONFIGURATION: ${{ matrix.config }}
- run: move build\Neovim.zip build\${{ matrix.archive }}.zip
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.archive }}
path: build/${{ matrix.archive }}.zip
retention-days: 1
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.archive }}
path: build/${{ matrix.archive }}.msi
retention-days: 1
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.archive }}
path: build/${{ matrix.archive }}.exe
retention-days: 1
publish:
needs: [linux, appimage, macOS, windows]
@ -187,7 +201,9 @@ jobs:
run: |
cd ./nvim-linux64
sha256sum nvim-linux64.tar.gz > nvim-linux64.tar.gz.sha256sum
echo "SHA_LINUX_64=$(cat nvim-linux64.tar.gz.sha256sum)" >> $GITHUB_ENV
echo "SHA_LINUX_64_TAR=$(cat nvim-linux64.tar.gz.sha256sum)" >> $GITHUB_ENV
sha256sum nvim-linux64.deb > nvim-linux64.deb.sha256sum
echo "SHA_LINUX_64_DEB=$(cat nvim-linux64.deb.sha256sum)" >> $GITHUB_ENV
- name: Generate App Image SHA256 checksums
run: |
cd ./appimage
@ -207,7 +223,11 @@ jobs:
run: |
cd ./nvim-win64
sha256sum nvim-win64.zip > nvim-win64.zip.sha256sum
echo "SHA_WIN_64=$(cat nvim-win64.zip.sha256sum)" >> $GITHUB_ENV
echo "SHA_WIN_64_ZIP=$(cat nvim-win64.zip.sha256sum)" >> $GITHUB_ENV
sha256sum nvim-win64.msi > nvim-win64.msi.sha256sum
echo "SHA_WIN_64_MSI=$(cat nvim-win64.msi.sha256sum)" >> $GITHUB_ENV
sha256sum nvim-win64.exe > nvim-win64.exe.sha256sum
echo "SHA_WIN_64_EXE=$(cat nvim-win64.exe.sha256sum)" >> $GITHUB_ENV
- name: Publish release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -736,17 +736,6 @@ else()
COMMENT "lualint: LUACHECK_PRG not defined")
endif()
set(CPACK_PACKAGE_NAME "Neovim")
set(CPACK_PACKAGE_VENDOR "neovim.io")
set(CPACK_PACKAGE_VERSION ${NVIM_VERSION_MEDIUM})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Neovim")
# Set toplevel directory/installer name as Neovim
set(CPACK_PACKAGE_FILE_NAME "Neovim")
set(CPACK_TOPLEVEL_TAG "Neovim")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
include(CPack)
#add uninstall target
if(NOT TARGET uninstall)
@ -758,3 +747,8 @@ if(NOT TARGET uninstall)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/UninstallHelper.cmake)
endif()
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(packaging)
endif()

View File

@ -167,7 +167,4 @@ if (Test-Path -Path $env:ChocolateyInstall\bin\cpack.exe) {
}
# Build artifacts
cpack -G ZIP -C RelWithDebInfo
if ($env:APPVEYOR_REPO_TAG_NAME -ne $null) {
cpack -G NSIS -C RelWithDebInfo
}
cpack -C $cmakeBuildType

78
packaging/CMakeLists.txt Normal file
View File

@ -0,0 +1,78 @@
set(CPACK_PACKAGE_NAME "Neovim")
set(CPACK_PACKAGE_VENDOR "neovim.io")
set(CPACK_PACKAGE_FILE_NAME "nvim")
# From the GitHub About section
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Vim-fork focused on extensibility and usability.")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
# Pull the versions defined with the top level CMakeLists.txt
set(CPACK_PACKAGE_VERSION_MAJOR ${NVIM_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${NVIM_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${NVIM_VERSION_PATCH})
# CPACK_VERBATIM_VARIABLES ensures that the variables prefixed with *CPACK_*
# are correctly passed to the cpack program.
# This should always be set to true.
set(CPACK_VERBATIM_VARIABLES TRUE)
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
if(WIN32)
set(CPACK_PACKAGE_FILE_NAME "nvim-win64")
set(CPACK_GENERATOR ZIP WIX NSIS)
# WIX
# CPACK_WIX_UPGRADE_GUID should be set, but should never change.
# CPACK_WIX_PRODUCT_GUID should not be set (leave as default to auto-generate).
# The following guid is just a randomly generated guid that's been pasted here.
# It has no special meaning other than to supply it to WIX.
set(CPACK_WIX_UPGRADE_GUID "207A1A70-7B0C-418A-A153-CA6883E38F4D")
set(CPACK_WIX_PRODUCT_ICON ${CMAKE_CURRENT_LIST_DIR}/logo.ico)
# NSIS
# install icon
set(CPACK_NSIS_MUI_ICON ${CMAKE_CURRENT_LIST_DIR}/logo.ico)
# uninstall icon
set(CPACK_NSIS_MUI_UNIICON ${CMAKE_CURRENT_LIST_DIR}/logo.ico)
# icon that appears when you search in Add/Remove programs
set(CPACK_NSIS_INSTALLED_ICON_NAME ${CMAKE_CURRENT_LIST_DIR}/logo.ico)
# name that appears in the list in Add/Remove programs
set(CPACK_NSIS_DISPLAY_NAME "Neovim")
# name used in various installer UI locations, such as the title
set(CPACK_NSIS_PACKAGE_NAME "Neovim")
# Allow the user to modify their path to include neovim during
# the installation process.
set(CPACK_NSIS_MODIFY_PATH TRUE)
elseif(APPLE)
set(CPACK_PACKAGE_FILE_NAME "nvim-macos")
set(CPACK_GENERATOR TGZ)
set(CPACK_PACKAGE_ICON ${CMAKE_CURRENT_LIST_DIR}/logo.icns)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CPACK_PACKAGE_FILE_NAME "nvim-linux64")
set(CPACK_GENERATOR TGZ DEB)
set(CPACK_DEBIAN_PACKAGE_NAME "Neovim") # required
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Neovim.io") # required
# Automatically compute required shared lib dependencies.
# Unfortunately, you "just need to know" that this has a hidden
# dependency on dpkg-shlibdeps whilst using a debian based host.
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
else()
set(CPACK_GENERATOR TGZ)
endif()
# CPack variables are loaded in on the call to include(CPack). If you set
# variables *after* the inclusion, they don't get updated within the CPack
# config. Note that some CPack commands should still be run after it, such
# as cpack_add_component().
include(CPack)

BIN
packaging/logo.icns Normal file

Binary file not shown.

BIN
packaging/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

1
packaging/logo.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 54 65" fill="#fff" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round"><use xlink:href="#D" x=".5" y=".5"/><defs><linearGradient x1="50.00%" y1="0.00%" x2="50.00%" y2="100.00%" id="A"><stop stop-color="#16b0ed" stop-opacity=".8" offset="0%"/><stop stop-color="#0f59b2" stop-opacity=".837" offset="100%"/></linearGradient><linearGradient x1="50.00%" y1="0.00%" x2="50.00%" y2="100.00%" id="B"><stop stop-color="#7db643" offset="0%"/><stop stop-color="#367533" offset="100%"/></linearGradient><linearGradient x1="50.00%" y1="-0.00%" x2="50.00%" y2="100.01%" id="C"><stop stop-color="#88c649" stop-opacity=".8" offset="0%"/><stop stop-color="#439240" stop-opacity=".84" offset="100%"/></linearGradient></defs><symbol id="D" overflow="visible"><g stroke="none"><path d="M0 13.761L13.63 0v63.983L0 50.381z" fill="url(#A)"/><path d="M52.664 13.894L38.848.008l.281 63.976 13.63-13.602z" fill="url(#B)"/><path d="M13.621.011l35.435 54.07-9.916 9.915L3.686 10.046z" fill="url(#C)"/><path d="M13.633 25.092l-.019 2.13L2.676 11.069l1.013-1.032z" fill="#000" fill-opacity=".13"/></g></symbol></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB