Skip to content

Commit

Permalink
Update nvim version in main.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmorris180 committed Jan 16, 2024
1 parent 8f88600 commit b14000a
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 51 deletions.
48 changes: 20 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: main
name: Main

on:
push:
Expand All @@ -7,88 +7,80 @@ on:
types: [opened, synchronize]

concurrency:
group: github.head_ref
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
name: lint
steps:
- uses: actions/checkout@v3

- uses: JohnnyMorganz/stylua-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .

documentation:
name: Docs
runs-on: ubuntu-latest
name: documentation
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: setup neovim
- name: Set up Neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: v0.8.3

- name: generate documentation
- name: Generate documentation
run: make documentation-ci

- name: check docs diff
run: exit $(git status --porcelain doc | wc -l | tr -d " ")

tests:
needs:
name: Run tests
needs:
- lint
- documentation
runs-on: ubuntu-latest
timeout-minutes: 2
strategy:
fail-fast: false
matrix:
neovim_version: ['v0.7.2', 'v0.8.3', 'v0.9.1', 'nightly']
neovim_version: ["v0.7.2", "v0.8.3", "v0.9.4", "nightly"]

steps:
- uses: actions/checkout@v3

- run: date +%F > todays-date

- name: restore cache for today's nightly.
uses: actions/cache@v3
with:
path: _neovim
key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }}

- name: setup neovim
# - run: date +%F > todays-date
# - name: restore cache for today's nightly.
# uses: actions/cache@v3
# with:
# path: _neovim
# key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }}
- name: Setup Neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: ${{ matrix.neovim_version }}

- name: run tests
- name: Run tests
run: make test-ci

release:
name: release
name: Release
if: ${{ github.ref == 'refs/heads/main' }}
needs:
- tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: simple
package-name: salesforce.nvim

- name: tag stable versions
- name: Tag stable versions
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name github-actions[bot]
Expand Down
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
# we disable the `all` command because some external tool might run it automatically
# disable the `all` command because some external tool might run it automatically
.SUFFIXES:
.PHONY: deps

all:

# runs all the test files.
test:
nvim --version | head -n 1 && echo ''
echo "CWD:" && pwd && echo ""
nvim --version | head -n 1 && echo ""
nvim --headless --noplugin -u ./scripts/minimal_init.lua \
-c "lua MiniTest.run({ execute = { reporter = MiniTest.gen_reporter.stdout({ group_depth = 1 }) } })"
-c "lua print('Runtime path is:')" \
-c "lua print(vim.inspect(vim.opt.runtimepath:get()) .. '\n')" \
-c "lua require('mini.test').setup()" \
-c "lua require('salesforce').setup()" \
-c "lua print(vim.inspect(require('salesforce.config'):get_options()) .. '\n')" \
-c "lua print(type(MiniTest) .. '\n')" \
-c "lua MiniTest.run({ execute = { reporter = MiniTest.gen_reporter.stdout({ group_depth = 1 }) }, script_path = 'scripts/minitest.lua' })"

test-debug:
export DEBUG=true && $(MAKE) test

# installs `mini.nvim`, used for both the tests and documentation.
deps:
@mkdir -p deps
@test -d deps/mini.nvim || git clone --depth 1 https://github.com/echasnovski/mini.nvim deps/mini.nvim
@test -d deps/plenary.nvim || git clone --depth 1 https://github.com/nvim-lua/plenary.nvim.git deps/plenary.nvim
@test -d deps/nvim-treesitter || git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter.git deps/nvim-treesitter

# installs deps before running tests, useful for the CI.
test-ci: deps test

# generates the documentation.
# generates the documentation
documentation:
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua require('mini.doc').generate()" -c "qa!"

# installs deps before running the documentation generation, useful for the CI.
documentation-ci: deps documentation

# performs a lint check and fixes issue if possible, following the config in `stylua.toml`.
lint:
stylua .
4 changes: 2 additions & 2 deletions lua/salesforce/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ function Config:new()
-- The height of the popup window.
height = 20,
-- The border characters to use for the popup window
borderchars = { "", "", "", "", "", "", "", "" },
borderchars = {},
},
file_manager = {
ignore_conflicts = false,
},
org_manager = {
default_org_indicator = "󰄬",
default_org_indicator = "x",
},
}
return o
Expand Down
3 changes: 3 additions & 0 deletions plugin/salesforce.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ local FileManager = require("salesforce.file_manager")
local Diff = require("salesforce.diff")
local Config = require("salesforce.config")
local OrgManager = require("salesforce.org_manager")
local Debug = require("salesforce.debug")

Debug:log("salesforce.lua", "Initializing Salesforce plugin commands...")

vim.api.nvim_create_user_command("SalesforceExecuteFile", function()
Anon.execute_anon()
Expand Down
10 changes: 6 additions & 4 deletions scripts/minimal_init.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
-- Add current directory to 'runtimepath' to be able to use 'lua' files
vim.cmd([[let &rtp.=','.getcwd()]])
local cwd = vim.fn.getcwd()
vim.opt.runtimepath:append(cwd)
vim.opt.runtimepath:append(cwd .. "/deps/mini.nvim")
vim.opt.runtimepath:append(cwd .. "/deps/plenary.nvim")
vim.opt.runtimepath:append(cwd .. "/deps/nvim-treesitter")
vim.cmd("set cmdheight=20")

-- Set up 'mini.test' and 'mini.doc' only when calling headless Neovim (like with `make test` or `make documentation`)
-- Add 'mini.nvim' to 'runtimepath' to be able to use 'mini.test'
-- Assumed that 'mini.nvim' is stored in 'deps/mini.nvim'
vim.cmd("set rtp+=deps/mini.nvim")
vim.cmd("set rtp+=deps/plenary.nvim")
vim.cmd("set rtp+=deps/nvim-treesitter")

-- Set up 'mini.test'
require("mini.test").setup()
Expand Down
7 changes: 7 additions & 0 deletions scripts/minitest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
local minitest = require("mini.test")

---@diagnostic disable-next-line: undefined-field
if _G.MiniTest == nil then
minitest.setup()
end
minitest.run()
5 changes: 0 additions & 5 deletions test.lua

This file was deleted.

2 changes: 1 addition & 1 deletion tests/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local function error_message(str, pattern)
end

-- Check equality of a config `prop` against `value` in the given `child` process.
-- @usage option_equality(child, "debug", true)
-- @usage config_equality(child, "debug", true)
Helpers.expect.config_equality = MiniTest.new_expectation(
"config option matches",
function(child, prop, value)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_execute_anon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ local T = MiniTest.new_set({
hooks = {
-- This will be executed before every (even nested) case
pre_case = function()
-- Restart child process with minimal 'init.lua' script
child.setup()
child.lua([[M = require("salesforce")]])
end,
-- This will be executed one after all tests from this set are finished
post_once = child.stop,
},
})
Expand Down

0 comments on commit b14000a

Please sign in to comment.