|
4 | 4 | push: |
5 | 5 | pull_request: |
6 | 6 |
|
7 | | -env: |
8 | | - LUA_VERSION: "5.4" |
9 | | - |
10 | 7 | jobs: |
11 | 8 | build-linux: |
12 | 9 | name: Linux (${{ matrix.platform.label }}, ${{ matrix.compiler.label }}, ${{ matrix.configure.label }}) |
@@ -37,14 +34,53 @@ jobs: |
37 | 34 | - platform: {label: "x32"} |
38 | 35 | configure: {label: "wo ssdeep"} |
39 | 36 | 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 | +
|
40 | 76 | - name: Setup Dependencies (common) |
41 | 77 | run: | |
42 | 78 | sudo dpkg --add-architecture ${{ matrix.platform.arch }} |
43 | 79 | sudo apt-get update -y -qq |
44 | 80 | sudo apt-get install -y libyajl-dev:${{ matrix.platform.arch }} \ |
45 | 81 | libcurl4-openssl-dev:${{ matrix.platform.arch }} \ |
46 | 82 | liblmdb-dev:${{ matrix.platform.arch }} \ |
47 | | - liblua${{ env.LUA_VERSION }}-dev:${{ matrix.platform.arch }} \ |
| 83 | + ${{ steps.detect_lua.outputs.lua_pkg }}:${{ matrix.platform.arch }} \ |
48 | 84 | libmaxminddb-dev:${{ matrix.platform.arch }} \ |
49 | 85 | libpcre2-dev:${{ matrix.platform.arch }} \ |
50 | 86 | pcre2-utils:${{ matrix.platform.arch }} \ |
@@ -104,7 +140,7 @@ jobs: |
104 | 140 | libtool \ |
105 | 141 | yajl \ |
106 | 142 | lmdb \ |
107 | | - lua@${{ env.LUA_VERSION }} \ |
| 143 | + lua \ |
108 | 144 | libmaxminddb \ |
109 | 145 | libxml2 \ |
110 | 146 | ssdeep \ |
|
0 commit comments