name: 🏁 Windows on: push: pull_request: schedule: - cron: '0 0 * * 2' env: CARGO_TERM_COLOR: always CZKAWKA_OFFICIAL_BUILD: ${{ vars.CZKAWKA_OFFICIAL_BUILD }} jobs: krokiet-compiled-on-linux: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install dependencies run: | sudo apt update || true sudo apt install -y mingw-w64 mingw-w64-x86-64-dev wget wget2 curl wine || true - name: Setup rust version run: | rustup default 1.94.1 rustup target add x86_64-pc-windows-gnu - name: Download rcedit run: | curl -L https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit-x64.exe - name: Compile Krokiet Release if: ${{ github.ref == 'refs/heads/master' }} run: | sed -i 's/#lto = /lto = /g' Cargo.toml sed -i 's/#codegen-units /codegen-units /g' Cargo.toml cargo build --release --target x86_64-pc-windows-gnu --bin krokiet mv target/x86_64-pc-windows-gnu/release/krokiet.exe windows_krokiet_on_linux.exe export WINEPREFIX=$(mktemp -d) wine rcedit-x64.exe windows_krokiet_on_linux.exe --set-icon krokiet/icons/krokiet_logo_flag.ico - name: Compile Krokiet Debug if: ${{ github.ref != 'refs/heads/master' }} run: | sed -i 's/^\(\[profile\.dev\.package.*\)/#\1/' Cargo.toml sed -i 's|^opt-level = 3 # OPT PACKAGES|#opt-level = 3 # OPT PACKAGES|' Cargo.toml cargo build --target x86_64-pc-windows-gnu --bin krokiet mv target/x86_64-pc-windows-gnu/debug/krokiet.exe windows_krokiet_on_linux.exe export WINEPREFIX=$(mktemp -d) wine rcedit-x64.exe windows_krokiet_on_linux.exe --set-icon krokiet/icons/krokiet_logo_flag.ico - name: Pack with 7z run: | time 7z a -t7z -mx=3 czkawka_all.7z \ windows_krokiet_on_linux.exe - name: Upload artifacts uses: actions/upload-artifact@v6 with: name: krokiet-windows-on-linux-${{ github.sha }} path: | czkawka_all.7z if-no-files-found: error - name: Release uses: softprops/action-gh-release@v3 if: ${{ github.ref == 'refs/heads/master' && vars.HAVE_PAT_REPOSITORY_TOKEN == '1' }} with: tag_name: "Nightly" files: | windows_krokiet_on_linux.exe token: ${{ secrets.PAT_REPOSITORY }} # Skia not provides support for gnu toolchain, which is easy to cross-compile - https://github.com/rust-skia/rust-skia/issues/345 # So need to compile krokiet on msvc Windows krokiet-compiled-on-windows: runs-on: windows-latest steps: - uses: actions/checkout@v6 - name: Setup rust version run: | rustup default 1.94.1 - name: Download rcedit run: | curl -L https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit-x64.exe - name: Compile Krokiet Release if: ${{ github.ref == 'refs/heads/master' }} run: | powershell -Command "(Get-Content Cargo.toml) -replace '#lto = ', 'lto = ' | Set-Content Cargo.toml; (Get-Content Cargo.toml) -replace '#codegen-units ', 'codegen-units ' | Set-Content Cargo.toml" cargo build --release --bin krokiet --no-default-features --features "winit_skia_opengl,winit_software" mv target/release/krokiet.exe windows_krokiet_on_windows_skia_opengl.exe cargo build --release --bin krokiet --no-default-features --features "winit_skia_vulkan,winit_software" mv target/release/krokiet.exe windows_krokiet_on_windows_skia_vulkan.exe cargo build --release --bin krokiet --no-default-features --features "femtovg_wgpu" mv target/release/krokiet.exe windows_krokiet_on_windows_femtovg_wgpu.exe cargo build --release --bin krokiet --no-default-features --features "winit_femtovg,winit_skia_opengl,winit_skia_vulkan,winit_software,femtovg_wgpu" mv target/release/krokiet.exe windows_krokiet_on_windows_all_backends.exe Get-ChildItem windows_krokiet_on_windows_*.exe | ForEach-Object { ./rcedit-x64.exe $_.Name --set-icon krokiet/icons/krokiet_logo_flag.ico } - name: Compile Krokiet Debug if: ${{ github.ref != 'refs/heads/master' }} run: | (Get-Content Cargo.toml) -replace '#lto = ','lto = ' -replace '#codegen-units ','codegen-units ' -replace '^\[profile\.dev\.package','#\[profile.dev.package' -replace '^opt-level = 3 # OPT PACKAGES','#opt-level = 3 # OPT PACKAGES' | Set-Content Cargo.toml cargo build --bin krokiet --no-default-features --features "winit_skia_opengl,winit_software" mv target/debug/krokiet.exe windows_krokiet_on_windows_skia_opengl.exe cargo build --bin krokiet --no-default-features --features "winit_skia_vulkan,winit_software" mv target/debug/krokiet.exe windows_krokiet_on_windows_skia_vulkan.exe cargo build --bin krokiet --no-default-features --features "femtovg_wgpu" mv target/debug/krokiet.exe windows_krokiet_on_windows_femtovg_wgpu.exe cargo build --bin krokiet --no-default-features --features "winit_femtovg,winit_skia_opengl,winit_skia_vulkan,winit_software,femtovg_wgpu" mv target/debug/krokiet.exe windows_krokiet_on_windows_all_backends.exe Get-ChildItem windows_krokiet_on_windows_*.exe | ForEach-Object { ./rcedit-x64.exe $_.Name --set-icon krokiet/icons/krokiet_logo_flag.ico } - name: Package krokiet with launchers run: pwsh misc/pack_all_backends.ps1 -Binary windows_krokiet_on_windows_all_backends.exe -OutputZip windows_krokiet_on_windows_all_backends.zip - name: Upload artifacts uses: actions/upload-artifact@v6 with: name: krokiet-windows-on-windows-${{ github.sha }} path: | windows_krokiet_on_windows_all_backends.zip windows_krokiet_on_windows_skia_opengl.exe windows_krokiet_on_windows_skia_vulkan.exe windows_krokiet_on_windows_femtovg_wgpu.exe if-no-files-found: error - name: Release uses: softprops/action-gh-release@v3 if: ${{ github.ref == 'refs/heads/master' && vars.HAVE_PAT_REPOSITORY_TOKEN == '1' }} with: tag_name: "Nightly" files: | windows_krokiet_on_windows_all_backends.zip windows_krokiet_on_windows_skia_opengl.exe windows_krokiet_on_windows_skia_vulkan.exe windows_krokiet_on_windows_femtovg_wgpu.exe token: ${{ secrets.PAT_REPOSITORY }} container_4_12: needs: krokiet-compiled-on-windows runs-on: ubuntu-latest container: image: ghcr.io/mglolenstine/gtk4-cross:gtk-4.12 steps: - uses: actions/checkout@v6 - name: Download Krokiet (skia opengl) artifact uses: actions/download-artifact@v7 with: name: krokiet-windows-on-windows-${{ github.sha }} - name: Install additional dependencies # gio is for the build script run: | dnf install curl wget2 wget unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme wine -y && dnf clean all -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y source "$HOME/.cargo/env" rustup default 1.94.1 rustup target add x86_64-pc-windows-gnu mkdir -p package curl -L https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit-x64.exe - name: Cross compile for Windows - Release if: ${{ github.ref == 'refs/heads/master' }} run: | source "$HOME/.cargo/env" export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:$MINGW_PREFIX/lib/pkgconfig/:/usr/x86_64-w64-mingw32/lib/pkgconfig/ cargo build --target=x86_64-pc-windows-gnu --release --locked -p czkawka_gui -p czkawka_cli cp target/x86_64-pc-windows-gnu/release/czkawka_gui.exe package/ cp target/x86_64-pc-windows-gnu/release/czkawka_cli.exe package/ export WINEPREFIX=$(mktemp -d) wine rcedit-x64.exe package/czkawka_gui.exe --set-icon czkawka_gui/icons/icon.ico - name: Cross compile for Windows - Debug if: ${{ github.ref != 'refs/heads/master' }} run: | source "$HOME/.cargo/env" export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:$MINGW_PREFIX/lib/pkgconfig/:/usr/x86_64-w64-mingw32/lib/pkgconfig/ cargo build --target=x86_64-pc-windows-gnu --locked --profile fastci -p czkawka_gui -p czkawka_cli cp target/x86_64-pc-windows-gnu/fastci/czkawka_gui.exe package/ cp target/x86_64-pc-windows-gnu/fastci/czkawka_cli.exe package/ export WINEPREFIX=$(mktemp -d) wine rcedit-x64.exe package/czkawka_gui.exe --set-icon czkawka_gui/icons/icon.ico - name: Package run: | #!/bin/bash set -euo pipefail cp -t package $(pds -vv -f package/*.exe) # Add gdbus which is recommended on Windows (why?) cp $MINGW_PREFIX/bin/gdbus.exe package # Handle the glib schema compilation as well glib-compile-schemas $MINGW_PREFIX/share/glib-2.0/schemas/ mkdir -p package/share/glib-2.0/schemas/ cp -T $MINGW_PREFIX/share/glib-2.0/schemas/gschemas.compiled package/share/glib-2.0/schemas/gschemas.compiled # Pixbuf stuff, in order to get SVGs (scalable icons) to load mkdir -p package/lib/gdk-pixbuf-2.0 cp -rT $MINGW_PREFIX/lib/gdk-pixbuf-2.0 package/lib/gdk-pixbuf-2.0 cp -f -t package $(pds -vv -f $MINGW_PREFIX/lib/gdk-pixbuf-2.0/2.10.0/loaders/*) find package -iname "*.dll" -or -iname "*.exe" -type f -exec mingw-strip {} + cd package/share wget2 https://github.com/qarmin/czkawka/files/10832192/gtk4_theme.zip unzip gtk4_theme.zip rm gtk4_theme.zip cd ../.. wget2 https://github.com/qarmin/Automated-Fuzzer/releases/download/test/libGL.zip unzip libGL.zip mv libEGL.dll package/ mv libGLESv2.dll package/ unzip windows_krokiet_on_windows_all_backends.zip -d package/ { echo '# Czkawka' echo '' echo 'This package includes the legacy GTK 4 GUI (czkawka_gui.exe), which is now deprecated.' echo '' echo 'The recommended successor is Krokiet.' echo '' echo '**krokiet.exe** (also included in this package) is a new application created by the author of Czkawka.' echo 'It offers better performance, more features, improved Windows/macOS support compared to the legacy GTK GUI.' echo '' echo 'More information: https://github.com/qarmin/czkawka' echo '' echo '## Switching graphics backend' echo '' echo 'If the app window does not appear or rendering looks wrong, open one of the .bat files' echo 'to launch with a different graphics backend:' echo '' echo 'Krokiet:' echo ' krokiet_winit_femtovg.bat - OpenGL via femtovg (default)' echo ' krokiet_winit_skia_opengl.bat - Skia with OpenGL' echo ' krokiet_winit_skia_vulkan.bat - Skia with Vulkan' echo ' krokiet_winit_software.bat - CPU software rendering (slowest, most compatible)' echo ' krokiet_femtovg_wgpu.bat - femtovg with wgpu' echo '' echo 'Czkawka GTK (legacy):' echo ' czkawka_gui_cairo_renderer.bat - Cairo renderer' echo ' czkawka_gui_opengl_renderer.bat - OpenGL renderer' echo ' czkawka_gui_vulkan_renderer.bat - Vulkan renderer' } > package/README.md echo "Really use Krokiet" > package/USE_KROKIET_INSTEAD_CZKAWKA_GTK.txt echo "I'm not joking, just use Krokiet" > package/USE_KROKIET_JUST_USE_IT.txt echo "Seriously, Czkawka GUI is deprecated, use Krokiet" > package/USE_KROKIET_SERIOUSLY.txt # czkawka_gui renderer launcher scripts (GSK_RENDERER) printf '@echo off\r\nset GSK_RENDERER=cairo\r\n"%%~dp0czkawka_gui.exe" %%*\r\n' > package/czkawka_gui_cairo_renderer.bat printf '@echo off\r\nset GSK_RENDERER=opengl\r\n"%%~dp0czkawka_gui.exe" %%*\r\n' > package/czkawka_gui_opengl_renderer.bat printf '@echo off\r\nset GSK_RENDERER=vulkan\r\n"%%~dp0czkawka_gui.exe" %%*\r\n' > package/czkawka_gui_vulkan_renderer.bat - name: Upload artifacts uses: actions/upload-artifact@v6 with: name: czkawka-windows-${{ github.sha }}-4.12 path: | ./package if-no-files-found: error - name: Prepare files to release run: | cd package zip -r ../windows_czkawka_gui_gtk_412.zip . cd .. - name: Release uses: softprops/action-gh-release@v3 if: ${{ github.ref == 'refs/heads/master' && vars.HAVE_PAT_REPOSITORY_TOKEN == '1' }} with: tag_name: "Nightly" files: | windows_czkawka_gui_gtk_412.zip token: ${{ secrets.PAT_REPOSITORY }} windows-tests: runs-on: windows-latest steps: - uses: actions/checkout@v6 - name: Setup rust version run: | rustup default 1.94.1 # Both additional features and gtk gui are non-testable due really complicated setup of environment on Windows - name: Test run: | cargo test -p czkawka_core -p krokiet