fix(ci): code coverage on C files is enough (#190) #69
This file contains hidden or 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: ci | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - "master" | |
| permissions: read-all | |
| jobs: | |
| TestMatrix: | |
| strategy: | |
| matrix: | |
| lua-version: ["5.5", "5.4", "5.3", "5.2", "5.1", "luajit"] | |
| os: ["ubuntu-latest"] | |
| libflag: ["-shared --coverage"] | |
| include: | |
| - os: "macos-latest" | |
| lua-version: "5.5" | |
| libflag: "-bundle -undefined dynamic_lookup -all_load --coverage" | |
| - os: "windows-latest" | |
| toolchain: "msvc" | |
| lua-version: "5.5" | |
| - os: "windows-latest" | |
| lua-version: "luajit" | |
| libflag: "-shared --coverage" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup MSVC | |
| # 'luarocks/gh-actions-lua' step requires msvc to build PUC-Rio Lua | |
| # versions on Windows (LuaJIT will be built using MinGW/gcc). | |
| if: runner.os == 'Windows' && matrix.toolchain == 'msvc' | |
| uses: step-security/msvc-dev-cmd@22c98154b708dbd743e6f27a933cf6ceba3305c4 # v1.13.1 | |
| - uses: luarocks/gh-actions-lua@85e2287697275df96334743ac654241a8fd34ab3 # v13 | |
| with: | |
| luaVersion: ${{ matrix.lua-version }} | |
| - uses: luarocks/gh-actions-luarocks@95d2308a0aff36ad31ebadca493ed14853399842 # v7 | |
| - name: GCC Build | |
| if: runner.os != 'Windows' || matrix.toolchain != 'msvc' | |
| run: | | |
| luarocks make CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="${{ matrix.libflag }}" | |
| - name: MSVC Build | |
| # TODO Windows coverage on MSVC | |
| if: runner.os == 'Windows' && matrix.toolchain == 'msvc' | |
| run: | | |
| luarocks make | |
| - name: Test | |
| run: | | |
| lua tests/test.lua | |
| - name: Run gcov in the main source file | |
| if: runner.os != 'Windows' || matrix.toolchain != 'msvc' | |
| run: | | |
| gcov --relative-only src/lfs.c | |
| - name: Upload Coverage | |
| # TODO Windows coverage on MSVC | |
| if: runner.os != 'Windows' || matrix.toolchain != 'msvc' | |
| uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} |