-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI pipeline configuration and supporting files
* **CI Workflow**: Add `.github/workflows/ci.yml` to configure the CI pipeline with steps for code checkout, Stylua formatting check, and Lua-Language-Server static analysis. * **Stylua Configuration**: Add `stylua.toml` to configure Stylua with indentation, line settings, and exclude `lib/cc-tweaked`. * **Lua-Language-Server Configuration**: Update `.luarc.json` to include `lib/cc-tweaked` in the workspace library and disable diagnostics for library files. * **Output Parsing Script**: Add `parse_lua_ls_output.lua` to parse Lua-Language-Server JSON output and format it for GitHub Actions UI.
- Loading branch information
Showing
4 changed files
with
95 additions
and
1 deletion.
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,39 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Stylua | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y stylua | ||
- name: Run Stylua | ||
run: | | ||
stylua --config-path .stylua.toml . --exclude lib/cc-tweaked | ||
static-analysis: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Lua-Language-Server | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y lua-language-server | ||
- name: Run Lua-Language-Server | ||
continue-on-error: true | ||
run: | | ||
lua-language-server --logpath . --check . | ||
- name: Parse Lua-Language-Server Output | ||
run: | | ||
lua parse_lua_ls_output.lua ./check.json |
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 |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
"workspace.library": [ | ||
"./lib/cc-tweaked/", | ||
"./lib/basalt/Basalt" | ||
] | ||
], | ||
"diagnostics.libraryFiles": "Disable" | ||
} |
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,41 @@ | ||
local json = require("json") | ||
|
||
local function parse_lua_ls_output(file_path) | ||
local output_file = io.open(file_path, "r") | ||
if not output_file then | ||
error("Failed to open " .. file_path) | ||
end | ||
|
||
local output_data = output_file:read("*a") | ||
output_file:close() | ||
|
||
local parsed_data = json.decode(output_data) | ||
if not parsed_data then | ||
error("Failed to parse JSON data") | ||
end | ||
|
||
local has_issues = false | ||
|
||
for _, diagnostic in ipairs(parsed_data) do | ||
print(string.format("File: %s", diagnostic.uri)) | ||
for _, issue in ipairs(diagnostic.diagnostics) do | ||
print(string.format(" Line: %d, Column: %d", issue.range.start.line, issue.range.start.character)) | ||
print(string.format(" Message: %s", issue.message)) | ||
print() | ||
has_issues = true | ||
end | ||
end | ||
|
||
if has_issues then | ||
os.exit(1) | ||
else | ||
os.exit(0) | ||
end | ||
end | ||
|
||
local file_path = arg[1] | ||
if not file_path then | ||
error("No file path provided") | ||
end | ||
|
||
parse_lua_ls_output(file_path) |
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,13 @@ | ||
# Stylua Configuration File | ||
|
||
# Indent settings | ||
indent_type = "Spaces" | ||
indent_width = 2 | ||
|
||
# Line settings | ||
column_width = 80 | ||
|
||
# Exclude files and directories | ||
exclude = { | ||
"lib/cc-tweaked/**" | ||
} |