Skip to content

Commit 229e08c

Browse files
committed
Add a GitHub Action to run pytest
1 parent 26d0ac7 commit 229e08c

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: ci
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
jobs:
7+
ci:
8+
strategy:
9+
fail-fast: false # https://github.com/actions/runner-images#available-images
10+
matrix: # https://www.lua.org/versions.html
11+
lua-version: [lua5.1, lua5.2, lua5.3, lua5.4, lua5.5]
12+
runs-on: ubuntu-26.04
13+
steps:
14+
- run: sudo apt-get update
15+
- run: sudo apt-get install -y ${{ matrix.lua-version }} lib${{ matrix.lua-version }}-dev luarocks
16+
- run: lua -h || lua -v
17+
- uses: actions/checkout@v6
18+
- uses: actions/setup-python@v6
19+
with:
20+
python-version: 3.x
21+
- run: luarocks --local make
22+
- run: pip install --upgrade pip
23+
- run: echo "${{ runner.os }} on ${{ runner.arch }}"
24+
# TODO: Always fails even with $PYTHON_LIBRT defined!
25+
# When the local pip install fails, install from PyPI
26+
- env:
27+
PYTHON_LIBRT: "amd64" # "x64"
28+
run: pip install --editable . || pip install lunatic-python-universal
29+
- shell: python # Sanity check
30+
run: |
31+
import lua
32+
lg = lua.globals()
33+
print(f"{lg = }")
34+
print(f"{lg.string = }")
35+
print(f"{lg.string.lower = }")
36+
print(f"{lg.string.lower('Hello world!') = }")
37+
assert lg.string.lower('Hello world!') != 'Hello world!'
38+
assert lg.string.lower('Hello world!') == 'hello world!'
39+
# https://github.com/bastibe/lunatic-python/blob/26d0ac7563eeedc22fb04f103e3d16cebe382f5d/src/luainpython.c#L489
40+
# TODO: Lua5.2 only: python.so: undefined symbol: luaL_loadbuffer
41+
- if: matrix.lua-version != 'lua5.2'
42+
run: lua tests/test_py.lua
43+
- run: python tests/test_lua.py || true # TODO: Segmentation fault (core dumped)
44+
- run: pip install pytest
45+
- run: pytest || true # TODO: Write some pytests --> PR #97
46+
- run: pytest --doctest-modules || true # TODO: NameError: name 'lua' is not defined

0 commit comments

Comments
 (0)