|
| 1 | +name: SimpleEngine CI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + branches: [ main ] |
| 7 | + paths: |
| 8 | + - 'attachments/simple_engine/**' |
| 9 | + - '.github/workflows/simple_engine.yml' |
| 10 | + push: |
| 11 | + branches: [ main ] |
| 12 | + paths: |
| 13 | + - 'attachments/simple_engine/**' |
| 14 | + - '.github/workflows/simple_engine.yml' |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + build-simple-engine: |
| 22 | + name: SimpleEngine (${{ matrix.os }} • ${{ matrix.build_type }} • module=${{ matrix.enable_module }}) |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + os: [ubuntu-latest, windows-latest] |
| 28 | + build_type: [Debug, Release] |
| 29 | + enable_module: [OFF, ON] |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
| 36 | + submodules: recursive |
| 37 | + |
| 38 | + # ----------------------- |
| 39 | + # Linux: set up Vulkan SDK similar to workflow.yml |
| 40 | + # ----------------------- |
| 41 | + - name: Install Vulkan SDK (Ubuntu) |
| 42 | + if: matrix.os == 'ubuntu-latest' |
| 43 | + run: | |
| 44 | + VULKAN_VERSION=$(curl -s https://vulkan.lunarg.com/sdk/latest/linux.txt) |
| 45 | + echo "Using Vulkan SDK version: $VULKAN_VERSION" |
| 46 | + mkdir -p vulkan-sdk |
| 47 | + cd vulkan-sdk |
| 48 | + curl -sSLO "https://sdk.lunarg.com/sdk/download/$VULKAN_VERSION/linux/vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz" |
| 49 | + tar -xJf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz |
| 50 | + echo "VULKAN_SDK=$PWD/$VULKAN_VERSION/x86_64" >> $GITHUB_ENV |
| 51 | + echo "PATH=$PWD/$VULKAN_VERSION/x86_64/bin:$PATH" >> $GITHUB_ENV |
| 52 | + echo "LD_LIBRARY_PATH=$PWD/$VULKAN_VERSION/x86_64/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV |
| 53 | + echo "VK_LAYER_PATH=$PWD/$VULKAN_VERSION/x86_64/etc/vulkan/explicit_layer.d" >> $GITHUB_ENV |
| 54 | + cd .. |
| 55 | +
|
| 56 | + - name: Install Dependencies (Ubuntu) |
| 57 | + if: matrix.os == 'ubuntu-latest' |
| 58 | + run: | |
| 59 | + sudo apt-get update |
| 60 | + sudo apt-get install -y \ |
| 61 | + build-essential \ |
| 62 | + cmake \ |
| 63 | + libglfw3-dev \ |
| 64 | + libglm-dev \ |
| 65 | + libxrandr-dev \ |
| 66 | + libxinerama-dev \ |
| 67 | + libxcursor-dev \ |
| 68 | + libxi-dev \ |
| 69 | + libopenal-dev \ |
| 70 | + libktx-dev |
| 71 | +
|
| 72 | + - name: Install project deps via script (Ubuntu) |
| 73 | + if: matrix.os == 'ubuntu-latest' |
| 74 | + working-directory: attachments/simple_engine |
| 75 | + run: | |
| 76 | + if [ -x ./install_dependencies_linux.sh ]; then |
| 77 | + ./install_dependencies_linux.sh || true |
| 78 | + fi |
| 79 | +
|
| 80 | + # ----------------------- |
| 81 | + # Windows dependencies |
| 82 | + # ----------------------- |
| 83 | + - name: Install vcpkg and dependencies (Windows) |
| 84 | + if: matrix.os == 'windows-latest' |
| 85 | + shell: pwsh |
| 86 | + run: | |
| 87 | + git clone https://github.com/microsoft/vcpkg.git $env:USERPROFILE\vcpkg |
| 88 | + & $env:USERPROFILE\vcpkg\bootstrap-vcpkg.bat |
| 89 | + $triplet = 'x64-windows' |
| 90 | + & $env:USERPROFILE\vcpkg\vcpkg.exe install ` |
| 91 | + vulkan:${triplet} ` |
| 92 | + glfw3:${triplet} ` |
| 93 | + glm:${triplet} ` |
| 94 | + tinygltf:${triplet} ` |
| 95 | + ktx:${triplet} ` |
| 96 | + openal-soft:${triplet} |
| 97 | + echo "CMAKE_TOOLCHAIN_FILE=$env:USERPROFILE\vcpkg\scripts\buildsystems\vcpkg.cmake" >> $env:GITHUB_ENV |
| 98 | + echo "VCPKG_TARGET_TRIPLET=$triplet" >> $env:GITHUB_ENV |
| 99 | +
|
| 100 | + - name: Install project deps via script (Windows) |
| 101 | + if: matrix.os == 'windows-latest' |
| 102 | + shell: cmd |
| 103 | + working-directory: attachments/simple_engine |
| 104 | + run: | |
| 105 | + if exist install_dependencies_windows.bat call install_dependencies_windows.bat |
| 106 | +
|
| 107 | + # ----------------------- |
| 108 | + # Configure & Build |
| 109 | + # ----------------------- |
| 110 | + - name: Configure (Unix) |
| 111 | + if: matrix.os == 'ubuntu-latest' |
| 112 | + run: | |
| 113 | + cmake -S attachments/simple_engine \ |
| 114 | + -B build-simple_engine-${{ matrix.os }}-${{ matrix.build_type }}-m${{ matrix.enable_module }} \ |
| 115 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 116 | + -DENABLE_CPP20_MODULE=${{ matrix.enable_module }} |
| 117 | +
|
| 118 | + - name: Configure (Windows) |
| 119 | + if: matrix.os == 'windows-latest' |
| 120 | + shell: pwsh |
| 121 | + run: | |
| 122 | + cmake -S attachments/simple_engine ` |
| 123 | + -B build-simple_engine-${{ matrix.os }}-${{ matrix.build_type }}-m${{ matrix.enable_module }} ` |
| 124 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` |
| 125 | + -DENABLE_CPP20_MODULE=${{ matrix.enable_module }} ` |
| 126 | + -DCMAKE_TOOLCHAIN_FILE="$env:CMAKE_TOOLCHAIN_FILE" ` |
| 127 | + -DVCPKG_TARGET_TRIPLET="$env:VCPKG_TARGET_TRIPLET" |
| 128 | +
|
| 129 | + - name: Build |
| 130 | + run: | |
| 131 | + cmake --build build-simple_engine-${{ matrix.os }}-${{ matrix.build_type }}-m${{ matrix.enable_module }} --config ${{ matrix.build_type }} |
| 132 | +
|
| 133 | + - name: Package (Release only) |
| 134 | + if: matrix.build_type == 'Release' |
| 135 | + run: | |
| 136 | + cmake --build build-simple_engine-${{ matrix.os }}-${{ matrix.build_type }}-m${{ matrix.enable_module }} --target package --config ${{ matrix.build_type }} |
0 commit comments