Files
dl_old/third/LuaBridge3/.github/workflows/coverage.yml
T
2026-04-28 18:52:55 +08:00

321 lines
10 KiB
YAML
Vendored

name: Coverage
on:
push:
paths:
- "**/workflows/coverage.yml"
- "**/Source/**"
- "**/Tests/**"
- "**/ThirdParty/**"
- "**/CMakeLists.txt"
- "**/.gitmodules"
- "!**/*.md"
- "!**/*.txt"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
BUILD_TYPE: Debug
jobs:
lua:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
lua:
- { version: "5.1", suffix: "51" }
- { version: "5.2", suffix: "52" }
- { version: "5.3", suffix: "53" }
- { version: "5.4", suffix: "54" }
- { version: "5.5", suffix: "55" }
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install lcov
run: sudo apt-get install -y lcov ninja-build
- name: Create Build Environment
run: |
cmake -E make_directory ${{runner.workspace}}/build
cmake -E make_directory ${{runner.workspace}}/build/coverage
- name: Configure
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLUABRIDGE_COVERAGE=ON -G Ninja
- name: Build Lua ${{ matrix.lua.version }}
working-directory: ${{runner.workspace}}/build
run: |
cmake --build . --config $BUILD_TYPE --parallel $(nproc) --target \
LuaBridgeTests${{ matrix.lua.suffix }} \
LuaBridgeTests${{ matrix.lua.suffix }}LuaC \
LuaBridgeTests${{ matrix.lua.suffix }}Noexcept \
LuaBridgeTests${{ matrix.lua.suffix }}LuaCNoexcept
- name: Test Lua ${{ matrix.lua.version }}
working-directory: ${{runner.workspace}}/build/Tests
run: |
./LuaBridgeTests${{ matrix.lua.suffix }}
./LuaBridgeTests${{ matrix.lua.suffix }}LuaC
./LuaBridgeTests${{ matrix.lua.suffix }}Noexcept
./LuaBridgeTests${{ matrix.lua.suffix }}LuaCNoexcept
- name: Coverage Lua ${{ matrix.lua.version }}
working-directory: ${{runner.workspace}}/build
run: |
lcov -c -d "${{runner.workspace}}/build" --rc branch_coverage=1 --rc geninfo_unexecuted_blocks=1 \
--ignore-errors mismatch,unused \
--include "*/LuaBridge/*" --exclude "*/Tests/*" --exclude "*/Distribution/*" --exclude "*/coverage_html/*" \
-o "coverage/lua${{ matrix.lua.suffix }}.info"
- name: Cache Lcov Files
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-lua${{ matrix.lua.suffix }}-${{runner.os}}-${{github.sha}}
luajit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install lcov
run: sudo apt-get install -y lcov ninja-build
- name: Create Build Environment
run: |
cmake -E make_directory ${{runner.workspace}}/build
cmake -E make_directory ${{runner.workspace}}/build/coverage
- name: Configure
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLUABRIDGE_COVERAGE=ON -G Ninja
- name: Build LuaJIT
working-directory: ${{runner.workspace}}/build
run: |
cmake --build . --config $BUILD_TYPE --parallel $(nproc) --target \
LuaBridgeTestsLuaJIT \
LuaBridgeTestsLuaJITNoexcept
- name: Test LuaJIT
working-directory: ${{runner.workspace}}/build/Tests
run: |
./LuaBridgeTestsLuaJIT
./LuaBridgeTestsLuaJITNoexcept
- name: Coverage LuaJIT
working-directory: ${{runner.workspace}}/build
run: |
lcov -c -d "${{runner.workspace}}/build" --rc branch_coverage=1 --rc geninfo_unexecuted_blocks=1 \
--ignore-errors mismatch,unused \
--include "*/LuaBridge/*" --exclude "*/Tests/*" --exclude "*/Distribution/*" --exclude "*/coverage_html/*" \
-o "coverage/luajit.info"
- name: Cache Lcov Files
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-luajit-${{runner.os}}-${{github.sha}}
luau:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install lcov
run: sudo apt-get install -y lcov ninja-build
- name: Create Build Environment
run: |
cmake -E make_directory ${{runner.workspace}}/build
cmake -E make_directory ${{runner.workspace}}/build/coverage
- name: Configure
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLUABRIDGE_COVERAGE=ON -G Ninja
- name: Build Luau
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE --parallel $(nproc) --target LuaBridgeTestsLuau
- name: Test Luau
working-directory: ${{runner.workspace}}/build/Tests
run: ./LuaBridgeTestsLuau
- name: Coverage Luau
working-directory: ${{runner.workspace}}/build
run: |
lcov -c -d "${{runner.workspace}}/build" --rc branch_coverage=1 --rc geninfo_unexecuted_blocks=1 \
--ignore-errors mismatch,unused \
--include "*/LuaBridge/*" --exclude "*/Tests/*" --exclude "*/Distribution/*" --exclude "*/coverage_html/*" \
-o "coverage/luau.info"
- name: Cache Lcov Files
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-luau-${{runner.os}}-${{github.sha}}
ravi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install lcov
run: sudo apt-get install -y lcov libreadline-dev ninja-build
- name: Create Build Environment
run: |
cmake -E make_directory ${{runner.workspace}}/build
cmake -E make_directory ${{runner.workspace}}/build/coverage
- name: Configure
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLUABRIDGE_COVERAGE=ON -G Ninja
- name: Build Ravi
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE --parallel $(nproc) --target LuaBridgeTestsRavi
- name: Test Ravi
working-directory: ${{runner.workspace}}/build/Tests
run: LD_PRELOAD=$(gcc -print-file-name=libasan.so) ./LuaBridgeTestsRavi
- name: Coverage Ravi
working-directory: ${{runner.workspace}}/build
run: |
lcov -c -d "${{runner.workspace}}/build" --rc branch_coverage=1 --rc geninfo_unexecuted_blocks=1 \
--ignore-errors mismatch,unused \
--include "*/LuaBridge/*" --exclude "*/Tests/*" --exclude "*/Distribution/*" --exclude "*/coverage_html/*" \
-o "coverage/ravi.info"
- name: Cache Lcov Files
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-ravi-${{runner.os}}-${{github.sha}}
coveralls:
runs-on: ubuntu-latest
needs: [lua, luajit, luau, ravi]
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install lcov
run: sudo apt-get install -y lcov
- name: Create Build Environment
run: |
cmake -E make_directory ${{runner.workspace}}/build
cmake -E make_directory ${{runner.workspace}}/build/coverage
- name: Restore Lcov Files Lua 5.1
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-lua51-${{runner.os}}-${{github.sha}}
- name: Restore Lcov Files Lua 5.2
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-lua52-${{runner.os}}-${{github.sha}}
- name: Restore Lcov Files Lua 5.3
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-lua53-${{runner.os}}-${{github.sha}}
- name: Restore Lcov Files Lua 5.4
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-lua54-${{runner.os}}-${{github.sha}}
- name: Restore Lcov Files Lua 5.5
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-lua55-${{runner.os}}-${{github.sha}}
- name: Restore Lcov Files LuaJIT
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-luajit-${{runner.os}}-${{github.sha}}
- name: Restore Lcov Files Luau
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-luau-${{runner.os}}-${{github.sha}}
- name: Restore Lcov Files Ravi
uses: actions/cache@v5
with:
path: "${{runner.workspace}}/build/coverage/*.info"
key: lcov-ravi-${{runner.os}}-${{github.sha}}
- name: Merge Lcov Files
working-directory: ${{runner.workspace}}/build
run: |
lcov \
-a "coverage/lua51.info" \
-a "coverage/lua52.info" \
-a "coverage/lua53.info" \
-a "coverage/lua54.info" \
-a "coverage/lua55.info" \
-a "coverage/luajit.info" \
-a "coverage/luau.info" \
-a "coverage/ravi.info" \
-o "coverage/merged.info"
- name: Install lcov2xml
run: cargo install lcov2xml
- name: Convert to Cobertura XML
working-directory: ${{runner.workspace}}/build
run: lcov2xml coverage/merged.info -o coverage/cobertura.xml
#- name: Convert to Coverage TXT
# working-directory: ${{runner.workspace}}/build
# run: python3 ${{runner.workspace}}/cobertura.py coverage/cobertura.info coverage/coverage.txt
- name: Upload Cobertura XML
uses: actions/upload-artifact@v4
with:
name: cobertura-coverage
path: ${{runner.workspace}}/build/coverage/cobertura.xml
#- name: Upload Coverage TXT
# uses: actions/upload-artifact@v4
# with:
# name: text-coverage
# path: ${{runner.workspace}}/build/coverage/coverage.txt
- name: Coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: ${{runner.workspace}}/build/coverage/merged.info
github-token: ${{ secrets.GITHUB_TOKEN }}