Skip to content

Exclude LuaRocks 2 from handling projects with format 3 rockspecs or … #1

Exclude LuaRocks 2 from handling projects with format 3 rockspecs or …

Exclude LuaRocks 2 from handling projects with format 3 rockspecs or … #1

name: Test build rock
on:
workflow_call:
inputs:
rockspecs:
required: true
type: string
format3:
required: false
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) }}

Check failure on line 22 in .github/workflows/test_build_rock.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/test_build_rock.yml

Invalid workflow file

You have an error in your yaml syntax on line 22
format3: [ ${{ inputs.format3 }} ]
exclude:
- luaVersion: "5.4"
luarocksVersion: "2.4.2"
- 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
with:
luaVersion: ${{ matrix.luaVersion }}
- name: Setup ‘luarocks’
uses: leafo/gh-actions-luarocks@v4
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 }}