diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 00000000..6c07b0a1 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,87 @@ +name: Build Project + +on: + workflow_dispatch: + push: + branches: + - windows-actions + +env: + CMAKE_PRESET: x64-Clang-Release + +jobs: + build: + name: Build Windows + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + token: ${{ secrets.ORG_TOKEN }} + + - name: Checkout private repository + uses: actions/checkout@v4 + with: + repository: ${{ secrets.ASSET_REPO }} + token: ${{ secrets.ASSET_REPO_TOKEN }} + path: .\private + + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ccache-${{ runner.os }} + + - name: Cache vcpkg + uses: actions/cache@v4 + with: + path: | + ./thirdparty/vcpkg/downloads + ./thirdparty/vcpkg/packages + key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }} + + - name: Install dependencies + run: | + choco install ninja + Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force -ErrorAction SilentlyContinue + + - name: Configure Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1 + + - name: Prepare Project + run: | + $commitMessage = git log -1 --pretty=%s + Add-Content -Path $env:GITHUB_ENV -Value "commit_message=$commitMessage" + copy .\private\* .\UnleashedRecompLib\private + + - name: Configure Project + run: cmake . --preset ${{ env.CMAKE_PRESET }} -DSDL2MIXER_VORBIS=VORBISFILE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache + + - name: Build Project + run: cmake --build .\out\build\${{ env.CMAKE_PRESET }} --target UnleashedRecomp + + - name: Pack Release + run: | + New-Item -ItemType Directory -Path .\release + New-Item -ItemType Directory -Path .\release\D3D12 + + Move-Item -Path ".\out\build\${{ env.CMAKE_PRESET }}\UnleashedRecomp\D3D12\D3D12Core.dll" -Destination ".\release\D3D12\D3D12Core.dll" + Move-Item -Path ".\out\build\${{ env.CMAKE_PRESET }}\UnleashedRecomp\dxcompiler.dll" -Destination ".\release\dxcompiler.dll" + Move-Item -Path ".\out\build\${{ env.CMAKE_PRESET }}\UnleashedRecomp\dxil.dll" -Destination ".\release\dxil.dll" + Move-Item -Path ".\out\build\${{ env.CMAKE_PRESET }}\UnleashedRecomp\UnleashedRecomp.exe" -Destination ".\release\UnleashedRecomp.exe" + + Compress-Archive -Path .\release\* -DestinationPath .\UnleashedRecomp-Windows.zip + + - name: Upload artifact to Discord + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + if: ${{ env.DISCORD_WEBHOOK != '' }} + uses: tsickert/discord-webhook@v6.0.0 + with: + webhook-url: ${{ env.DISCORD_WEBHOOK }} + content: | + Summary: ${{ env.commit_message }} + Commit: ${{ github.sha }} + Branch: ${{ github.ref_name }} + filename: .\UnleashedRecomp-Windows.zip \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json index 3c2d0987..72710ec3 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -23,8 +23,7 @@ "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" - }, - "toolset": "ClangCL" + } }, { "name": "x64-Clang-Debug",