111 lines
3.2 KiB
YAML
111 lines
3.2 KiB
YAML
---
|
||
name: Busted
|
||
|
||
on: [push, pull_request]
|
||
|
||
jobs:
|
||
busted:
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
lua_version:
|
||
[
|
||
"luajit-openresty",
|
||
"luajit-2.1.0-beta3",
|
||
"luajit-git",
|
||
"5.4.6",
|
||
"5.1.5",
|
||
"5.3.6",
|
||
]
|
||
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
||
|
||
runs-on: ${{ matrix.os }}
|
||
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v4
|
||
- uses: ilammy/msvc-dev-cmd@v1
|
||
if: ${{ !startsWith(matrix.lua_version, 'luajit-') }}
|
||
|
||
- name: Setup ‘lua’
|
||
uses: jkl1337/gh-actions-lua@master
|
||
with:
|
||
luaVersion: ${{ matrix.lua_version }}
|
||
- name: Setup ‘luarocks’
|
||
uses: jkl1337/gh-actions-luarocks@master
|
||
- name: Setup dependencies
|
||
run: |
|
||
luarocks install busted
|
||
luarocks install luacov-reporter-lcov
|
||
- name: Build C++ library
|
||
run: |
|
||
luarocks make --no-install
|
||
env:
|
||
LJKIWI_LUA: ${{ startsWith(matrix.lua_version, 'luajit-') && '0' || '1' }}
|
||
LJKIWI_CFFI: ${{ startsWith(matrix.lua_version, 'luajit-') && '1' || '0' }}
|
||
FCOV: ${{ startsWith(matrix.os, 'ubuntu-') && '1' || '' }}
|
||
# Can't assume so versions, have to update this manually below
|
||
FSANITIZE: ${{ matrix.os == 'ubuntu-latest' && '1' || '' }}
|
||
|
||
- name: Run busted tests
|
||
run: |
|
||
busted -c -v
|
||
env:
|
||
LD_PRELOAD: |-
|
||
${{ matrix.os == 'ubuntu-latest' &&
|
||
'/usr/lib/x86_64-linux-gnu/libasan.so.6:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libubsan.so.1'
|
||
|| '' }}
|
||
|
||
- name: Run gcov
|
||
if: success() && startsWith(matrix.os, 'ubuntu-')
|
||
run: |
|
||
gcov -p -b -s"$(pwd)" -r *.gcda
|
||
rm -f 'kiwi#'*.gcov
|
||
|
||
- name: generate Lua lcov test reports
|
||
if: |-
|
||
success() && !startsWith(matrix.os, 'windows-')
|
||
&& startsWith(matrix.lua_version, 'luajit-')
|
||
run: luacov
|
||
|
||
- name: Report test coverage
|
||
if: |-
|
||
success() && !startsWith(matrix.os, 'windows-')
|
||
&& (startsWith(matrix.lua_version, 'luajit-') || startsWith(matrix.os, 'ubuntu-'))
|
||
continue-on-error: true
|
||
uses: coverallsapp/github-action@v2
|
||
with:
|
||
flag-name: run ${{ join(matrix.*, ' - ') }}
|
||
|
||
finish:
|
||
if: always()
|
||
needs: busted
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Close coveralls build
|
||
uses: coverallsapp/github-action@v2
|
||
with:
|
||
parallel-finished: true
|
||
|
||
publish:
|
||
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
|
||
needs: busted
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v4
|
||
- name: Setup ‘lua’
|
||
uses: jkl1337/gh-actions-lua@master
|
||
with:
|
||
luaVersion: "5.4.6"
|
||
- name: Setup ‘luarocks’
|
||
uses: jkl1337/gh-actions-luarocks@master
|
||
- name: Build C++ library
|
||
run: |
|
||
luarocks make --no-install
|
||
- name: Build rock
|
||
run: |
|
||
luarocks install dkjson
|
||
luarocks upload --api-key ${{ secrets.LUAROCKS_API_KEY }} \
|
||
rockspecs/kiwi-${GITHUB_REF_NAME#v}-1.rockspec
|