summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubho Banerjee <[email protected]>2021-09-30 11:53:14 -0500
committerGitHub <[email protected]>2021-09-30 18:53:14 +0200
commite270bdbd6f9adfd9ae471512c63c3283798481f1 (patch)
tree41e594e199a0b118a2208293fe8a214545b5f7f7
parent8ec92c0420374097f1a617fe91cd6f6a5503c5b0 (diff)
[Bugfix]: Use local install in Github actions (#1628)
Co-authored-by: kylo252 <[email protected]>
-rw-r--r--.github/workflows/install.yaml7
-rw-r--r--utils/docker/Dockerfile25
-rw-r--r--utils/docker/Dockerfile.local27
-rw-r--r--utils/docker/Dockerfile.remote27
-rwxr-xr-xutils/installer/install.sh69
5 files changed, 99 insertions, 56 deletions
diff --git a/.github/workflows/install.yaml b/.github/workflows/install.yaml
index 6d84f79c..fa1b9be8 100644
--- a/.github/workflows/install.yaml
+++ b/.github/workflows/install.yaml
@@ -1,7 +1,7 @@
name: install
on:
push:
- branches: "**"
+ branches: ["**"]
pull_request:
branches:
- "master"
@@ -31,10 +31,7 @@ jobs:
- name: Install LunarVim
timeout-minutes: 4
run: |
- mkdir -p "$HOME"/.local/share/lunarvim/lvim
- mkdir -p "$HOME"/.config/lvim
- ln -s "$PWD"/* "$HOME"/.local/share/lunarvim/lvim/.
- bash ./utils/installer/install.sh
+ ./utils/installer/install.sh --local --no-install-dependencies
- name: Test LunarVim PackerCompile
run: if "$HOME"/.local/bin/lvim --headless +PackerCompile -c ':qall' 2>&1|grep -q 'Error'; then false; fi
diff --git a/utils/docker/Dockerfile b/utils/docker/Dockerfile
deleted file mode 100644
index 5a3b2f61..00000000
--- a/utils/docker/Dockerfile
+++ /dev/null
@@ -1,25 +0,0 @@
-FROM ubuntu:latest
-
-ARG NEOVIM_RELEASE=v0.5.0
-ARG LVBRANCH=rolling
-
-ENV DEBIAN_FRONTEND=noninteractive
-
-# Install apt dependencies
-RUN apt update && \
- apt -y install sudo curl build-essential git fzf python3-dev python3-pip cargo && \
- curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
- apt update && \
- apt -y install nodejs && \
- curl -L -o /tmp/nvim.appimage https://github.com/neovim/neovim/releases/download/${NEOVIM_RELEASE}/nvim.appimage && \
- chmod u+x /tmp/nvim.appimage && \
- /tmp/nvim.appimage --appimage-extract && \
- mv squashfs-root /usr/local/neovim && \
- ln -s /usr/local/neovim/usr/bin/nvim /usr/bin/nvim && \
- apt clean && rm -rf /var/lib/apt/lists/* /tmp/* && \
- LVBRANCH=${LVBRANCH} curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/rolling/utils/installer/install.sh | bash -s -- -y
-
-ENV PATH="/root/.local/bin:/root/.cargo/bin:/root/.npm-global/bin${PATH}"
-
-ENTRYPOINT ["/bin/bash"]
-CMD ["lvim"]
diff --git a/utils/docker/Dockerfile.local b/utils/docker/Dockerfile.local
new file mode 100644
index 00000000..c219e34f
--- /dev/null
+++ b/utils/docker/Dockerfile.local
@@ -0,0 +1,27 @@
+# To run this file execute:
+# docker build -f <Path to this file> <Path to Lunarvim basedir> -t Lunarvim:local
+
+FROM ubuntu:latest
+
+# Set environment correctly
+ENV DEBIAN_FRONTEND=noninteractive
+ENV PATH="/root/.local/bin:/root/.cargo/bin:/root/.npm-global/bin${PATH}"
+
+# Copy in local directory
+COPY --chown=root:root . /LunarVim
+
+# Install dependencies and LunarVim
+RUN apt update && \
+ apt -y install sudo curl build-essential git fzf python3-dev python3-pip cargo && \
+ curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
+ apt update && \
+ apt -y install nodejs && \
+ apt clean && rm -rf /var/lib/apt/lists/* /tmp/* && \
+ /LunarVim/utils/installer/install-neovim-from-release && \
+ /LunarVim/utils/installer/install.sh --local --no-install-dependencies
+
+# Setup LVIM to run on starup
+ENTRYPOINT ["/bin/bash"]
+CMD ["lvim"]
+
+# vim: ft=dockerfile:
diff --git a/utils/docker/Dockerfile.remote b/utils/docker/Dockerfile.remote
new file mode 100644
index 00000000..94765c48
--- /dev/null
+++ b/utils/docker/Dockerfile.remote
@@ -0,0 +1,27 @@
+# To run this file execute:
+# docker build -f Dockerfile.remote . -t Lunarvim:remote
+
+FROM ubuntu:latest
+
+# Build argument to point to correct branch on GitHub
+ARG LV_BRANCH=rolling
+
+# Set environment correctly
+ENV DEBIAN_FRONTEND=noninteractive
+ENV PATH="/root/.local/bin:/root/.cargo/bin:/root/.npm-global/bin${PATH}"
+
+# Install dependencies and LunarVim
+RUN apt update && \
+ apt -y install sudo curl build-essential git fzf python3-dev python3-pip cargo && \
+ curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
+ apt update && \
+ apt -y install nodejs && \
+ apt clean && rm -rf /var/lib/apt/lists/* /tmp/* && \
+ curl -LSs https://raw.githubusercontent.com/lunarvim/lunarvim/${LV_BRANCH}/utils/installer/install-neovim-from-release | bash && \
+ LV_BRANCH=${LV_BRANCH} curl -LSs https://raw.githubusercontent.com/lunarvim/lunarvim/${LV_BRANCH}/utils/installer/install.sh | bash -s -- --no-install-dependencies
+
+# Setup LVIM to run on starup
+ENTRYPOINT ["/bin/bash"]
+CMD ["lvim"]
+
+# vim: ft=dockerfile:
diff --git a/utils/installer/install.sh b/utils/installer/install.sh
index 1bbb05c4..d4daf55a 100755
--- a/utils/installer/install.sh
+++ b/utils/installer/install.sh
@@ -17,6 +17,15 @@ declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}"
declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim"
declare -r LUNARVIM_PACK_DIR="$LUNARVIM_RUNTIME_DIR/site/pack"
+declare BASEDIR
+BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
+BASEDIR="$(dirname -- "$(dirname -- "$BASEDIR")")"
+readonly BASEDIR
+
+declare ARGS_LOCAL=0
+declare ARGS_OVERWRITE=0
+declare ARGS_INSTALL_DEPENDENCIES=1
+
declare -a __lvim_dirs=(
"$LUNARVIM_CONFIG_DIR"
"$LUNARVIM_RUNTIME_DIR"
@@ -36,19 +45,26 @@ function usage() {
echo "Usage: install.sh [<options>]"
echo ""
echo "Options:"
- echo " -h, --help Print this help message"
- echo " -y, --yes Yes for all choices (Install NodeJS, Python, Rust dependencies)"
- echo " --overwrite Overwrite previous lvim configuration"
+ echo " -h, --help Print this help message"
+ echo " -l, --local Install local copy of LunarVim"
+ echo " --overwrite Overwrite previous LunarVim configuration (a backup is always performed first)"
+ echo " --[no]-install-dependencies Wheter to prompt to install external dependencies (will prompt by default)"
}
function parse_arguments() {
while [ "$#" -gt 0 ]; do
case "$1" in
- -y | --yes)
- ARGS_INSTALL_NONINTERACTIVE="y"
+ -l | --local)
+ ARGS_LOCAL=1
;;
--overwrite)
- ARGS_OVERWRITE="y"
+ ARGS_OVERWRITE=1
+ ;;
+ --install-dependencies)
+ ARGS_INSTALL_DEPENDENCIES=1
+ ;;
+ --no-install-dependencies)
+ ARGS_INSTALL_DEPENDENCIES=0
;;
-h | --help)
usage
@@ -80,18 +96,11 @@ EOF
echo "Detecting platform for managing any additional neovim dependencies"
detect_platform
- if [ -n "$GITHUB_ACTIONS" ]; then
- LV_BRANCH="${GITHUB_REF##*/}"
- install_packer
- setup_lvim
- exit 0
- fi
-
check_system_deps
__add_separator "80"
- if [ -z "$ARGS_INSTALL_NONINTERACTIVE" ]; then
+ if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then
echo "Would you like to install lunarvim's NodeJS dependencies?"
read -p "[y]es or [n]o (default: no) : " -r answer
[ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps
@@ -103,10 +112,6 @@ EOF
echo "Would you like to install lunarvim's Rust dependencies?"
read -p "[y]es or [n]o (default: no) : " -r answer
[ "$answer" != "${answer#[Yy]}" ] && install_rust_deps
- else
- install_nodejs_deps
- install_python_deps
- install_rust_deps
fi
__add_separator "80"
@@ -116,13 +121,7 @@ EOF
__add_separator "80"
- if [ -n "$ARGS_OVERWRITE" ]; then
- echo "!!Warning!! -> Removing all lunarvim related config \
- because of the --overwrite flag"
- if [ -z "$ARGS_INSTALL_NONINTERACTIVE" ]; then
- read -p "Would you like to continue? [y]es or [n]o : " -r answer
- [ "$answer" == "${answer#[Yy]}" ] && exit 1
- fi
+ if [ "$ARGS_OVERWRITE" -eq 1 ]; then
for dir in "${__lvim_dirs[@]}"; do
[ -d "$dir" ] && rm -rf "$dir"
done
@@ -136,7 +135,11 @@ EOF
echo "Updating LunarVim"
update_lvim
else
- clone_lvim
+ if [ -n "$ARGS_LOCAL" ]; then
+ link_local_lvim
+ else
+ clone_lvim
+ fi
setup_lvim
fi
@@ -303,6 +306,20 @@ function clone_lvim() {
fi
}
+function link_local_lvim() {
+ echo "Linking local LunarVim repo"
+
+ # Detect whether it's a symlink or a folder
+ if [ -d "$LUNARVIM_RUNTIME_DIR/lvim" ]; then
+ echo "Removing old installation files"
+ rm -rf "$LUNARVIM_RUNTIME_DIR/lvim"
+ fi
+
+ mkdir -p "$LUNARVIM_RUNTIME_DIR"
+ echo " - $BASEDIR -> $LUNARVIM_RUNTIME_DIR/lvim"
+ ln -s -f "$BASEDIR" "$LUNARVIM_RUNTIME_DIR/lvim"
+}
+
function setup_shim() {
if [ ! -d "$INSTALL_PREFIX/bin" ]; then
mkdir -p "$INSTALL_PREFIX/bin"