name: Windows Build (CLang) on: push: branches: [ "main", "release-**"] pull_request: branches: [ "main", "dev" ] workflow_call: inputs: build_name: required: true type: string description: 'Build name passed as VC_BUILD_NAME define' jobs: build-windows: strategy: matrix: include: - os: windows-latest compiler: clang runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 with: submodules: 'true' - name: Cache MSYS2 uses: actions/cache@v3 id: cache-msys2 with: path: C:/msys64 key: msys2-clang64-${{ runner.os }} - name: Cache vcpkg id: cache-vcpkg uses: actions/cache@v3 with: path: vcpkg key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'vcpkg.lock') }} restore-keys: | vcpkg-${{ runner.os }}- - name: Cache vcpkg packages uses: actions/cache@v3 with: path: vcpkg/packages key: vcpkg-pkgs-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'vcpkg.lock') }} restore-keys: | vcpkg-pkgs-${{ runner.os }}- - uses: msys2/setup-msys2@v2 id: msys2 name: Setup MSYS2 with: msystem: clang64 install: >- mingw-w64-clang-x86_64-toolchain mingw-w64-clang-x86_64-cmake git - name: Set up vcpkg shell: msys2 {0} if: steps.cache-vcpkg.outputs.cache-hit != 'true' run: | git clone https://github.com/microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.bat cd .. - name: Configure project with CMake and vcpkg env: VCPKG_DEFAULT_TRIPLET: x64-mingw-static VCPKG_DEFAULT_HOST_TRIPLET: x64-mingw-static shell: msys2 {0} run: | export VCPKG_ROOT=$(pwd)/vcpkg mkdir build cd build cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVC_BUILD_NAME="${{ inputs.build_name }}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake .. cmake --build . --config Release - name: Package for Windows run: | mkdir packaged mkdir packaged/res cp build/VoxelEngine.exe packaged/ cp build/vctest/vctest.exe packaged/ cp build/*.dll packaged/ cp -r build/res/* packaged/res/ mv packaged/VoxelEngine.exe packaged/VoxelCore.exe - uses: actions/upload-artifact@v4 with: name: Windows-Build path: 'packaged/*' - name: Run engine tests shell: msys2 {0} working-directory: ${{ github.workspace }} run: | packaged/vctest.exe -e packaged/VoxelCore.exe -d dev/tests -u build