Skip to content

Commit 1c84a69

Browse files
Easton97-Jensjens
authored andcommitted
Update ci.yml lua dynamisch
1 parent 2454df3 commit 1c84a69

1 file changed

Lines changed: 41 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
push:
55
pull_request:
66

7-
env:
8-
LUA_VERSION: "5.4"
9-
107
jobs:
118
build-linux:
129
name: Linux (${{ matrix.platform.label }}, ${{ matrix.compiler.label }}, ${{ matrix.configure.label }})
@@ -37,14 +34,53 @@ jobs:
3734
- platform: {label: "x32"}
3835
configure: {label: "wo ssdeep"}
3936
steps:
37+
- name: Detect latest Lua dev package
38+
id: detect_lua
39+
shell: bash
40+
run: |
41+
set -euo pipefail
42+
43+
sudo dpkg --add-architecture ${{ matrix.platform.arch }}
44+
sudo apt-get update -y -qq
45+
46+
CANDIDATES="$(apt-cache search '^liblua[0-9]+\.[0-9]+-dev$' | awk '{print $1}')"
47+
48+
if [ -z "$CANDIDATES" ]; then
49+
echo "No libluaX.Y-dev package found"
50+
exit 1
51+
fi
52+
53+
VALID_PACKAGES=""
54+
for pkg in $CANDIDATES; do
55+
if apt-cache show "${pkg}:${{ matrix.platform.arch }}" >/dev/null 2>&1; then
56+
VALID_PACKAGES="${VALID_PACKAGES}${pkg}"$'\n'
57+
fi
58+
done
59+
60+
if [ -z "$VALID_PACKAGES" ]; then
61+
echo "No Lua package available for architecture ${{ matrix.platform.arch }}"
62+
exit 1
63+
fi
64+
65+
BEST_PKG="$(
66+
printf '%s\n' "$VALID_PACKAGES" \
67+
| sed -E 's/^liblua([0-9]+\.[0-9]+)-dev$/\1 &/' \
68+
| sort -V \
69+
| tail -n1 \
70+
| awk '{print $2}'
71+
)"
72+
73+
echo "lua_pkg=$BEST_PKG" >> "$GITHUB_OUTPUT"
74+
echo "Using $BEST_PKG for ${{ matrix.platform.arch }}"
75+
4076
- name: Setup Dependencies (common)
4177
run: |
4278
sudo dpkg --add-architecture ${{ matrix.platform.arch }}
4379
sudo apt-get update -y -qq
4480
sudo apt-get install -y libyajl-dev:${{ matrix.platform.arch }} \
4581
libcurl4-openssl-dev:${{ matrix.platform.arch }} \
4682
liblmdb-dev:${{ matrix.platform.arch }} \
47-
liblua${{ env.LUA_VERSION }}-dev:${{ matrix.platform.arch }} \
83+
${{ steps.detect_lua.outputs.lua_pkg }}:${{ matrix.platform.arch }} \
4884
libmaxminddb-dev:${{ matrix.platform.arch }} \
4985
libpcre2-dev:${{ matrix.platform.arch }} \
5086
pcre2-utils:${{ matrix.platform.arch }} \
@@ -104,7 +140,7 @@ jobs:
104140
libtool \
105141
yajl \
106142
lmdb \
107-
lua@${{ env.LUA_VERSION }} \
143+
lua \
108144
libmaxminddb \
109145
libxml2 \
110146
ssdeep \

0 commit comments

Comments
 (0)