diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..84ccdaa --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,87 @@ +name: Windows Build + +on: + push: + branches: [main] + tags: ['v*'] + pull_request: + branches: [main] + +jobs: + build-windows: + name: Windows x64 (MSVC + vcpkg) + runs-on: windows-latest + + env: + VCPKG_DEFAULT_TRIPLET: x64-windows + # vcpkg Binary Caching → deutlich schnellere CI-Durchläufe + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + + steps: + - name: Checkout + uses: actions/checkout@v4 + + # vcpkg Binary Cache via GitHub Actions Cache + - name: Export GitHub Actions cache vars + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Setup vcpkg + uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: '0a66b5fd01fc1515eb7a48c6dc5b1dcc1ce2f6bc' # stable snapshot + + - name: Install dependencies via vcpkg + run: | + vcpkg install opencv4:x64-windows libraw:x64-windows qt:x64-windows + shell: pwsh + + - name: Configure CMake + run: | + cmake -B build -G Ninja ` + -DCMAKE_BUILD_TYPE=Release ` + -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" ` + -DVCPKG_TARGET_TRIPLET=x64-windows ` + -DBUILD_GUI=ON ` + -DBUILD_TESTS=OFF + shell: pwsh + + - name: Build + run: cmake --build build --config Release --parallel + shell: pwsh + + - name: Install (collect EXE + DLLs) + run: cmake --install build --prefix dist + shell: pwsh + + - name: Deploy Qt DLLs (windeployqt) + run: | + $qtBin = (Get-ChildItem "$env:VCPKG_ROOT/installed/x64-windows/tools/qt6/bin" -Filter "windeployqt*.exe" -ErrorAction SilentlyContinue | Select-Object -First 1)?.FullName + if ($qtBin) { + & $qtBin --release --no-translations dist/bin/negative-converter.exe + } else { + Write-Warning "windeployqt not found, skipping Qt DLL deployment" + } + shell: pwsh + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: negative-converter-windows-x64 + path: dist/ + if-no-files-found: error + + # Nur bei Git-Tags: Release erstellen und ZIP anhängen + - name: Create ZIP for release + if: startsWith(github.ref, 'refs/tags/') + run: Compress-Archive -Path dist/* -DestinationPath negative-converter-windows-x64.zip + shell: pwsh + + - name: Upload to GitHub Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + with: + files: negative-converter-windows-x64.zip