travis: Add luac test

develop
lethosor 2015-02-23 18:44:36 -05:00
parent 3c9431128e
commit 0aa9866089
2 changed files with 33 additions and 1 deletions

@ -1,6 +1,12 @@
language: cpp language: cpp
env:
matrix:
-LUA_VERSION=5.2
before_install:
- sudo apt-get install lua$LUA_VERSION
script: script:
- python travis/lint.py
- python travis/pr-check-base.py - python travis/pr-check-base.py
- python travis/lint.py
- python travis/luac.py
notifications: notifications:
email: false email: false

@ -0,0 +1,26 @@
import os, sys, subprocess
def main():
root_path = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else '.')
if not os.path.exists(root_path):
print('Nonexistent path: %s' % root_path)
sys.exit(2)
err = False
for cur, dirnames, filenames in os.walk(root_path):
parts = cur.replace('\\', '/').split('/')
if '.git' in parts or 'depends' in parts:
continue
if '.git' in cur:
print(parts)
for filename in filenames:
if not filename.endswith('.lua'):
continue
full_path = os.path.join(cur, filename)
try:
subprocess.call(['luac' + os.environ.get('LUA_VERSION', ''), '-p', full_path])
except subprocess.CalledProcessError:
err = True
sys.exit(int(err))
if __name__ == '__main__':
main()