-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (74 loc) · 2.98 KB
/
test_build_rock.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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) }}
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 }}