Skip to content

Commit

Permalink
ci: improved actions and fixed some bugs (#5)
Browse files Browse the repository at this point in the history
* ci(test): added `golang` setup to test `go install` command

* fix(ci): added check for windows to export `PATH` correctly

* fix: changed it to powershell

* fix: yaml variables

* ci(docs): added paths to `README.md` to ensure only that file

* ci(lint): modified lint to only run on `lua` and `tests` directories

* fix(ci): setting `PATH` correctly

* feat: added `Windows support` SHA commit

Thanks to @hishamhm for this commit SHA d7d707a.

* fix: command for `rm` updated for Windows

* fix: luarocks conditional

* ci(docs): added only pushes on `README.md`

* feat: removed `Windows` support on CI

* ci(lint): lint only in paths `lua/` and `tests/`
  • Loading branch information
AlejandroSuero authored May 14, 2024
1 parent ff919cd commit 4b78441
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ on:
push:
branches-ignore:
- main
paths:
- "README.md"
pull_request:
branches:
- main
paths:
- "README.md"

jobs:
docs:
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
name: lint

on: ["push", "pull_request"]
on:
push:
branches:
- main
paths:
- "lua/**"
- "tests/**"
pull_request:
branches:
- main
paths:
- "lua/**"
- "tests/**"

jobs:
lint:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
rev: [nightly, v0.9.0, stable]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
name: Set up Go
with:
go-version: ~1.21
- uses: rhysd/action-setup-vim@v1
name: Set up Neovim
with:
neovim: true
version: ${{ matrix.rev }}

- name: Run tests with NeoVim
- name: Run tests with Neovim
shell: bash
run: |
export PATH="${PWD}/_neovim/bin:${PATH}"
export VIM="${PWD}/_neovim/share/nvim/runtime"
Expand Down
9 changes: 6 additions & 3 deletions lua/freeze-code/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,18 @@ freeze_code.agnostic_install_freeze = function(opts)
return
end

local install_path = opts.install_path
local install_path = vim.fn.expand(opts.install_path)
if install_path == "" then
install_path = "~/.local/bin"
install_path = vim.fn.expand("~/.local/bin")
end
local output_filename = "freeze.tar.gz"
local download_command = { "curl", "-sL", "-o", output_filename, release_url }
local extract_command = { "tar", "-zxf", output_filename, "-C", install_path }
-- vim.loop.spawn("rm", { args = { "-rf", install_path .. "/" .. get_freeze_filename() } })
local rm_command_args = { "-rf", install_path .. "/" .. get_freeze_filename() }
if os_name == "Windows" then
extract_command = { "Expand-Archive", output_filename, install_path }
rm_command_args = { "-r", "-Force", install_path .. "/" .. get_freeze_filename() }
end
local binary_path = vim.fn.expand(table.concat({ install_path, get_freeze_filename() .. "/freeze" }, "/"))

Expand Down Expand Up @@ -236,7 +239,7 @@ freeze_code.agnostic_install_freeze = function(opts)
opts._installed = true
opts.install_path = install_path
freeze_code.setup(opts)
vim.loop.spawn("rm", { args = { "-rf", install_path .. "/" .. get_freeze_filename() } })
vim.loop.spawn("rm", { args = rm_command_args })
logger.warn_fmt("[freeze-code] `freeze` binary installed in installed in path=%s", freeze_code.config.freeze_path)
freeze_code.setup(opts)
create_autocmds()
Expand Down

0 comments on commit 4b78441

Please sign in to comment.