Build #55
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: Build | |
| on: | |
| workflow_dispatch: | |
| workflow_run: | |
| workflows: ["Static Analysis"] | |
| types: | |
| - completed | |
| env: | |
| ACT: 'false' | |
| jobs: | |
| build-linux: | |
| name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }} | |
| runs-on: ${{ matrix.os }} | |
| if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| compiler: [gcc, clang] | |
| build_type: [Debug, Release] | |
| include: | |
| - compiler: gcc | |
| cc: gcc-13 | |
| cxx: g++-13 | |
| - compiler: clang | |
| cc: clang-18 | |
| cxx: clang++-18 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Update submodules | |
| run: git submodule update --init --recursive | |
| - name: Cache FetchContent downloads | |
| uses: actions/cache@v4 | |
| with: | |
| path: build/_deps | |
| key: ${{ runner.os }}-${{ matrix.compiler }}-fetchcontent-${{ hashFiles('cmake/SetupSDL3.cmake') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.compiler }}-fetchcontent- | |
| - name: Install Ubuntu dependencies | |
| run: ./scripts/ci/install-ubuntu-deps.sh --build | |
| - 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 | |
| - name: Install Clang 18 | |
| if: matrix.compiler == 'clang' | |
| run: ./scripts/ci/install-compiler.sh --clang 18 | |
| - name: Set up environment variables | |
| run: | | |
| echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV | |
| echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV | |
| - name: Configure CMake | |
| run: | | |
| cmake_args=( | |
| -B build | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| -DLAYA_BUILD_TESTS=ON | |
| -DLAYA_BUILD_EXAMPLES=ON | |
| -DCMAKE_CXX_STANDARD=20 | |
| -DCMAKE_CXX_STANDARD_REQUIRED=ON | |
| -G "Ninja" | |
| ) | |
| extra_cxx_flags="" | |
| extra_exe_linker_flags="" | |
| extra_shared_linker_flags="" | |
| if [[ "${{ matrix.build_type }}" == "Debug" ]]; then | |
| extra_cxx_flags="${extra_cxx_flags} -fno-omit-frame-pointer -g" | |
| fi | |
| if [[ "${{ matrix.compiler }}" == "clang" ]]; then | |
| extra_cxx_flags="${extra_cxx_flags} -stdlib=libc++" | |
| extra_exe_linker_flags="${extra_exe_linker_flags} -stdlib=libc++ -lc++ -lc++abi" | |
| extra_shared_linker_flags="${extra_shared_linker_flags} -stdlib=libc++ -lc++ -lc++abi" | |
| fi | |
| if [[ -n "${extra_cxx_flags// /}" ]]; then | |
| cmake_args+=(-DCMAKE_CXX_FLAGS="${extra_cxx_flags}") | |
| fi | |
| if [[ -n "${extra_exe_linker_flags// /}" ]]; then | |
| cmake_args+=(-DCMAKE_EXE_LINKER_FLAGS="${extra_exe_linker_flags}") | |
| fi | |
| if [[ -n "${extra_shared_linker_flags// /}" ]]; then | |
| cmake_args+=(-DCMAKE_SHARED_LINKER_FLAGS="${extra_shared_linker_flags}") | |
| fi | |
| cmake "${cmake_args[@]}" | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Generate clang build summary | |
| if: matrix.compiler == 'clang' | |
| run: | | |
| mkdir -p ci/build-info | |
| cat <<EOF > ci/build-info/clang-${{ matrix.build_type }}.md | |
| ### Ubuntu Clang ${{ matrix.build_type }} build | |
| - Status: success | |
| - Compiler: ${{ matrix.compiler }} (CC=${{ matrix.cc }}, CXX=${{ matrix.cxx }}) | |
| - Build Type: ${{ matrix.build_type }} | |
| - Artifact: laya-linux-${{ matrix.compiler }}-${{ matrix.build_type }} | |
| - Commit: ${{ github.sha }} | |
| - Run ID: ${{ github.run_id }} (attempt ${{ github.run_attempt }}) | |
| - Timestamp: $(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
| EOF | |
| - name: Upload build artifacts | |
| if: ${{ env.ACT != 'true' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: laya-linux-${{ matrix.compiler }}-${{ matrix.build_type }} | |
| path: | | |
| build/src/liblaya.a | |
| build/tests/laya_tests_unit | |
| build/tests/laya_tests_benchmark | |
| build/tests/libSDL3.so* | |
| build/examples/**/laya_examples_* | |
| build/examples/**/libSDL3.so* | |
| !build/**/*.o | |
| retention-days: 90 | |
| - name: Cleanup headless display | |
| if: always() | |
| run: ./scripts/ci/cleanup-xvfb.sh | |
| - name: Upload clang build info | |
| if: ${{ env.ACT != 'true' && matrix.compiler == 'clang' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ci-clang-build-info-${{ matrix.build_type }} | |
| path: ci/build-info/clang-${{ matrix.build_type }}.md | |
| retention-days: 30 |