-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
108 lines (106 loc) · 4.81 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: luals-dbm-checker
description: Runs the LuaLS check command with the DBM plugin loaded.
branding:
icon: check-square
color: yellow
inputs:
extra-args:
description: "Extra parameters passed to LuaLS"
default: ""
luals-repo:
description: "Where to clone lua-language-server from"
default: LuaLS/lua-language-server
luals-ref:
description: "Which branch, tag, or commit to use for LuaLS"
default: "3.13.5"
luals-check-dir:
description: "Directory to check"
required: true
runs:
using: composite
steps:
- name: Cache LuaLS
id: cache-luals
uses: actions/cache@v4
env:
cache-name: luals
with:
path: ${{ github.workspace }}/luals
key: ${{ inputs.luals-repo }}/${{ inputs.luals-ref }}
- if: ${{ steps.cache-luals.outputs.cache-hit != 'true' }}
name: "Install LuaLS build dependencies"
shell: sh
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y ninja-build
- if: ${{ steps.cache-luals.outputs.cache-hit != 'true' }}
name: Checkout LuaLS
uses: actions/checkout@v4
with:
repository: ${{ inputs.luals-repo }}
ref: ${{ inputs.luals-ref }}
submodules: recursive
path: ./luals
- if: ${{ steps.cache-luals.outputs.cache-hit != 'true' }}
name: Compile LuaLS
shell: bash
run: |
cd ${{ github.workspace }}/luals
pushd 3rd/luamake
./compile/build.sh
popd
./3rd/luamake/luamake -notest rebuild
rm -rf test # reduces cache size by ~40%
- name: Checkout LuaLS config
uses: actions/checkout@v4
with:
repository: DeadlyBossMods/LuaLS-Config
path: ./luals-config
- name: Checkout DBM main repo
uses: actions/checkout@v4
with:
repository: DeadlyBossMods/DeadlyBossMods
path: ./DBM-Main-Repo
- name: Checkout vscode-wow-api
uses: actions/checkout@v4
with:
repository: Ketho/vscode-wow-api
path: ./vscode-wow-api
ref: 0.18.2
- name: Run checks
shell: bash
run: |
cd luals
# Only add the main DBM repo as an external library if we are not checking the DBM main repo itself
# If we check the main repo we still need it declared as a library, but it needs to be in the same path and not a separate copy
if [[ -d "${{ inputs.luals-check-dir }}/DBM-Core" ]]; then
libs="${{ inputs.luals-check-dir }}/DBM-Core,${{ inputs.luals-check-dir }}/DBM-StatusBarTimers,${{ inputs.luals-check-dir }}/DBM-Test,${{ github.workspace }}/vscode-wow-api/Annotations"
else
libs="${{ github.workspace }}/DBM-Main-Repo/DBM-Core,${{ github.workspace }}/DBM-Main-Repo/DBM-StatusBarTimers,${{ github.workspace }}/DBM-Main-Repo/DBM-Test,${{ github.workspace }}/vscode-wow-api/Annotations"
fi
rm -f log/check.json
./bin/lua-language-server \
--checklevel Information \
--configpath "${{ github.workspace }}/luals-config/Check-Config.lua" \
--dbm_libraries "$libs" \
--trust_all_plugins \
--check "${{ inputs.luals-check-dir }}" \
${{ inputs.extra-args }}
# LuaLS >= 3.9 always writes check.json, older ones only on error, normalize to 3.9 behavior
touch log/check.json
STATUS=0
if [[ $(wc -l < log/check.json) > 0 ]] ; then
STATUS=1
fi
# Warnings as readable outsputs because GitHub doesn't show any metadata in the log when emitting annotations and limits annotations to 10 or so
cat ${{ github.workspace }}/luals/log/check.json | \
jq -r 'to_entries | map(.key as $file | .value[] | {file: $file | sub("file://${{ github.workspace }}/workspace/"; ""), title: .code, line: .range.start.line, endLine: .range.end.line, col: .range.start.character, endColumn: .range.end.character, message: .message, level: (if .severity <= 1 then "Error" else "Warning" end)}) | map("\(.level): \(.file):\(.line+1):\(.col+1) \(.title) - \(.message)") | .[]' \
| tee $GITHUB_STEP_SUMMARY
if [[ $STATUS == 0 ]] ; then
echo "✅ All checks succeeded!" | tee $GITHUB_STEP_SUMMARY
fi
# GitHub annotations
cat ${{ github.workspace }}/luals/log/check.json | jq -r 'to_entries | map(.key as $file | .value[] | {file: $file | sub("file://${{ github.workspace }}/workspace/"; ""), title: .code, line: .range.start.line, endLine: .range.end.line, col: .range.start.character, endColumn: .range.end.character, message: .message | gsub("\n"; "\\\\n"; "m"), level: (if .severity <= 1 then "error" else "warning" end)}) | map("::\(.level) file=\(.file),line=\(.line+1),endLine=\(.line+1),col=\(.col+1),endColumn=\(.endColumn+1),title=\(.title)::\(.message)") | .[]'
rm -rf log/*
exit $STATUS