-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat: github workflows, vusted, stylua
- Loading branch information
Showing
15 changed files
with
404 additions
and
38 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,61 @@ | ||
name: Test | ||
|
||
on: [push] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Stylua | ||
uses: JohnnyMorganz/stylua-action@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
version: latest | ||
args: --check . | ||
|
||
|
||
docs: | ||
runs-on: ubuntu-latest | ||
name: pandoc to vimdoc | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: panvimdoc | ||
uses: kdheepak/panvimdoc@main | ||
with: | ||
vimdoc: solarized.nvim | ||
treesitter: true | ||
version: "NVIM v0.9.4" | ||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: 'chore(doc): auto generate docs' | ||
commit_user_name: "github-actions[bot]" | ||
commit_user_email: "github-actions[bot]@users.noreply.github.com" | ||
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>" | ||
|
||
test: | ||
name: Run Test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: rhysd/action-setup-vim@v1 | ||
with: | ||
neovim: true | ||
|
||
- name: luajit | ||
uses: leafo/gh-actions-lua@v10 | ||
with: | ||
luaVersion: "luajit-2.1.0-beta3" | ||
|
||
- name: luarocks | ||
uses: leafo/gh-actions-luarocks@v4 | ||
|
||
- name: run test | ||
shell: bash | ||
run: | | ||
luarocks install luacheck | ||
luarocks install vusted | ||
vusted ./tests |
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,3 @@ | ||
{ | ||
"diagnostics.disable": ["undefined-field"] | ||
} |
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,7 @@ | ||
FROM archlinux | ||
WORKDIR /dracula | ||
COPY . . | ||
RUN pacman -Syu --noconfirm | ||
RUN pacman -S luarocks neovim gcc lua51 --noconfirm | ||
RUN luarocks install luacheck && luarocks --lua-version=5.1 install vusted | ||
CMD [ "vusted", "./tests" ] |
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
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
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,7 @@ | ||
column_width = 80 | ||
line_endings = "Unix" | ||
indent_type = "Spaces" | ||
indent_width = 2 | ||
quote_style = "AutoPreferSingle" | ||
call_parentheses = "Always" | ||
collapse_simple_statement = "ConditionalOnly" |
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,27 @@ | ||
#!/usr/bin/python3 | ||
|
||
import subprocess | ||
import sys | ||
|
||
|
||
def run_commands(commands): | ||
for command in commands: | ||
process = subprocess.Popen(command, shell=True) | ||
process.wait() | ||
|
||
|
||
if __name__ == '__main__': | ||
install_dependencies = False | ||
if len(sys.argv) > 1 and sys.argv[1] == '--install': | ||
install_dependencies = True | ||
|
||
commands = [] | ||
if install_dependencies: | ||
commands.append('cargo install stylua') | ||
commands.append('sudo luarocks install luacheck') | ||
commands.append('sudo luarocks install vusted') | ||
|
||
commands.append('stylua . -f ./stylua.toml') | ||
commands.append('vusted ./tests') | ||
|
||
run_commands(commands) |
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,19 @@ | ||
describe('Autocmd', function() | ||
test('Solarized Highlights is being created', function() | ||
vim.cmd.colorscheme('solarized') | ||
local todo = { | ||
'TODO', | ||
'WARN', | ||
'TEST', | ||
'PERF', | ||
'NOTE', | ||
'HACK', | ||
'FIX', | ||
} | ||
|
||
for _, name in pairs(todo) do | ||
local output = vim.api.nvim_get_hl(0, { name = 'SolarizedToken' .. name }) | ||
assert.is_true(type(output.fg) == 'number') | ||
end | ||
end) | ||
end) |
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 @@ | ||
local colorhelper = require('solarized.utils.colors') | ||
local solarized_palette = require('solarized.palette') | ||
|
||
describe('Color Conversions', function() | ||
test('Convert hex to RGB', function() | ||
local colors = solarized_palette.get_colors() | ||
local red, green, blue = colorhelper.hex_to_rgb(colors.yellow) | ||
local expect = { red = 181, green = 137, blue = 0 } | ||
|
||
assert.are.same(expect.red, red) | ||
assert.are.same(expect.green, green) | ||
assert.are.same(expect.blue, blue) | ||
end) | ||
|
||
test('Convert RGB to hex', function() | ||
local colors = solarized_palette.get_colors() | ||
local yellow = { red = 181, green = 137, blue = 0 } | ||
local output = colorhelper.rgb_to_hex(yellow.red, yellow.green, yellow.blue) | ||
local expect = colors.yellow | ||
|
||
assert.equals(expect, string.lower(output)) | ||
end) | ||
|
||
test('Darken the color by percentage', function() | ||
local colors = solarized_palette.get_colors() | ||
local output = colorhelper.darken(colors.green, 100) | ||
local expect = '#000000' | ||
assert.equals(expect, output) | ||
end) | ||
|
||
test('Lighten the color by percentage', function() | ||
local colors = solarized_palette.get_colors() | ||
local output = colorhelper.lighten(colors.green, 100) | ||
local expect = '#ffffff' | ||
assert.equals(expect, output) | ||
end) | ||
|
||
test('Blend colors', function() | ||
local blend = require('solarized.utils.colors').blend | ||
local alpha = 0.15 | ||
local expect = '#27383f' | ||
|
||
local output = blend('#73daca', '#1a1b26', alpha) | ||
|
||
assert.equals(output, expect) | ||
end) | ||
end) |
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,34 @@ | ||
describe('Configuration', function() | ||
local default_config = require('solarized.config').default_config() | ||
|
||
test('Default configuration', function() | ||
local expect = 'table' | ||
|
||
assert.equals(expect, type(default_config)) | ||
end) | ||
|
||
test('Unique configuration table instances', function() | ||
local config1 = require('solarized.config').default_config() | ||
local config2 = require('solarized.config').default_config() | ||
|
||
assert.are_not.equals(config1, config2) | ||
end) | ||
|
||
test('Extend default configuration', function() | ||
local user_config = { | ||
transparent = true, | ||
styles = {}, | ||
} | ||
local config = vim.tbl_deep_extend('force', default_config, user_config) | ||
local expect = 'table' | ||
local expect2 = true | ||
|
||
assert.equals(expect, type(config.styles.comments)) | ||
assert.equals(expect, type(config.styles.functions)) | ||
assert.equals(expect, type(config.styles.variables)) | ||
assert.equals(expect, type(config.styles.numbers)) | ||
assert.equals(expect, type(config.colors)) | ||
assert.equals(expect, type(config.highlights)) | ||
assert.equals(expect2, config.transparent) | ||
end) | ||
end) |
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,30 @@ | ||
local utils = require('solarized.utils.test') | ||
local to_hex = utils.to_hex | ||
|
||
describe('Initialization', function() | ||
setup(function() | ||
vim.o.background = 'light' | ||
vim.cmd.colorscheme('solarized') | ||
end) | ||
|
||
test('Loads without encountering any errors', function() | ||
assert.equal('solarized', vim.g.colors_name) | ||
assert.is_true(vim.o.termguicolors) | ||
end) | ||
|
||
test('Background is set to light', function() | ||
local output = vim.api.nvim_get_hl(0, { name = 'Normal' }) | ||
local expect = '#fdf6e3' | ||
|
||
assert.equals(expect, to_hex(output.bg)) | ||
end) | ||
|
||
test('Selenized is being loaded', function() | ||
require('solarized').setup({ palette = 'selenized' }) | ||
vim.cmd.colorscheme('solarized') | ||
local output = vim.api.nvim_get_hl(0, { name = 'Normal' }) | ||
local expect = '#fbf3db' | ||
|
||
assert.equals(expect, to_hex(output.bg)) | ||
end) | ||
end) |
Oops, something went wrong.