publish-natives #52
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: publish-natives | |
| on: | |
| workflow_dispatch: | |
| concurrency: | |
| group: "pub" | |
| cancel-in-progress: true | |
| jobs: | |
| linux: | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| - target: i686-unknown-linux-gnu | |
| deps: apt-get install -y gcc-multilib | |
| - target: aarch64-unknown-linux-gnu | |
| deps: apt-get install -y gcc-aarch64-linux-gnu | |
| - target: armv7-unknown-linux-gnueabihf | |
| deps: apt-get install -y gcc-arm-linux-gnueabihf | |
| name: Publish ${{ matrix.target }} | |
| environment: MavenRelease | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ubuntu:18.04 | |
| steps: | |
| - name: Checkout sources | |
| uses: taiki-e/checkout-action@v1 | |
| - name: Install Essentials | |
| run: | | |
| apt-get update -y | |
| apt-get upgrade -y | |
| apt-get install -y curl gcc openjdk-17-jdk-headless | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.target }} | |
| - name: Install linker dependencies | |
| run: ${{ matrix.deps }} | |
| if: ${{ matrix.deps != '' }} | |
| - name: Build and Publish | |
| env: | |
| JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }} | |
| JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.MAVENCENTRAL_TOKEN }} | |
| JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | |
| JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | |
| JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| run: ./gradlew native:publish native:jreleaserRelease -Ptarget=${{ matrix.target }} | |
| linux-musl: | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-musl | |
| arch: x86_64 | |
| - target: aarch64-unknown-linux-musl | |
| arch: aarch64 | |
| name: Publish ${{ matrix.target }} | |
| environment: MavenRelease | |
| runs-on: ubuntu-latest | |
| container: | |
| image: clux/muslrust:stable | |
| steps: | |
| - name: Checkout sources | |
| uses: taiki-e/checkout-action@v1 | |
| - name: Install Essentials | |
| run: | | |
| apt-get update -y | |
| apt-get upgrade -y | |
| apt-get install -y gcc musl-tools curl openjdk-17-jdk-headless | |
| - name: Install Rust toolchain | |
| run: | | |
| rustup target add x86_64-unknown-linux-musl ${{ matrix.target }} | |
| - name: Install linker dependencies | |
| run: | | |
| mkdir -p /opt/musl | |
| curl -L https://github.com/MinnDevelopment/musl-cross-mirror/releases/download/v0.0.1/${{ matrix.arch }}-linux-musl-cross.tgz | tar xz -C /opt/musl | |
| - name: Build and Publish | |
| env: | |
| JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }} | |
| JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.MAVENCENTRAL_TOKEN }} | |
| JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | |
| JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | |
| JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| RUSTFLAGS: "-C target-feature=-crt-static -C link-args=-static-libgcc" | |
| run: | | |
| export PATH="/opt/musl/${{ matrix.arch }}-linux-musl-cross/bin:$PATH" | |
| ./gradlew native:publish native:jreleaserRelease -Ptarget=${{ matrix.target }} | |
| windows: | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-pc-windows-msvc | |
| - target: i686-pc-windows-msvc | |
| name: Publish ${{ matrix.target }} | |
| environment: MavenRelease | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| target: ${{ matrix.target }} | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: Build and Publish | |
| env: | |
| JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }} | |
| JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.MAVENCENTRAL_TOKEN }} | |
| JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | |
| JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | |
| JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| run: ./gradlew native:publish native:jreleaserRelease -Ptarget=${{ matrix.target }} | |
| macos: | |
| name: Build macOS universal binary | |
| environment: MavenRelease | |
| runs-on: macos-14 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - name: Compile natives | |
| working-directory: native | |
| run: | | |
| rustup target add x86_64-apple-darwin | |
| cargo build -r --target=x86_64-apple-darwin | |
| rustup target add aarch64-apple-darwin | |
| cargo build -r --target=aarch64-apple-darwin | |
| - name: Create target directory for darwin | |
| run: mkdir -p native/target/darwin/release | |
| - name: Combine to universal dylib | |
| run: lipo -create -output native/target/darwin/release/libudpqueue.dylib native/target/**/release/*.dylib | |
| - name: Build and Publish | |
| env: | |
| JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }} | |
| JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.MAVENCENTRAL_TOKEN }} | |
| JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | |
| JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | |
| JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| run: ./gradlew native:publish native:jreleaserRelease -Ptarget=${{ matrix.target }} -x cargoBuild |