diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..20ecec04 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: ci +on: + push: + pull_request: + workflow_dispatch: +jobs: + ci: + strategy: + fail-fast: false # https://github.com/actions/runner-images#available-images + matrix: # https://www.lua.org/versions.html + os: [macos-26, macos-26-intel, ubuntu-26.04, ubuntu-26.04-arm] + runs-on: ${{ matrix.os }} + steps: + - run: echo "${{ runner.os }} on ${{ runner.arch }}" + - if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y luarocks + - if: runner.os == 'macOS' + run: brew install luarocks + - uses: actions/checkout@v7 + - uses: actions/setup-python@v6 + with: + python-version: 3.x + pip-install: --editable . + # Dependencies installed. Start testing. + - shell: python # Sanity check + run: | + import lua + lg = lua.globals() + print(f"{lg = }") + print(f"{lg.string = }") + print(f"{lg.string.lower = }") + print(f"{lg.string.lower('Hello world!') = }") + assert lg.string.lower('Hello world!') != 'Hello world!' + assert lg.string.lower('Hello world!') == 'hello world!' + - run: python -m doctest tests/test_lua.py || true + - run: pip install pytest + - run: pytest || true + - run: pytest --doctest-modules || true diff --git a/setup.py b/setup.py index 93d6cf0f..302de90e 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ #!/usr/bin/python -import sys import os +import sys +from distutils.sysconfig import get_python_lib if sys.version > '3': PY3 = True @@ -9,11 +10,13 @@ PY3 = False if PY3: - import subprocess as commands + from setuptools import Extension, setup + from subprocess import getstatusoutput + from sysconfig import get_config_var, get_python_version else: - import commands -from distutils.core import setup, Extension -from distutils.sysconfig import get_config_var, get_python_lib, get_python_version + from commands import getstatusoutput + from distutils.core import setup, Extension + from distutils.sysconfig import get_config_var, get_python_version if os.path.isfile("MANIFEST"): os.unlink("MANIFEST") @@ -22,7 +25,7 @@ LUAVERSION = None for version in lua_versions: - presult, poutput = commands.getstatusoutput("pkg-config --exists lua" + str(version)) + presult, poutput = getstatusoutput("pkg-config --exists lua" + str(version)) if presult == 0: LUAVERSION = version break @@ -43,7 +46,7 @@ def pkgconfig(*packages): combined_pcoutput = '' for package in packages: - (pcstatus, pcoutput) = commands.getstatusoutput( + (pcstatus, pcoutput) = getstatusoutput( "pkg-config --libs --cflags %s" % package) if pcstatus == 0: combined_pcoutput += ' ' + pcoutput