From db47528a37a8348d74fbb43a28da91595f88d02a Mon Sep 17 00:00:00 2001 From: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Date: Sat, 7 May 2022 12:30:27 +0800 Subject: [PATCH] check syntax validity in automatic test (#701) --- .github/actions/automatic-test/action.yml | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/actions/automatic-test/action.yml b/.github/actions/automatic-test/action.yml index efde468f..617f7fdd 100644 --- a/.github/actions/automatic-test/action.yml +++ b/.github/actions/automatic-test/action.yml @@ -4,6 +4,30 @@ description: 'Check for obvious errors.' runs: using: "composite" steps: + - name: Install lua + shell: bash + run: | + sudo apt-get install lua5.3 -y + - name: Check all lua files are valid + shell: lua {0} + run: | + local files = assert(io.popen "find . -name '*.lua' -not -path '*/.git/*'") + local errors = 0 + for file in files:lines() do + local f, error = loadfile(file) + if not f then + print(error) + errors = errors + 1 + end + end + files:close() + + if errors > 0 then + print(('%d syntax error(s) found.'):format(errors)) + os.exit(1) + else + print('No syntax error found.') + end - name: Prepare FontTools shell: bash run: |