-
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (68 loc) · 2.01 KB
/
Copy pathtest.yml
File metadata and controls
78 lines (68 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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