1- name : Linting and Tests
2-
3- on : [push, pull_request]
1+ name : build
2+ on : [push]
43
54jobs :
6- check :
5+ nattlua :
76 runs-on : ubuntu-latest
7+ container :
8+ image : debian:latest
89
910 steps :
10- - name : Check out the repo
11- uses : actions/checkout@v4
12-
13- - name : Create build image name
14- run : |
15- echo "IMAGENAME_LC=${IMAGENAME,,}" >> ${GITHUB_ENV}
16- env :
17- IMAGENAME : ' ${{ github.repository }}'
18-
19- - name : Build the Docker image
20- run : docker build .docker/alpine/ --tag ${IMAGENAME_LC}-test:lua-5.2
11+ - name : checkout the project
12+ uses : actions/checkout@v4
2113
22- - name : Run linter
23- uses : addnab/docker-run-action@v3
24- with :
25- image : ${{ env.IMAGENAME_LC }}-test:lua-5.2
26- options : -v ${{ github.workspace }}:/github/workspace
14+ - name : Install build dependencies
2715 run : |
28- echo "Static luacheck ljsocket.lua"
29- luacheck --config .luacheckrc \
30- ljsocket.lua
31- echo "Linting ljsocket.lua"
32- lualint -s ljsocket.lua
16+ apt-get update
17+ apt-get install -y build-essential git
3318
34- - name : Bytecode verification
35- uses : addnab/docker-run-action@v3
36- with :
37- image : ${{ env.IMAGENAME_LC }}-test:lua-5.2
38- options : -v ${{ github.workspace }}:/github/workspace
19+ - name : Build and install LuaJIT from source
3920 run : |
40- echo "Checking JIT bytecode for ljsocket.lua"
41- luajit -bl ljsocket.lua /dev/null
42- echo "Checking bytecode for ljsocket.lua"
43- luac -p ljsocket.lua
44-
45- - name : Run unit tests
46- uses : addnab/docker-run-action@v3
47- with :
48- image : ${{ env.IMAGENAME_LC }}-test:lua-5.2
49- options : -v ${{ github.workspace }}:/github/workspace
21+ cd /tmp
22+ git clone https://luajit.org/git/luajit.git
23+ cd luajit
24+ make
25+ make install
26+
27+ # Create symlink from versioned binary to 'luajit'
28+ LUAJIT_BIN=$(find /usr/local/bin -name 'luajit-*' -type f | head -n 1)
29+ if [ -n "$LUAJIT_BIN" ]; then
30+ ln -sf "$LUAJIT_BIN" /usr/local/bin/luajit
31+ fi
32+
33+ ldconfig
34+
35+ - name : Verify LuaJIT installation
36+ run : |
37+ which luajit
38+ luajit -v
39+
40+ - name : Run tests
5041 run : |
51- lunit -i `which luajit` $(find test -name "*_test.lua")
52- luacov ljsocket.lua
42+ luajit test/run.lua
0 commit comments