Skip to content

Commit 687cf12

Browse files
committed
ci: replace leafo/gh-actions-luarocks with a local composite action
1 parent 8d120a0 commit 687cf12

3 files changed

Lines changed: 56 additions & 3 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "Set up LuaRocks"
2+
description: >
3+
Build and install LuaRocks against the Lua tree produced by leafo/gh-actions-lua.
4+
This replaces leafo/gh-actions-luarocks, which the Apache enterprise action
5+
allowlist does not permit. Actions living in this repository are always allowed,
6+
so the same steps are kept here instead.
7+
8+
inputs:
9+
luaRocksVersion:
10+
description: "The version of LuaRocks to build, as published on https://luarocks.org/releases/"
11+
required: false
12+
default: "3.13.0"
13+
withLuaPath:
14+
description: "Existing Lua installation to build against (./configure --with-lua). Defaults to the .lua directory created by leafo/gh-actions-lua."
15+
required: false
16+
default: ""
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Build and install LuaRocks
22+
shell: bash
23+
env:
24+
LUAROCKS_VERSION: ${{ inputs.luaRocksVersion }}
25+
WITH_LUA_PATH: ${{ inputs.withLuaPath }}
26+
run: |
27+
set -euo pipefail
28+
29+
lua_dir="${WITH_LUA_PATH:-}"
30+
if [ -z "$lua_dir" ]; then
31+
# Default install path used by leafo/gh-actions-lua.
32+
lua_dir="${GITHUB_WORKSPACE}/.lua"
33+
fi
34+
35+
build_dir="${RUNNER_TEMP}/.build-luarocks"
36+
install_dir="${GITHUB_WORKSPACE}/.luarocks"
37+
38+
mkdir -p "$build_dir"
39+
curl -fsSL "https://luarocks.org/releases/luarocks-${LUAROCKS_VERSION}.tar.gz" \
40+
| tar -xz -C "$build_dir"
41+
42+
cd "${build_dir}/luarocks-${LUAROCKS_VERSION}"
43+
./configure --with-lua="$lua_dir" --prefix="$install_dir"
44+
make
45+
make install
46+
47+
# Expose luarocks and the rocks tree to the following steps.
48+
luarocks="${install_dir}/bin/luarocks"
49+
"$luarocks" path --lr-bin >> "$GITHUB_PATH"
50+
{
51+
echo "LUA_PATH=;;$("$luarocks" path --lr-path)"
52+
echo "LUA_CPATH=;;$("$luarocks" path --lr-cpath)"
53+
} >> "$GITHUB_ENV"

‎.github/workflows/build.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
luaVersion: ${{ matrix.lua-version }}
3131

3232
- name: Set up luarocks
33-
uses: leafo/gh-actions-luarocks@v6
33+
uses: ./.github/actions/setup-luarocks
3434

3535
- name: Install PCRE
3636
run: |
@@ -103,7 +103,7 @@ jobs:
103103
luaVersion: "luajit-openresty"
104104

105105
- name: Set up luarocks
106-
uses: leafo/gh-actions-luarocks@v4.0.0
106+
uses: ./.github/actions/setup-luarocks
107107

108108
- name: Install PCRE
109109
run: |

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
luaVersion: 5.1
9494

9595
- name: Set up luarocks
96-
uses: leafo/gh-actions-luarocks@v4.0.0
96+
uses: ./.github/actions/setup-luarocks
9797

9898
- name: Set up CJSON
9999
run: luarocks install lua-cjson

0 commit comments

Comments
 (0)