Skip to content

Test

Test #44

Workflow file for this run

name: Test
on:
workflow_run:
workflows: ["Build"]
types:
- completed
env:
ACT: 'false'
jobs:
test-linux:
name: Test-${{ matrix.compiler }}-Debug
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download build artifacts
if: ${{ env.ACT != 'true' }}
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
name: laya-linux-${{ matrix.compiler }}-Debug
run-id: ${{ github.event.workflow_run.id }}
path: build
- name: Install Ubuntu dependencies
run: ./scripts/ci/install-ubuntu-deps.sh --runtime
- name: Setup headless display
run: ./scripts/ci/setup-xvfb.sh
- name: Install GCC 13
if: matrix.compiler == 'gcc'
run: ./scripts/ci/install-compiler.sh --gcc 13 --with-coverage
- name: Install Clang 18
if: matrix.compiler == 'clang'
run: ./scripts/ci/install-compiler.sh --clang 18
- name: Make executables runnable
run: |
chmod +x build/tests/laya_tests_unit
chmod +x build/examples/*/laya_examples_* || true
- name: Run unit tests
run: |
eval "$(./scripts/ci/find-sdl3-lib.sh)"
./scripts/ci/run-tests.sh \
--junit junit-${{ matrix.compiler }}-debug.xml \
--console console-${{ matrix.compiler }}-debug.txt \
--no-sdl-search
- name: Generate coverage report (GCC only)
if: matrix.compiler == 'gcc'
run: ./scripts/ci/generate-coverage.sh --gcov gcov-13
- name: Upload coverage to Codecov
if: ${{ matrix.compiler == 'gcc' && env.ACT != 'true' }}
uses: codecov/codecov-action@v3
with:
file: ./coverage.info
flags: unittests
name: codecov-${{ matrix.compiler }}-debug
fail_ci_if_error: false
- name: Upload test results
if: ${{ env.ACT != 'true' }}
uses: actions/upload-artifact@v4
with:
name: test-results-linux-${{ matrix.compiler }}-debug
path: test-results/
retention-days: 90
- name: Upload coverage report
if: ${{ matrix.compiler == 'gcc' && env.ACT != 'true' }}
uses: actions/upload-artifact@v4
with:
name: coverage-report-gcc-debug
path: |
coverage.info
coverage-html/
retention-days: 90
- name: Cleanup headless display
if: always()
run: ./scripts/ci/cleanup-xvfb.sh