From faca8ae90ab7e6acba8abb6063ddfc462a11550b Mon Sep 17 00:00:00 2001 From: Mark Marks Date: Sun, 20 Oct 2024 00:18:52 +0200 Subject: [PATCH 1/7] ci: Add luau-analyze step --- .github/workflows/lint.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 63e8180c..d71eb390 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,9 +1,9 @@ -name: Stylua +name: Lint on: [push, pull_request, workflow_dispatch] jobs: - run: + style: name: Run Stylua runs-on: ubuntu-latest @@ -18,3 +18,18 @@ jobs: version: latest # NOTE: we recommend pinning to a specific version in case of formatting changes # CLI arguments args: --check ./src + + analyze: + name: Run Luau Analyze + runs-on: ubuntu-latest + + steps: + - name: Checkout Project + uses: actions/checkout@v4 + + - name: Install Luau + uses: encodedvenom/install-luau@v2.1 + + - name: Analyze + run: | + luau-analyze src From d7a4d2e98a50683fc6983eec14fac1418b914a8f Mon Sep 17 00:00:00 2001 From: Mark Marks Date: Sun, 20 Oct 2024 00:46:35 +0200 Subject: [PATCH 2/7] actions: Separate styling and analysis into different workflows --- .github/workflows/analysis.yaml | 19 +++++++++++++++++++ .github/workflows/{lint.yml => styling.yaml} | 19 ++----------------- .../workflows/{ci.yaml => unit-testing.yaml} | 0 3 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/analysis.yaml rename .github/workflows/{lint.yml => styling.yaml} (59%) rename .github/workflows/{ci.yaml => unit-testing.yaml} (100%) diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml new file mode 100644 index 00000000..e24addd1 --- /dev/null +++ b/.github/workflows/analysis.yaml @@ -0,0 +1,19 @@ +name: Analysis + +on: [push, pull_request, workflow_dispatch] + +jobs: + run: + name: Run Luau Analyze + runs-on: ubuntu-latest + + steps: + - name: Checkout Project + uses: actions/checkout@v4 + + - name: Install Luau + uses: encodedvenom/install-luau@v2.1 + + - name: Analyze + run: | + luau-analyze src \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/styling.yaml similarity index 59% rename from .github/workflows/lint.yml rename to .github/workflows/styling.yaml index d71eb390..24d039e2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/styling.yaml @@ -1,9 +1,9 @@ -name: Lint +name: Styling on: [push, pull_request, workflow_dispatch] jobs: - style: + run: name: Run Stylua runs-on: ubuntu-latest @@ -18,18 +18,3 @@ jobs: version: latest # NOTE: we recommend pinning to a specific version in case of formatting changes # CLI arguments args: --check ./src - - analyze: - name: Run Luau Analyze - runs-on: ubuntu-latest - - steps: - - name: Checkout Project - uses: actions/checkout@v4 - - - name: Install Luau - uses: encodedvenom/install-luau@v2.1 - - - name: Analyze - run: | - luau-analyze src diff --git a/.github/workflows/ci.yaml b/.github/workflows/unit-testing.yaml similarity index 100% rename from .github/workflows/ci.yaml rename to .github/workflows/unit-testing.yaml From b1bc689cbd6177a274aefc1c9e17fc7d9a4a84ac Mon Sep 17 00:00:00 2001 From: EncodedVenom <32179912+EncodedVenom@users.noreply.github.com> Date: Sat, 19 Oct 2024 18:52:16 -0400 Subject: [PATCH 3/7] Update analysis.yaml Should make it warn instead of error. --- .github/workflows/analysis.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml index e24addd1..de5c2ae9 100644 --- a/.github/workflows/analysis.yaml +++ b/.github/workflows/analysis.yaml @@ -15,5 +15,6 @@ jobs: uses: encodedvenom/install-luau@v2.1 - name: Analyze + continue-on-error: true run: | - luau-analyze src \ No newline at end of file + luau-analyze src From 4c9c1a50ce6317eff510ae05194f70112a9f86db Mon Sep 17 00:00:00 2001 From: EncodedVenom <32179912+EncodedVenom@users.noreply.github.com> Date: Sat, 19 Oct 2024 19:05:11 -0400 Subject: [PATCH 4/7] Testing warning labels --- .github/workflows/analysis.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml index de5c2ae9..06612f72 100644 --- a/.github/workflows/analysis.yaml +++ b/.github/workflows/analysis.yaml @@ -17,4 +17,14 @@ jobs: - name: Analyze continue-on-error: true run: | - luau-analyze src + output=$(luau-analyze src) + + # Parse the output and generate GitHub Actions warnings + echo "$output" | while IFS= read -r line; do + if [[ $line =~ (.+)\(([0-9]+),([0-9]+)\):\ (.*) ]]; then + file="${BASH_REMATCH[1]}" + line_number="${BASH_REMATCH[2]}" + message="${BASH_REMATCH[4]#TypeError: }" + echo "::warning file=$file,line=$line_number,col=0::$message" + fi + done From 4b2f6a593400dc52ab2a5d7e002088e75cb78ae1 Mon Sep 17 00:00:00 2001 From: EncodedVenom <32179912+EncodedVenom@users.noreply.github.com> Date: Sat, 19 Oct 2024 19:16:21 -0400 Subject: [PATCH 5/7] Update analysis.yaml --- .github/workflows/analysis.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml index 06612f72..81561dac 100644 --- a/.github/workflows/analysis.yaml +++ b/.github/workflows/analysis.yaml @@ -15,9 +15,8 @@ jobs: uses: encodedvenom/install-luau@v2.1 - name: Analyze - continue-on-error: true run: | - output=$(luau-analyze src) + output=$(luau-analyze src || true) # Suppress errors for now. # Parse the output and generate GitHub Actions warnings echo "$output" | while IFS= read -r line; do From 245878531697d6ee28f0e0ccf9e3411ba888bf63 Mon Sep 17 00:00:00 2001 From: EncodedVenom <32179912+EncodedVenom@users.noreply.github.com> Date: Sat, 19 Oct 2024 19:26:28 -0400 Subject: [PATCH 6/7] Hopefully better parsing --- .github/workflows/analysis.yaml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml index 81561dac..d372e573 100644 --- a/.github/workflows/analysis.yaml +++ b/.github/workflows/analysis.yaml @@ -20,10 +20,17 @@ jobs: # Parse the output and generate GitHub Actions warnings echo "$output" | while IFS= read -r line; do - if [[ $line =~ (.+)\(([0-9]+),([0-9]+)\):\ (.*) ]]; then - file="${BASH_REMATCH[1]}" - line_number="${BASH_REMATCH[2]}" - message="${BASH_REMATCH[4]#TypeError: }" - echo "::warning file=$file,line=$line_number,col=0::$message" - fi + # Check if the line contains the error format + if [[ "$line" == *"TypeError:"* ]]; then + + file_line="${line%%:*}" # Get the part before the first colon + message="${line#*: TypeError: }" # Get the message after "TypeError: " + + file="${file_line%(*}" # Get the file name (everything before the '(') + location="${file_line#*()}"; # Get the part inside parentheses (line and column) + line_number="${location%%,*}"; # Extract the line number + column_number="${location#*,}"; # Extract the column number + + echo "::warning file=${file},line=${line_number},col=${column_number}::${message}" + fi done From a0f33e53c3c9ab526eb61cbdb6c98a287bc94298 Mon Sep 17 00:00:00 2001 From: EncodedVenom <32179912+EncodedVenom@users.noreply.github.com> Date: Sat, 19 Oct 2024 19:41:28 -0400 Subject: [PATCH 7/7] Update analysis.yaml Putting this in another PR --- .github/workflows/analysis.yaml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml index d372e573..f3d07bec 100644 --- a/.github/workflows/analysis.yaml +++ b/.github/workflows/analysis.yaml @@ -17,20 +17,3 @@ jobs: - name: Analyze run: | output=$(luau-analyze src || true) # Suppress errors for now. - - # Parse the output and generate GitHub Actions warnings - echo "$output" | while IFS= read -r line; do - # Check if the line contains the error format - if [[ "$line" == *"TypeError:"* ]]; then - - file_line="${line%%:*}" # Get the part before the first colon - message="${line#*: TypeError: }" # Get the message after "TypeError: " - - file="${file_line%(*}" # Get the file name (everything before the '(') - location="${file_line#*()}"; # Get the part inside parentheses (line and column) - line_number="${location%%,*}"; # Extract the line number - column_number="${location#*,}"; # Extract the column number - - echo "::warning file=${file},line=${line_number},col=${column_number}::${message}" - fi - done