Add profiler and optimize some functions and add GUI to build workflo… #8
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: | |
| build: | |
| name: Build (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| cli: packobf_cli.exe | |
| gui: packobf_gui.exe | |
| java-lib: rust.dll | |
| - os: macos-latest | |
| cli: packobf_cli | |
| gui: packobf_gui | |
| java-lib: librust.dylib | |
| - os: ubuntu-latest | |
| cli: packobf_cli | |
| gui: packobf_gui | |
| java-lib: librust.so | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| - uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-about | |
| - name: Build | |
| run: cargo build --release | |
| - name: Prepare License | |
| run: cargo about generate about.hbs | perl -0777 -pe 's/\s+$/\n/' | tee -a LICENSE.md > /dev/null | |
| - name: Prepare CLI Executable | |
| # Always make sure files that are published contain the license files | |
| run: | | |
| rm -rf dist && mkdir -p dist | |
| cp target/release/${{ matrix.cli }} dist/ | |
| cp LICENSE.md dist/ | |
| - name: Upload CLI Executable | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cli-${{ matrix.os }} | |
| path: dist/* | |
| - name: Prepare GUI Executable | |
| # Always make sure files that are published contain the license files | |
| run: | | |
| rm -rf dist && mkdir -p dist | |
| cp target/release/${{ matrix.gui }} dist/ | |
| cp LICENSE.md dist/ | |
| - name: Upload GUI Executable | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gui-${{ matrix.os }} | |
| path: dist/* | |
| - name: Prepare Java Native Library | |
| run: | | |
| rm -rf dist && mkdir -p dist | |
| cp target/release/${{ matrix.java-lib }} dist/ | |
| cp LICENSE.md dist/ | |
| - name: Upload Java Native Library | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: java-lib-${{ matrix.os }} | |
| 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 native | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-ubuntu-latest | |
| path: artifacts/native/linux | |
| - name: Download MacOS native | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-macos-latest | |
| path: artifacts/native/macos | |
| - name: Download Windows native | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-windows-latest | |
| path: artifacts/native/windows | |
| - name: Copy native libraries | |
| run: | | |
| mkdir -p java/build/external-natives | |
| cp artifacts/native/linux/librust.so java/build/external-natives/ | |
| cp artifacts/native/macos/librust.dylib java/build/external-natives/ | |
| cp artifacts/native/windows/rust.dll java/build/external-natives/ | |
| cp artifacts/native/linux/LICENSE.md 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 |