-
-
Notifications
You must be signed in to change notification settings - Fork 2
208 lines (178 loc) · 7.66 KB
/
test.yml
File metadata and controls
208 lines (178 loc) · 7.66 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
permissions:
contents: read
name: Tests
on:
push:
branches:
- main
- release/*
pull_request:
paths-ignore:
- "**.md"
env:
LUAJIT_2_0_VERSION: "v2.0.5"
LUAJIT_2_1_VERSION: "v2.1.0-beta3"
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
lua-version: ["5.1", "5.2", "5.3", "5.4", "luajit-2.0", "luajit-2.1"]
include:
- lua-version: "luajit-2.0"
luajit-version: "v2.0.5"
luajit-label: "LuaJIT 2.0.5"
- lua-version: "luajit-2.1"
luajit-version: "v2.1.0-beta3"
luajit-label: "LuaJIT 2.1.0-beta3"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Setup Lua (standard versions)
if: ${{ !contains(matrix.lua-version, 'luajit') }}
uses: leafo/gh-actions-lua@35bcb06abec04ec87df82e08caa84d545348536e # v10
with:
luaVersion: ${{ matrix.lua-version }}
- name: Setup ${{ matrix.luajit-label || 'LuaJIT' }} on Ubuntu (via apt)
if: contains(matrix.lua-version, 'luajit') && matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y luajit libluajit-5.1-dev
# Create compatibility symlinks
sudo ln -sf $(which luajit) /usr/local/bin/lua
echo "LUA_DIR=/usr" >> $GITHUB_ENV
echo "LUA_INCDIR=/usr/include/luajit-2.1" >> $GITHUB_ENV
- name: Setup ${{ matrix.luajit-label || 'LuaJIT' }} on macOS (via Homebrew)
if: contains(matrix.lua-version, 'luajit') && matrix.os == 'macos-latest'
run: |
brew install luajit
# Create symlinks for compatibility
sudo ln -sf $(which luajit) /usr/local/bin/lua
echo "$(dirname $(which luajit))" >> $GITHUB_PATH
echo "LUA_DIR=$(brew --prefix luajit)" >> $GITHUB_ENV
echo "LUA_INCDIR=$(brew --prefix luajit)/include/luajit-2.1" >> $GITHUB_ENV
- name: Setup LuaRocks
if: ${{ !contains(matrix.lua-version, 'luajit') }}
uses: leafo/gh-actions-luarocks@e65774a6386cb4f24e293dca7fc4ff89165b64c5 # v4
- name: Setup LuaRocks for ${{ matrix.luajit-label || 'LuaJIT' }} on Ubuntu
if: contains(matrix.lua-version, 'luajit') && matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y luarocks
# Create user config directory
mkdir -p ~/.luarocks
# Configure luarocks to work with luajit using --local for all operations
luarocks config --local lua_interpreter luajit
luarocks config --local variables.LUA_DIR /usr
luarocks config --local variables.LUA_INCDIR /usr/include/luajit-2.1
# Override make install to use --local flag
echo 'LUAROCKS_FLAGS=--local' >> $GITHUB_ENV
- name: Setup LuaRocks for ${{ matrix.luajit-label || 'LuaJIT' }} on macOS
if: contains(matrix.lua-version, 'luajit') && matrix.os == 'macos-latest'
run: |
brew install luarocks
# Configure luarocks to work with luajit
luarocks config lua_interpreter luajit
luarocks config variables.LUA_DIR $(brew --prefix luajit)
luarocks config variables.LUA_INCDIR $(brew --prefix luajit)/include/luajit-2.1
- name: Install SSL dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev
- name: Install SSL dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install openssl
echo "OPENSSL_DIR=$(brew --prefix openssl)" >> $GITHUB_ENV
- name: Install dependencies
shell: bash
run: |
# For Ubuntu LuaJIT, use --local flag to avoid permission issues
if [ "${{ matrix.os }}" = "ubuntu-latest" ] && [[ "${{ matrix.lua-version }}" == *"luajit"* ]]; then
echo "Installing dependencies locally for Ubuntu LuaJIT..."
luarocks install --local busted
luarocks install --local tl
luarocks install --local lua-cjson
luarocks install --local luasocket
if [ -n "$OPENSSL_DIR" ]; then
echo "Installing luasec with OPENSSL_DIR=$OPENSSL_DIR"
luarocks install --local luasec OPENSSL_DIR=$OPENSSL_DIR
else
luarocks install --local luasec
fi
luarocks install --local luacov
luarocks install --local luacov-reporter-lcov
# Add local luarocks bin to PATH
echo "$HOME/.luarocks/bin" >> $GITHUB_PATH
else
make install
fi
- name: Build project
run: make build
- name: Run tests with coverage
run: make coverage-report
- name: Validate rockspec installation
shell: bash
run: |
# For Ubuntu LuaJIT, update the rockspec test to use local luarocks path
if [ "${{ matrix.os }}" = "ubuntu-latest" ] && [[ "${{ matrix.lua-version }}" == *"luajit"* ]]; then
eval "$(luarocks path --local)"
make test-rockspec
else
make test-rockspec
fi
- name: Upload coverage artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: coverage-${{ matrix.os }}-lua${{ matrix.lua-version }}
path: |
coverage.info
luacov.report.out
test-results.xml
retention-days: 7
- name: Upload coverage to Codecov (Ubuntu Lua 5.4 only)
if: matrix.os == 'ubuntu-latest' && matrix.lua-version == '5.4'
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4
with:
file: ./coverage.info
flags: unittests
name: codecov-${{ matrix.lua-version }}
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov (Ubuntu Lua 5.4 only)
if: matrix.os == 'ubuntu-latest' && matrix.lua-version == '5.4'
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1
with:
file: ./test-results.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Create distribution zip
if: matrix.os == 'ubuntu-latest' && matrix.lua-version == '5.4'
shell: bash
run: |
echo "Creating distribution zip for Love2D and other non-LuaRocks users..."
# Create temporary directory for packaging
mkdir -p dist-temp
# Copy required files and directories
cp CHANGELOG.md dist-temp/ || { echo "❌ CHANGELOG.md not found"; exit 1; }
cp README.md dist-temp/ || { echo "❌ README.md not found"; exit 1; }
# Copy directories (recursively)
cp -r build dist-temp/ || { echo "❌ build directory not found. Run 'make build' first."; exit 1; }
cp -r spec dist-temp/ || { echo "❌ spec directory not found"; exit 1; }
cp -r examples dist-temp/ || { echo "❌ examples directory not found"; exit 1; }
# Create zip file
cd dist-temp && zip -r ../sentry-lua-sdk.zip . > /dev/null
cd ..
# Clean up temporary directory
rm -rf dist-temp
echo "✅ Distribution zip created: sentry-lua-sdk.zip"
# Show contents for verification
echo "Distribution zip contents:"
unzip -l sentry-lua-sdk.zip
- name: Upload distribution zip artifact
if: matrix.os == 'ubuntu-latest' && matrix.lua-version == '5.4'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
# Must be named as the SHA alone so craft can find it and release it.
name: ${{ github.sha }}
path: "sentry-lua-sdk.zip"