Skip to content

Commit

Permalink
Merge pull request #57 from julienvincent/jv/change-onszuurkknrq
Browse files Browse the repository at this point in the history
Rework test command to be more flexible
  • Loading branch information
julienvincent authored Mar 10, 2024
2 parents a3e195a + e50de0c commit d681ab8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 28 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@ jobs:

- uses: extractions/setup-just@v1

- name: Prepare ${{ matrix.channel }}
run: just prepare ${{ matrix.channel }}

- name: Run Tests
run: just test
- name: Run tests [${{ matrix.channel }}]
run: just test ${{ matrix.channel }}
57 changes: 34 additions & 23 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
prepare channel="stable":
[macos]
prepare-nvim channel:
#!/usr/bin/env bash
test -d .build/nvim || {
mkdir -p ./.build/nvim
os=$(uname)
if [[ "$os" == "Darwin" ]]; then
curl -L https://github.com/neovim/neovim/releases/download/{{ channel }}/nvim-macos.tar.gz > ./.build/nvim-macos.tar.gz
xattr -c ./.build/nvim-macos.tar.gz
tar xzf ./.build/nvim-macos.tar.gz -C ./.build/nvim --strip-components=1
rm ./.build/nvim-macos.tar.gz
elif [[ "$os" == "Linux" ]]; then
curl -L https://github.com/neovim/neovim/releases/download/{{ channel }}/nvim-linux64.tar.gz > ./.build/nvim-linux64.tar.gz
tar xzf ./.build/nvim-linux64.tar.gz -C ./.build/nvim --strip-components=1
rm ./.build/nvim-linux64.tar.gz
else
echo "Unsupported operating system: $os"
exit 1
fi
NVIM_DIR=".build/nvim/{{ channel }}"
test -d $NVIM_DIR || {
mkdir -p $NVIM_DIR

curl -L https://github.com/neovim/neovim/releases/download/{{ channel }}/nvim-macos.tar.gz > ./.build/nvim-macos.tar.gz
xattr -c ./.build/nvim-macos.tar.gz
tar xzf ./.build/nvim-macos.tar.gz -C $NVIM_DIR --strip-components=1
rm ./.build/nvim-macos.tar.gz
}

[linux]
prepare-nvim channel:
#!/usr/bin/env bash
NVIM_DIR=".build/nvim/{{ channel }}"
test -d $NVIM_DIR || {
mkdir -p $NVIM_DIR

curl -L https://github.com/neovim/neovim/releases/download/{{ channel }}/nvim-linux64.tar.gz > ./.build/nvim-linux64.tar.gz
tar xzf ./.build/nvim-linux64.tar.gz -C $NVIM_DIR --strip-components=1
rm ./.build/nvim-linux64.tar.gz
}

prepare-dependencies:
#!/usr/bin/env bash
test -d .build/dependencies || {
mkdir -p ./.build/dependencies
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ./.build/dependencies/plenary.nvim
git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter ./.build/dependencies/nvim-treesitter
}
tests_dir := "tests/nvim-paredit/"
prepare channel: (prepare-nvim channel) prepare-dependencies

test channel="stable" file="": (prepare channel)
#!/usr/bin/env bash
NVIM_DIR=".build/nvim/{{ channel }}"
test: prepare
./.build/nvim/bin/nvim --version
./.build/nvim/bin/nvim \
./$NVIM_DIR/bin/nvim --version
./$NVIM_DIR/bin/nvim \
--headless \
--noplugin \
-u tests/init.lua \
-c "PlenaryBustedDirectory tests/nvim-paredit { minimal_init='tests/init.lua', sequential=true }"
-c "PlenaryBustedDirectory tests/nvim-paredit/{{ file }} { minimal_init='tests/init.lua', sequential=true }"

0 comments on commit d681ab8

Please sign in to comment.