As macos-latest for macos-x86_64 build #22
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.artifact }}) | |
| runs-on: ${{ matrix.os }} | |
| 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 | |
| # Linux x64 MUSL | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| artifact: linux-x86_64-musl | |
| cli: packobf_cli | |
| gui: packobf_gui | |
| java-lib: librust.so | |
| # Linux ARM64 | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| artifact: linux-aarch64 | |
| cli: packobf_cli | |
| gui: packobf_gui | |
| java-lib: librust.so | |
| # macOS Intel | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact: macos-x86_64 | |
| cli: packobf_cli | |
| gui: packobf_gui | |
| java-lib: librust.dylib | |
| # macOS Apple Silicon | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact: macos-aarch64 | |
| cli: packobf_cli | |
| gui: packobf_gui | |
| java-lib: librust.dylib | |
| # 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 | |
| # Windows ARM64 | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| artifact: windows-aarch64 | |
| cli: packobf_cli.exe | |
| gui: packobf_gui.exe | |
| java-lib: rust.dll | |
| 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 cargo-about | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-about | |
| - name: Install cross (For aarch64-unknown-linux-gnu) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| 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 }} | |
| - name: Build Linux x86_64 musl | |
| if: matrix.target == 'x86_64-unknown-linux-musl' | |
| run: cargo build --release --target ${{ matrix.target }} -p packobf_cli -p packobf_gui | |
| - 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/${{ 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 | |
| # 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: Upload GUI Executable | |
| 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 |