Switch from ImGui to Qt (GUI App) #44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| paths-ignore: | |
| - 'README.md' | |
| branches: [ "main" ] | |
| pull_request: | |
| paths-ignore: | |
| - 'README.md' | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| jobs: | |
| license: | |
| name: Generate License | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Cache LICENSE.md | |
| id: cache-license | |
| uses: actions/cache@v4 | |
| with: | |
| path: LICENSE.md | |
| key: license-${{ hashFiles('Cargo.lock', 'about.hbs', 'about.toml') }} | |
| - name: Install cargo-about | |
| if: steps.cache-license.outputs.cache-hit != 'true' | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-about | |
| - name: Generate LICENSE.md | |
| if: steps.cache-license.outputs.cache-hit != 'true' | |
| run: | | |
| cargo about generate about.hbs | perl -0777 -pe 's/\s+$/\n/' | tee -a LICENSE.md > /dev/null | |
| - name: Upload LICENSE.md | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: generated-license | |
| path: LICENSE.md | |
| build: | |
| name: Build (${{ matrix.artifact }}) | |
| runs-on: ${{ matrix.os }} | |
| needs: license | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux x64 GNU | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact: linux-x86_64 | |
| cli: packobf_cli | |
| gui: packobf_gui | |
| java-lib: librust.so | |
| qt-arch: linux_gcc_64 | |
| # Linux x64 MUSL | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| artifact: linux-x86_64-musl | |
| cli: packobf_cli | |
| gui: "" | |
| java-lib: librust.so | |
| qt-arch: "" | |
| # Linux ARM64 | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| artifact: linux-aarch64 | |
| cli: packobf_cli | |
| gui: "" | |
| java-lib: librust.so | |
| qt-arch: "" | |
| # macOS Intel | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact: macos-x86_64 | |
| cli: packobf_cli | |
| gui: packobf_gui | |
| java-lib: librust.dylib | |
| qt-arch: clang_64 | |
| # macOS Apple Silicon | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact: macos-aarch64 | |
| cli: packobf_cli | |
| gui: packobf_gui | |
| java-lib: librust.dylib | |
| qt-arch: clang_64 | |
| # Windows x64 | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact: windows-x86_64 | |
| cli: packobf_cli.exe | |
| gui: packobf_gui.exe | |
| java-lib: rust.dll | |
| qt-arch: win64_msvc2022_64 | |
| # Windows ARM64 | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| artifact: windows-aarch64 | |
| cli: packobf_cli.exe | |
| gui: "" | |
| java-lib: rust.dll | |
| qt-arch: "" | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.target }} | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install Qt | |
| if: matrix.gui != '' | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: '6.8.3' | |
| arch: ${{ matrix.qt-arch }} | |
| - name: Install cross (linux-x86_64-musl and linux-aarch64) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'x86_64-unknown-linux-musl' | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cross | |
| - name: Build | |
| if: matrix.target != 'aarch64-unknown-linux-gnu' && matrix.target != 'x86_64-unknown-linux-musl' | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Build (linux-aarch64) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: cross build --release --target ${{ matrix.target }} -p packobf_cli -p rust | |
| - name: Build (linux-x86_64-musl) | |
| if: matrix.target == 'x86_64-unknown-linux-musl' | |
| run: cross build --release --target ${{ matrix.target }} -p packobf_cli | |
| - name: Download LICENSE.md | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: generated-license | |
| - name: Prepare CLI Executable | |
| # Always make sure files that are published contain the license files | |
| run: | | |
| rm -rf dist && mkdir -p dist | |
| cp target/${{ matrix.target }}/release/${{ matrix.cli }} dist/ | |
| cp LICENSE.md dist/ | |
| - name: Upload CLI Executable | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cli-${{ matrix.artifact }} | |
| path: dist/* | |
| - name: Prepare GUI Executable | |
| if: matrix.gui != '' | |
| # Always make sure files that are published contain the license files | |
| run: | | |
| rm -rf dist && mkdir -p dist | |
| cp target/${{ matrix.target }}/release/${{ matrix.gui }} dist/ | |
| cp LICENSE.md dist/ | |
| - name: Deploy Qt Dependencies (Windows) | |
| if: runner.os == 'Windows' && matrix.gui != '' | |
| run: | | |
| windeployqt --qmldir packobf_gui dist/${{ matrix.gui }} | |
| cp /c/Windows/System32/msvcp140.dll dist/ | |
| cp /c/Windows/System32/vcruntime140.dll dist/ | |
| cp /c/Windows/System32/msvcp140_1.dll dist/ | |
| cp /c/Windows/System32/msvcp140_2.dll dist/ | |
| cp /c/Windows/System32/vcruntime140_1.dll dist/ | |
| - name: Deploy Qt Dependencies (macOS) | |
| if: runner.os == 'macOS' && matrix.gui != '' | |
| run: | | |
| mkdir -p dist/packobf_gui.app/Contents/MacOS | |
| cp dist/${{ matrix.gui }} dist/packobf_gui.app/Contents/MacOS/ | |
| macdeployqt dist/packobf_gui.app -dmg -qmldir=packobf_gui | |
| rm -rf dist/packobf_gui.app | |
| rm -f dist/${{ matrix.gui }} | |
| - name: Deploy Qt Dependencies (Linux) | |
| if: runner.os == 'Linux' && matrix.gui != '' | |
| run: | | |
| wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" | |
| chmod +x linuxdeployqt-continuous-x86_64.AppImage | |
| cat <<EOF > dist/packobf_gui.desktop | |
| [Desktop Entry] | |
| Type=Application | |
| Name=packobf | |
| Exec=packobf_gui | |
| Icon=packobf_gui | |
| Categories=Utility; | |
| EOF | |
| touch dist/packobf_gui.png | |
| export APPIMAGE_EXTRACT_AND_RUN=1 | |
| ./linuxdeployqt-continuous-x86_64.AppImage dist/${{ matrix.gui }} -appimage -qmldir=packobf_gui | |
| mv *.AppImage dist/ 2>/dev/null || true | |
| rm -f dist/packobf_gui.desktop dist/packobf_gui.png | |
| - name: Upload GUI Executable | |
| if: matrix.gui != '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gui-${{ matrix.artifact }} | |
| path: dist/* | |
| - name: Prepare Java Native Library | |
| if: matrix.target != 'x86_64-unknown-linux-musl' | |
| run: | | |
| rm -rf dist && mkdir -p dist | |
| cp target/${{ matrix.target }}/release/${{ matrix.java-lib }} dist/ | |
| cp LICENSE.md dist/ | |
| - name: Upload Java Native Library | |
| if: matrix.target != 'x86_64-unknown-linux-musl' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: java-lib-${{ matrix.artifact }} | |
| path: dist/* | |
| buildJava: | |
| name: Build Java Library | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: graalvm/setup-graalvm@v1 | |
| with: | |
| java-version: '21' | |
| distribution: 'graalvm' | |
| cache: 'gradle' | |
| - name: Download Linux x64 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-linux-x86_64 | |
| path: artifacts/native/linux-x86_64 | |
| - name: Download Linux ARM64 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-linux-aarch64 | |
| path: artifacts/native/linux-aarch64 | |
| - name: Download macOS Intel | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-macos-x86_64 | |
| path: artifacts/native/macos-x86_64 | |
| - name: Download macOS ARM | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-macos-aarch64 | |
| path: artifacts/native/macos-aarch64 | |
| - name: Download Windows x64 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-windows-x86_64 | |
| path: artifacts/native/windows-x86_64 | |
| - name: Download Windows ARM | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-windows-aarch64 | |
| path: artifacts/native/windows-aarch64 | |
| - name: Copy native libraries | |
| run: | | |
| mkdir -p java/build/external-natives | |
| cp -r artifacts/native/linux-x86_64 java/build/external-natives/ | |
| cp -r artifacts/native/linux-aarch64 java/build/external-natives/ | |
| cp -r artifacts/native/macos-x86_64 java/build/external-natives/ | |
| cp -r artifacts/native/macos-aarch64 java/build/external-natives/ | |
| cp -r artifacts/native/windows-x86_64 java/build/external-natives/ | |
| cp -r artifacts/native/windows-aarch64 java/build/external-natives/ | |
| - name: Build | |
| run: | | |
| cd java | |
| ./gradlew build | |
| - name: Upload jar | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: java-package | |
| path: java/build/libs/*.jar |