Skip to content

chore: auto-sync

chore: auto-sync #5

Workflow file for this run

name: Test
on:
push:
branches: [main]
paths:
- 'src/**'
- 'lua/**'
- 'tests/**'
- '.busted'
- '.github/workflows/test.yml'
pull_request:
branches: [main]
paths:
- 'src/**'
- 'lua/**'
- 'tests/**'
workflow_dispatch:
jobs:
test:
name: Run Tests (${{ matrix.os }}, ${{ matrix.lua-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
lua-version: ["5.1", "5.2", "5.3", "5.4", "5.5", "luajit"]
os: ["ubuntu-latest"]
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup MSVC Developer Command Prompt
if: ${{ runner.os == 'Windows' && matrix['lua-version'] != 'luajit' }}
uses: ilammy/msvc-dev-cmd@v1
- name: Install Lua
uses: luarocks/gh-actions-lua@master
with:
luaVersion: ${{ matrix.lua-version }}
- name: Install LuaRocks
uses: luarocks/gh-actions-luarocks@master
- name: Run custom setup commands
shell: bash
run: |
SETUP_COMMANDS=$(jq -r '.["setup-commands"] // [] | join("\n")' .github/config.json)
if [ -n "$SETUP_COMMANDS" ]; then
bash -c "$SETUP_COMMANDS"
fi
- name: Resolve Rockspec
shell: bash
run: |
PACKAGE_NAME=$(jq -r '.package' .github/config.json)
ROCKSPEC="${PACKAGE_NAME}-scm-1.rockspec"
if [ ! -f "$ROCKSPEC" ]; then
echo "No rockspec file found: $ROCKSPEC" >&2
exit 1
fi
echo "rockspec=$ROCKSPEC" >> "$GITHUB_ENV"
- name: Install package (POSIX)
if: ${{ runner.os != 'Windows' }}
shell: bash
run: luarocks install "$rockspec"
- name: Install package (Windows)
if: ${{ runner.os == 'Windows' }}
shell: pwsh
run: luarocks install $env:rockspec
- name: Run Tests
if: hashFiles('**/*.test.lua') != ''
run: |
luarocks install busted
busted