|
| 1 | +# Copyright (c) 2024 The Khronos Group Inc. |
| 2 | +# Copyright (c) 2023-2024 RasterGrid Kft. |
| 3 | +# Copyright (c) 2023-2024 Valve Corporation |
| 4 | +# Copyright (c) 2023-2024 LunarG, Inc. |
| 5 | +# |
| 6 | +# SPDX-License-Identifier: Apache-2.0 |
| 7 | + |
| 8 | +name: VKSC-PCU (Build/Tests) |
| 9 | + |
| 10 | +# https://docs.github.com/en/actions/using-jobs/using-concurrency |
| 11 | +concurrency: |
| 12 | + # github.head_ref is only defined on pull_request |
| 13 | + # Fallback to the run ID, which is guaranteed to be both unique and defined for the run. |
| 14 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches: |
| 20 | + - '!main' |
| 21 | + pull_request: |
| 22 | + branches: |
| 23 | + - main |
| 24 | + |
| 25 | +permissions: |
| 26 | + contents: read |
| 27 | + |
| 28 | +jobs: |
| 29 | + pre_build: |
| 30 | + name: Pre-build tests |
| 31 | + # Runner fixed to accelerate clang-format install, to omit installing a full-blown LLVM install |
| 32 | + # with the likes of KyleMayes/install-llvm-action for. When oldest supported Ubuntu changes, so |
| 33 | + # should the clang-format used. |
| 34 | + runs-on: ubuntu-22.04 |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + steps: |
| 38 | + - name: ${{ format('Checkout {0}', github.repository) }} |
| 39 | + uses: actions/checkout@v4 |
| 40 | + - name: Check code formatting |
| 41 | + |
| 42 | + with: |
| 43 | + # Default clang-format in oldest supported Ubuntu (22.04), also available in 24.04 |
| 44 | + clang-format-version: '14' |
| 45 | + - name: Check REUSE compliance |
| 46 | + |
| 47 | + - name: Install Python |
| 48 | + uses: actions/setup-python@v5 |
| 49 | + with: |
| 50 | + python-version: '3.10' |
| 51 | + - name: Install clang-format |
| 52 | + run: | |
| 53 | + sudo apt update |
| 54 | + sudo apt install clang-format |
| 55 | + - name: Codegen identity |
| 56 | + run: | |
| 57 | + python3 scripts/update_deps.py --dir external --no-build |
| 58 | + python3 scripts/generate_source.py external/Vulkan-Headers/registry/ |
| 59 | + git restore layers/json_gen/json_gen.cpp # JSONGenOutputGenerator is known to be non-deterministic |
| 60 | + git diff --exit-code |
| 61 | +
|
| 62 | + linux: |
| 63 | + name: ${{ format('{0}, {1} ({2})', matrix.os, matrix.compiler.cc, matrix.config) }} |
| 64 | + needs: pre_build |
| 65 | + runs-on: ${{matrix.os}} |
| 66 | + strategy: |
| 67 | + fail-fast: false |
| 68 | + matrix: |
| 69 | + os: [ ubuntu-22.04, ubuntu-24.04 ] |
| 70 | + compiler: [ {cc: gcc, cxx: g++}, {cc: clang, cxx: clang++} ] |
| 71 | + config: [ Debug, Release ] |
| 72 | + steps: |
| 73 | + - name: ${{ format('Checkout {0}', github.repository) }} |
| 74 | + uses: actions/checkout@v4 |
| 75 | + - name: Install Python |
| 76 | + uses: actions/setup-python@v5 |
| 77 | + with: |
| 78 | + python-version: '3.10' |
| 79 | + - name: Install CMake & Ninja |
| 80 | + uses: lukka/get-cmake@latest |
| 81 | + with: |
| 82 | + cmakeVersion: 3.22.1 |
| 83 | + - name: Configure |
| 84 | + run: | |
| 85 | + cmake -S. -B build \ |
| 86 | + -G Ninja \ |
| 87 | + -D PCU_TESTS=ON \ |
| 88 | + -D UPDATE_DEPS=ON \ |
| 89 | + -D CMAKE_BUILD_TYPE=${{matrix.config}} \ |
| 90 | + -D PCU_WERROR=OFF |
| 91 | + - name: Build |
| 92 | + run: cmake --build build/ |
| 93 | + - name: Test |
| 94 | + run: ctest --output-on-failure --test-dir build/ |
| 95 | + - name: Install |
| 96 | + run: cmake --install build --prefix build/install |
| 97 | + |
| 98 | + windows: |
| 99 | + name: ${{ format('{0} ({1}), {2} ({3})', matrix.os, matrix.arch, matrix.toolset, matrix.config) }} |
| 100 | + needs: pre_build |
| 101 | + runs-on: ${{ matrix.os }} |
| 102 | + strategy: |
| 103 | + matrix: |
| 104 | + os: [ windows-2022 ] |
| 105 | + arch: [ Win32, x64 ] |
| 106 | + toolset: [ v143, ClangCL ] |
| 107 | + config: [ Debug, Release ] |
| 108 | + steps: |
| 109 | + - name: ${{ format('Checkout {0}', github.repository) }} |
| 110 | + uses: actions/checkout@v4 |
| 111 | + - name: Install Python |
| 112 | + uses: actions/setup-python@v5 |
| 113 | + with: |
| 114 | + python-version: '3.10' |
| 115 | + - name: Install CMake & Ninja |
| 116 | + uses: lukka/get-cmake@latest |
| 117 | + with: |
| 118 | + cmakeVersion: 3.22.1 |
| 119 | + - name: Configure |
| 120 | + run: | |
| 121 | + cmake -S. -B build ` |
| 122 | + -G "Visual Studio 17 2022" ` |
| 123 | + -D PCU_TESTS=ON ` |
| 124 | + -D UPDATE_DEPS=ON ` |
| 125 | + -D CMAKE_BUILD_TYPE=${{matrix.config}} ` |
| 126 | + -A ${{ matrix.arch }} ` |
| 127 | + -D PCU_WERROR=OFF |
| 128 | + - name: Build |
| 129 | + run: cmake --build build/ --config ${{matrix.config}} |
| 130 | + - name: Test |
| 131 | + run: ctest --output-on-failure -C ${{matrix.config}} --test-dir build/ |
| 132 | + - name: Install |
| 133 | + run: cmake --install build --prefix build/install --config ${{matrix.config}} |
0 commit comments