Skip to content

Commit

Permalink
Add lualint and jit bytecode check to test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vwout committed Jan 13, 2024
1 parent ba96383 commit 2676e51
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
8 changes: 7 additions & 1 deletion .docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM alpine:3.16
FROM alpine:3.19

ARG LUA_VERSION=5.2
ARG LUA_MODULES="lunit luacheck luacov luacov-html"

RUN apk add --no-cache \
bash \
luajit \
lua${LUA_VERSION} \
lua${LUA_VERSION}-bit32 \
lua${LUA_VERSION}-filesystem \
Expand All @@ -24,6 +25,11 @@ RUN apk add --no-cache \
\
&& apk del .build-deps

ADD https://github.com/philips/lualint/raw/master/lualint /bin/lualint
RUN chmod +x /bin/lualint \
&& \
ln -s /usr/bin/luac${LUA_VERSION} /usr/bin/luac

RUN mkdir -p /github/workspace
VOLUME ["/github/workspace"]

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
- uses: actions/checkout@v3

- name: Create release archive
run: zip ${{ github.event.repository.name }}-${{ github.ref }}.zip LICENSE obs-visca-control.lua libvisca.lua ljsocket.lua
run: zip ${{ github.event.repository.name }}-${{ github.ref }}.zip \
LICENSE obs-visca-control.lua libvisca.lua ljsocket.lua

- name: Release
uses: softprops/action-gh-release@v1
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,37 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v3
- name: Build the Docker image
run: docker build .docker/alpine/ --tag vwout/obs-visca-control-lua:5.2
run: docker build .docker/alpine/ --tag vwout/obs-visca-control-test:lua-5.2
- name: Run linter
uses: addnab/docker-run-action@v3
with:
image: vwout/obs-visca-control-lua:5.2
image: vwout/obs-visca-control-test:lua-5.2
options: -v ${{ github.workspace }}:/github/workspace
run: |
echo "Static luacheck libvisca.lua, obs-visca-control.lua"
luacheck --config .luacheckrc \
libvisca.lua \
obs-visca-control.lua
echo "Linting libvisca.lua, obs-visca-control.lua"
lualint -s libvisca.lua -s obs-visca-control.lua
- name: Bytecode verification
uses: addnab/docker-run-action@v3
with:
image: vwout/obs-visca-control-test:lua-5.2
options: -v ${{ github.workspace }}:/github/workspace
run: |
echo "Checking JIT bytecode for libvisca.lua"
luajit -bl libvisca.lua /dev/null
echo "Checking JIT bytecode for obs-visca-control.lua"
luajit -bl obs-visca-control.lua /dev/null
echo "Checking bytecode for libvisca.lua"
luac -p libvisca.lua
echo "Checking bytecode for obs-visca-control.lua"
luac -p obs-visca-control.lua
- name: Run unit tests
uses: addnab/docker-run-action@v3
with:
image: vwout/obs-visca-control-lua:5.2
image: vwout/obs-visca-control-test:lua-5.2
options: -v ${{ github.workspace }}:/github/workspace
run: |
find test -name "*_test.lua" | xargs lunit
Expand Down

0 comments on commit 2676e51

Please sign in to comment.