From 3b9830336ee3c8df7f1d0c857df0b739b11ee1a5 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Mon, 25 Sep 2023 16:30:26 -0500 Subject: [PATCH] Add luau-lsp analyze job to CI workflow --- .github/workflows/ci.yaml | 18 ++++++++++++++++-- .justfile | 13 +++++++++++-- .vscode/settings.json | 6 ------ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a0271b4..3cd2189 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,8 +17,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - submodules: true - name: Install Rust uses: dtolnay/rust-toolchain@stable @@ -34,6 +32,22 @@ jobs: - name: Check Formatting 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: needs: ["fmt"] strategy: diff --git a/.justfile b/.justfile index d29e1c3..99ea8ae 100644 --- a/.justfile +++ b/.justfile @@ -45,7 +45,7 @@ test-bin *ARGS: fmt: #!/usr/bin/env bash set -euo pipefail - stylua scripts tests types \ + stylua .lune scripts tests types \ --glob "tests/**/*.luau" \ --glob "!tests/roblox/rbx-test-files/**" cargo fmt @@ -55,11 +55,20 @@ fmt: fmt-check: #!/usr/bin/env bash set -euo pipefail - stylua scripts tests types \ + stylua .lune scripts tests types \ --glob "tests/**/*.luau" \ --glob "!tests/roblox/rbx-test-files/**" 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 [no-exit-message] zip-release TARGET_TRIPLE: diff --git a/.vscode/settings.json b/.vscode/settings.json index 9652462..e7ff588 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,21 +1,15 @@ { - // Luau - disable Roblox features, enable Lune typedefs & requires "luau-lsp.sourcemap.enabled": false, "luau-lsp.types.roblox": false, "luau-lsp.require.mode": "relativeToFile", "luau-lsp.require.directoryAliases": { "@lune/": "./types/" }, - // Luau - ignore type defs file in docs dir and dev scripts we use "luau-lsp.ignoreGlobs": [ - "docs/*.d.luau", - "packages/lib-roblox/scripts/*.luau", "tests/roblox/rbx-test-files/**/*.lua", "tests/roblox/rbx-test-files/**/*.luau" ], - // Rust "rust-analyzer.check.command": "clippy", - // Formatting "editor.formatOnSave": true, "stylua.searchParentDirectories": true, "prettier.tabWidth": 2,