|
| 1 | +name: Build Project |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + linux: |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + include: |
| 13 | + - target: x86_64-unknown-linux-gnu |
| 14 | + - target: i686-unknown-linux-gnu |
| 15 | + deps: apt-get install -y gcc-multilib |
| 16 | + - target: aarch64-unknown-linux-gnu |
| 17 | + deps: apt-get install -y gcc-aarch64-linux-gnu |
| 18 | + - target: armv7-unknown-linux-gnueabihf |
| 19 | + deps: apt-get install -y gcc-arm-linux-gnueabihf |
| 20 | + |
| 21 | + name: Build ${{ matrix.target }} |
| 22 | + runs-on: ubuntu-latest |
| 23 | + container: |
| 24 | + image: ubuntu:18.04 |
| 25 | + steps: |
| 26 | + - name: Checkout sources |
| 27 | + uses: taiki-e/checkout-action@v1 |
| 28 | + - name: Install Essentials |
| 29 | + run: | |
| 30 | + apt-get update -y |
| 31 | + apt-get upgrade -y |
| 32 | + apt-get install -y curl gcc openjdk-17-jdk-headless |
| 33 | + - name: Install Rust toolchain |
| 34 | + uses: dtolnay/rust-toolchain@stable |
| 35 | + with: |
| 36 | + toolchain: stable |
| 37 | + targets: ${{ matrix.target }} |
| 38 | + - name: Install linker dependencies |
| 39 | + run: ${{ matrix.deps }} |
| 40 | + if: ${{ matrix.deps != '' }} |
| 41 | + - name: Run Gradle Build |
| 42 | + run: ./gradlew build -Ptarget=${{ matrix.target }} |
| 43 | + windows: |
| 44 | + strategy: |
| 45 | + matrix: |
| 46 | + include: |
| 47 | + - target: x86_64-pc-windows-msvc |
| 48 | + - target: i686-pc-windows-msvc |
| 49 | + |
| 50 | + name: Build ${{ matrix.target }} |
| 51 | + runs-on: windows-2022 |
| 52 | + steps: |
| 53 | + - name: Checkout sources |
| 54 | + uses: actions/checkout@v6 |
| 55 | + - name: Install Rust toolchain |
| 56 | + uses: dtolnay/rust-toolchain@stable |
| 57 | + with: |
| 58 | + toolchain: stable |
| 59 | + target: ${{ matrix.target }} |
| 60 | + - name: Set up JDK |
| 61 | + uses: actions/setup-java@v5 |
| 62 | + with: |
| 63 | + distribution: 'temurin' |
| 64 | + java-version: '17' |
| 65 | + cache: 'gradle' |
| 66 | + - name: Run Gradle Build |
| 67 | + run: ./gradlew build -Ptarget=${{ matrix.target }} |
| 68 | + |
| 69 | + macos: |
| 70 | + name: Build macOS universal binary |
| 71 | + runs-on: macos-14 |
| 72 | + steps: |
| 73 | + - name: Checkout sources |
| 74 | + uses: actions/checkout@v6 |
| 75 | + |
| 76 | + - name: Install Rust toolchain |
| 77 | + uses: dtolnay/rust-toolchain@stable |
| 78 | + with: |
| 79 | + toolchain: stable |
| 80 | + |
| 81 | + - name: Compile natives |
| 82 | + working-directory: native |
| 83 | + run: | |
| 84 | + rustup target add x86_64-apple-darwin |
| 85 | + cargo build -r --target=x86_64-apple-darwin |
| 86 | + rustup target add aarch64-apple-darwin |
| 87 | + cargo build -r --target=aarch64-apple-darwin |
| 88 | +
|
| 89 | + - name: Create target directory for darwin |
| 90 | + run: mkdir -p native/target/darwin/release |
| 91 | + |
| 92 | + - name: Combine to universal dylib |
| 93 | + run: lipo -create -output native/target/darwin/release/libudpqueue.dylib native/target/**/release/*.dylib |
| 94 | + |
| 95 | + - name: Run Gradle Build |
| 96 | + run: ./gradlew build -x cargoBuild -Ptarget=darwin |
0 commit comments