-
-
Notifications
You must be signed in to change notification settings - Fork 2
115 lines (95 loc) · 3.27 KB
/
check.yml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Check
on:
push:
branches:
- main
- 'renovate/**'
paths:
- .github/workflows/check.yml
- 'src/**'
- 'include/**'
- 'lib/**'
- '**.rockspec'
- '**.lua'
pull_request:
branches:
- main
paths:
- .github/workflows/check.yml
- 'src/**'
- 'include/**'
- 'lib/**'
- '**.rockspec'
- '**.lua'
workflow_dispatch:
workflow_call:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Run clang-format
run: |
# "notify" me of newer clang-format version
if command -v clang-format-16 &> /dev/null; then
echo "clang-format-16 is available"
exit 2
fi
shopt -s nullglob
files=(src/*.c src/**/*.c include/*.h include/**/*.h)
if [[ "${#files[@]}" -eq 0 ]]; then
echo "No files found"
exit 1
fi
clang-format-15 --verbose --dry-run --Werror "${files[@]}"
- name: Setup Lua
uses: leafo/gh-actions-lua@35bcb06abec04ec87df82e08caa84d545348536e # v10.0.0
- name: Run clang-tidy
run: |
# "notify" me of newer clang-tidy version
if command -v clang-tidy-16 &> /dev/null; then
echo "clang-tidy-16 is available"
exit 2
fi
shopt -s nullglob
files=(src/*.c src/**/*.c include/*.h include/**/*.h)
if [[ "${#files[@]}" -eq 0 ]]; then
echo "No files found"
exit 1
fi
clang-tidy-15 --extra-arg="-I.lua/include" --warnings-as-errors="*" "${files[@]}"
- name: Setup LuaRocks
uses: hishamhm/gh-actions-luarocks@master
- name: Run luacheck
run: luarocks install luacheck && luacheck . --no-cache --formatter TAP --include-files "**/*.lua" "**/*.rockspec" --exclude-files .lua .luarocks
test:
name: Test
needs: lint
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
lua_version: [ '5.1', '5.2', '5.3', '5.4', 'luajit' ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Microsoft Visual C++ Developer Command Prompt
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
# Will be ignored on non-Windows platforms anyway, but it's better to just skip it
if: matrix.os == 'windows-latest'
- name: Setup Lua
uses: leafo/gh-actions-lua@35bcb06abec04ec87df82e08caa84d545348536e # v10.0.0
with:
luaVersion: ${{ matrix.lua_version }}
- name: Setup LuaRocks
uses: hishamhm/gh-actions-luarocks@master
- name: Build fenster
run: luarocks make
# Currently does not work for LuaJIT on Windows (lua library not found)
if: matrix.os != 'windows-latest' || matrix.lua_version != 'luajit'
- name: Run tests
run: luarocks test -- --verbose --output TAP --exclude-tags needsdisplay
# Currently does not work for Windows (can't import 'fenster')
if: matrix.os != 'windows-latest'