-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeQL: Add syntax checking for php and lua
- Loading branch information
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,3 +94,85 @@ 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 | ||
|
||
# We need to do it a little more complicated, because we need to intercept RC=1 (only warnings appeared). | ||
# I don't want the workflow to "fail" just because of syntax warnings. | ||
- name: Check LUA syntax errors | ||
# invoke luacheck, but make the run-action return only with errors, not with warnings | ||
continue-on-error: true | ||
run: | | ||
luacheck . | ||
echo "luacheck_r=$?" >> $GITHUB_OUTPUT | ||
- name: Evaluate luacheck return code | ||
run: | | ||
luacheck_r=${{ steps.generate_number.outputs.random_number }} | ||
echo "luacheck returned RC=$luacheck_r" | ||
[[ $luacheck_r -gt 1 ]] && exit 1 | ||
# For andymckay/labeler see https://github.com/marketplace/actions/simple-issue-labeler | ||
#- name: Luacheck | ||
# id: luacheck_step_id | ||
# uses: lunarmodules/[email protected] | ||
# continue-on-error: true | ||
#- name: Evalu | ||
#- name: label when luacheck_step_id fails | ||
# if: ${{ steps.luacheck_step_id.outcome == 'failure' }} | ||
# uses: andymckay/[email protected] | ||
# with: | ||
# add-labels: "commit-message-rule-violation" | ||
#- name: label removal when luacheck_step_id succeeds | ||
# if: ${{ steps.luacheck_step_id.outcome == 'success' }} | ||
# uses: andymckay/[email protected] | ||
# with: | ||
# remove-labels: "commit-message-rule-violation" | ||
|
||
#- name: Check LUA syntax errors | ||
# # invoke luacheck, but make the run-action return only with errors, not with warnings | ||
# run: | | ||
# luacheck .; echo -n "$?" >luacheck.rc | ||
# luacheck_r=$(cat luacheck.rc) | ||
# echo "luacheck returned RC=$luacheck_r" | ||
# expr $luacheck_r \> 1; |