Temporarily switch to fork of GH Actions with working LuaJIT #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test build rock | ||
on: | ||
workflow_call: | ||
inputs: | ||
rockspecs: | ||
required: true | ||
type: string | ||
format3: | ||
type: boolean | ||
default: false | ||
jobs: | ||
build: | ||
name: Test build rockspec | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
luaVersion: [ "5.4", "5.3", "5.2", "5.1" ] # , "luajit", "luajit-openresty"] | ||
luarocksVersion: [ "3.9.1", "3.1.3", "2.4.2" ] | ||
rockspec: ${{ fromJSON(inputs.rockspecs) }} | ||
format3: | ||
- ${{ inputs.format3 }} | ||
exclude: | ||
- luaVersion: "5.4" | ||
luarocksVersion: "2.4.2" | ||
- luaVersion: "5.1" | ||
luarocksVersion: "3.1.3" | ||
- format3: true | ||
luarocksVersion: "2.4.2" | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup ‘lua’ | ||
# uses: leafo/gh-actions-lua@v10 | ||
uses: uses: hishamhm/gh-actions-lua@master | ||
with: | ||
luaVersion: ${{ matrix.luaVersion }} | ||
- name: Setup ‘luarocks’ | ||
# uses: leafo/gh-actions-luarocks@v4 | ||
uses: hishamhm/gh-actions-luarocks@update-luajit | ||
with: | ||
luarocksVersion: ${{ matrix.luarocksVersion }} | ||
- name: Monkey-patch rockspec source.url to assure testing against relevant repo fork | ||
run: | | ||
sed -i -e '/^\s*url/s!=.*!= "${{ github.repositoryURL }}",!' -e 's!git:!git+https:!' ${{ matrix.rockspec }} | ||
# Only needed for builders to work around https://github.com/luarocks/luarocks/issues/1521 | ||
- name: Install dev rockspec dependencies | ||
if: ${{ !startsWith(matrix.rockspec, 'rockspecs/') && !startsWith(matrix.luarocksVersion, '2') }} | ||
run: | | ||
luarocks install --only-deps ${{ matrix.rockspec }} | ||
- name: Confirm dev rockspec(s) build | ||
if: ${{ !startsWith(matrix.rockspec, 'rockspecs/') && !startsWith(matrix.luarocksVersion, '2') }} | ||
run: | | ||
args="--lua-version ${{ matrix.luaVersion }}" | ||
luarocks make --pack-binary-rock $args -- ${{ matrix.rockspec }} | ||
- name: Parse semver and check for matching tag of touched rockspec | ||
id: parsetag | ||
run: | | ||
semver=$(rev <<< "${{ matrix.rockspec }}" | cut -d- -f2 | rev) | ||
echo "::set-output name=semver::$semver" | ||
tag=$(git tag | grep -Ex "v?${semver//\\./\\\\.}" ||:) | ||
echo "::set-output name=tag::$tag" | ||
- name: Monkey-patch rockspec source.tag in release rockspecs if tag not present | ||
if: ${{ startsWith(matrix.rockspec, 'rockspecs/') && !steps.parsetag.outputs.tag }} | ||
run: | | ||
sed -i -e '/^\s*tag/d' -e '/^\s*branch/s!=.*!= "${{ github.ref_name }}",!' ${{ matrix.rockspec }} | ||
- name: Install tagged rockspec dependencies | ||
if: ${{ startsWith(matrix.rockspec, 'rockspecs/') }} | ||
run: | | ||
luarocks install --only-deps ${{ matrix.rockspec }} | ||
- name: Confirm tagged rockspec(s) build | ||
if: ${{ startsWith(matrix.rockspec, 'rockspecs/') }} | ||
run: | | ||
args="--lua-version ${{ matrix.luaVersion }}" | ||
set -euo pipefail | ||
luarocks build --pack-binary-rock $args ${{ matrix.rockspec }} |