Add luau-lsp analyze job to CI workflow

This commit is contained in:
Filip Tibell 2023-09-25 16:30:26 -05:00
parent de0a570a40
commit 3b9830336e
No known key found for this signature in database
3 changed files with 27 additions and 10 deletions

View file

@ -17,8 +17,6 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust - name: Install Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
@ -34,6 +32,22 @@ jobs:
- name: Check Formatting - name: Check Formatting
run: just fmt-check run: just fmt-check
analyze:
name: Analyze and lint Luau files
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Just
uses: extractions/setup-just@v1
- name: Install Tooling
uses: ok-nick/setup-aftman@v0.4.2
- name: Analyze
run: just analyze
ci: ci:
needs: ["fmt"] needs: ["fmt"]
strategy: strategy:

View file

@ -45,7 +45,7 @@ test-bin *ARGS:
fmt: fmt:
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
stylua scripts tests types \ stylua .lune scripts tests types \
--glob "tests/**/*.luau" \ --glob "tests/**/*.luau" \
--glob "!tests/roblox/rbx-test-files/**" --glob "!tests/roblox/rbx-test-files/**"
cargo fmt cargo fmt
@ -55,11 +55,20 @@ fmt:
fmt-check: fmt-check:
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
stylua scripts tests types \ stylua .lune scripts tests types \
--glob "tests/**/*.luau" \ --glob "tests/**/*.luau" \
--glob "!tests/roblox/rbx-test-files/**" --glob "!tests/roblox/rbx-test-files/**"
cargo fmt --check cargo fmt --check
# Analyze and lint Luau files using luau-lsp
[no-exit-message]
analyze:
#!/usr/bin/env bash
set -euo pipefail
luau-lsp analyze .lune scripts tests types \
--settings=".vscode/settings.json" \
--ignore="tests/roblox/rbx-test-files/**"
# Zips up the built binary into a single zip file # Zips up the built binary into a single zip file
[no-exit-message] [no-exit-message]
zip-release TARGET_TRIPLE: zip-release TARGET_TRIPLE:

View file

@ -1,21 +1,15 @@
{ {
// Luau - disable Roblox features, enable Lune typedefs & requires
"luau-lsp.sourcemap.enabled": false, "luau-lsp.sourcemap.enabled": false,
"luau-lsp.types.roblox": false, "luau-lsp.types.roblox": false,
"luau-lsp.require.mode": "relativeToFile", "luau-lsp.require.mode": "relativeToFile",
"luau-lsp.require.directoryAliases": { "luau-lsp.require.directoryAliases": {
"@lune/": "./types/" "@lune/": "./types/"
}, },
// Luau - ignore type defs file in docs dir and dev scripts we use
"luau-lsp.ignoreGlobs": [ "luau-lsp.ignoreGlobs": [
"docs/*.d.luau",
"packages/lib-roblox/scripts/*.luau",
"tests/roblox/rbx-test-files/**/*.lua", "tests/roblox/rbx-test-files/**/*.lua",
"tests/roblox/rbx-test-files/**/*.luau" "tests/roblox/rbx-test-files/**/*.luau"
], ],
// Rust
"rust-analyzer.check.command": "clippy", "rust-analyzer.check.command": "clippy",
// Formatting
"editor.formatOnSave": true, "editor.formatOnSave": true,
"stylua.searchParentDirectories": true, "stylua.searchParentDirectories": true,
"prettier.tabWidth": 2, "prettier.tabWidth": 2,