Skip to content

Commit

Permalink
CodeQL: Add syntax checking for php and lua
Browse files Browse the repository at this point in the history
  • Loading branch information
hbeni committed Mar 20, 2024
1 parent 104da43 commit 8096c2e
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,60 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2


#
# Syntax checking
#
analyze-php:
name: Analyze (php)
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@main
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

- name: Check PHP syntax errors
uses: overtrue/phplint@main
with:
path: server/statuspage/
options: --exclude=vendor

analyze-lua:
name: Analyze (lua)
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@main
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

- name: Setup programs
run: |
sudo apt-get -y install lua5.1 luajit lua-check
#- name: Check LUA syntax errors
# run: |
# find . -name '*.lua' -print > luacheck.list
# while read file; do echo "LuaLintCheck: $file"; luac -p "$file"; done <luacheck.list

- name: Check LUA syntax errors
# invoke luacheck, but make the run-action return only with errors, not with warnings (i.e. RC>1)
continue-on-error: true
run: |
luacheck . && lrc=$? || lrc=$?
echo "LUACHECK_RC=$lrc" >> $GITHUB_ENV
- name: Evaluate luacheck return code
run: |
r=0
if [[ "${{env.LUACHECK_RC}}" -gt 1 ]]; then r=1; fi
echo "LUACHECK returned ${{env.LUACHECK_RC}}, translated to step_rc=$r"
exit $r

0 comments on commit 8096c2e

Please sign in to comment.