From efad9dc941cdcf9594d684127d75194aa07b8fc8 Mon Sep 17 00:00:00 2001 From: hbeni Date: Tue, 19 Mar 2024 18:32:06 +0100 Subject: [PATCH] CodeQL: Add syntax checking for php and lua --- .github/workflows/codeql-analysis.yml | 82 +++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 968f7c6..82ca58d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -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 > $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/luacheck@v1.1.2 + # continue-on-error: true + #- name: Evalu + #- name: label when luacheck_step_id fails + # if: ${{ steps.luacheck_step_id.outcome == 'failure' }} + # uses: andymckay/labeler@1.0.4 + # with: + # add-labels: "commit-message-rule-violation" + #- name: label removal when luacheck_step_id succeeds + # if: ${{ steps.luacheck_step_id.outcome == 'success' }} + # uses: andymckay/labeler@1.0.4 + # 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;