76 lines
2.1 KiB
YAML
76 lines
2.1 KiB
YAML
name: 'Automatic Test'
|
|
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: |
|
|
pip install fonttools
|
|
- name: Check all characters are in the font
|
|
shell: python
|
|
run: |
|
|
from fontTools.ttLib import TTFont
|
|
from pathlib import Path
|
|
|
|
font = TTFont('parts/fonts/proportional.otf')
|
|
keys = set(font.getBestCmap().keys())
|
|
|
|
missing = []
|
|
for file in Path('parts/language').glob('*.lua'):
|
|
for i, line in enumerate(file.read_text().splitlines()):
|
|
for char in line:
|
|
if ord(char) not in keys:
|
|
missing.append((char, file, i+1))
|
|
|
|
if missing:
|
|
print('Missing characters:')
|
|
for char, file, i in missing:
|
|
print(f"'{char}'({ord(char):x}) in {file} at line {i} " \
|
|
f"(${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/{file}#L{i})")
|
|
exit(1)
|
|
else:
|
|
print('All characters are present in the font.')
|
|
- uses: ./.github/actions/build-love
|
|
with:
|
|
file-path: Techmino.love
|
|
- name: Download love
|
|
shell: bash
|
|
run: |
|
|
curl -L https://github.com/love2d/love/releases/download/11.3/love-11.3-linux-x86_64.tar.gz | tar xz
|
|
- name: Prepare PulseAudio
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install pulseaudio pulseaudio-utils pavucontrol alsa-oss alsa-utils -y
|
|
- name: Run automated test
|
|
uses: GabrielBB/xvfb-action@v1
|
|
with:
|
|
run: |
|
|
./dest/love Techmino.love --test
|