-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to build universal Neovim
- Loading branch information
Showing
3 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: 'Universal Neovim' | ||
on: | ||
push: | ||
tags: | ||
# example: neovim-v0.10.0-20240601.102525 | ||
- neovim-v[0-9]+.[0-9]+.[0-9]+-.* | ||
|
||
jobs: | ||
macos: | ||
needs: setup | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runner: [ macos-12, macos-14 ] | ||
include: | ||
- runner: macos-12 | ||
arch: x86_64 | ||
- runner: macos-14 | ||
arch: arm64 | ||
runs-on: ${{ matrix.runner }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
# Perform a full checkout #13471 | ||
fetch-depth: 0 | ||
- name: Install dependencies | ||
run: brew bundle | ||
|
||
- name: Build neovim | ||
run: clean=true ./bin/neovim/bin/build_neovim.sh | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: nvim-macos-${{ matrix.arch }} | ||
path: Neovim/build/nvim-macos-${{ matrix.arch }}.tar.gz | ||
retention-days: 1 | ||
|
||
publish: | ||
needs: [macos] | ||
runs-on: macos-14 | ||
env: | ||
GH_REPO: ${{ github.repository }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
steps: | ||
# Must perform checkout first, since it deletes the target directory | ||
# before running, and would therefore delete the downloaded artifacts | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/download-artifact@v4 | ||
|
||
- name: Install dependencies | ||
run: brew-bundle | ||
|
||
- name: Set tag name env | ||
run: | | ||
TAG_NAME=${{ github.ref }} | ||
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV | ||
- name: Create universal Neovim | ||
run: ./bin/neovim/bin/build_universal_neovim.sh | ||
|
||
- name: Publish release | ||
run: | | ||
gh release create $TAG_NAME --title "Neovim universal build ${TAG_NAME}" --target $GITHUB_SHA nvim-macos-x86_64/nvim-macos-x86_64.tar.gz nvim-macos-arm64/nvim-macos-arm64.tar.gz nvim-macos-universal.tar.bz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
set -Eeuo pipefail | ||
|
||
# This script creates a universal build, incl. Treesitter `so`s. The Treesitter | ||
# libs are put under the `runtime` folder instead of under `lib`. | ||
# | ||
# It expects to find the following files in the workspace root: | ||
# - nvim-macos-x86_64.tar.gz | ||
# - nvim-macos-arm64.tar.gz | ||
# It will produce the following in the workspace root: | ||
# - nvim-macos-universal.tar.bz | ||
# | ||
# To be used in the context of Github actions | ||
|
||
main() { | ||
# This script is located in /bin/neovim/bin and we have to go to / | ||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" >/dev/null | ||
|
||
tar -xf nvim-macos-x86_64.tar.gz | ||
tar -xf nvim-macos-arm64.tar.gz | ||
|
||
mkdir -p "nvim-macos-universal" | ||
|
||
local universal_folder_path; universal_folder_path="$(pwd)/nvim-macos-universal"; | ||
readonly universal_folder_path | ||
|
||
mkdir -p "${universal_folder_path}/bin" | ||
cp -r nvim-macos-arm64/share "${universal_folder_path}" | ||
mkdir -p "${universal_folder_path}/share/nvim/runtime/parser" | ||
|
||
lipo -create nvim-macos-arm64/bin/nvim nvim-macos-x86_64/bin/nvim \ | ||
-output "${universal_folder_path}/bin/nvim" | ||
for f in nvim-macos-arm64/lib/nvim/parser/*; do | ||
echo "${f}" | ||
f="${f%/}" | ||
local filename="${f##*/}" | ||
lipo -create "nvim-macos-arm64/lib/nvim/parser/${filename}" \ | ||
"nvim-macos-x86_64/lib/nvim/parser/${filename}" \ | ||
-output "${universal_folder_path}/share/nvim/runtime/parser/${filename}" | ||
done | ||
|
||
tar -cjf nvim-macos-universal | ||
|
||
popd >/dev/null | ||
} | ||
|
||
main |