diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fb9902..4adea51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,21 +14,32 @@ jobs: build: strategy: matrix: - build: [linux, windows, mac] + build: [linux-x86_64, windows-x86, windows-x86_64, windows-aarch64] include: - - build: linux + - build: linux-x86_64 os: ubuntu-latest - rust: "stable" - - build: windows + target: x86_64-unknown-linux-gnu + - build: windows-x86 os: windows-latest - rust: "stable" - - build: mac - os: macos-latest - rust: "stable" + target: i686-pc-windows-msvc + msvc_arch: amd64_x86 + - build: windows-x86_64 + os: windows-latest + target: x86_64-pc-windows-msvc + msvc_arch: amd64 + - build: windows-aarch64 + os: windows-latest + target: aarch64-pc-windows-msvc + msvc_arch: amd64_arm64 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + - name: Install C toolchain (Windows) + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.msvc_arch }} - name: Install packages (Linux) if: runner.os == 'Linux' uses: awalsh128/cache-apt-pkgs-action@v1.4.3 @@ -39,12 +50,13 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: ${{ matrix.rust }} + toolchain: stable - uses: Swatinem/rust-cache@v2 + - run: rustup target add ${{ matrix.target }} - name: Build - run: cargo build --verbose + run: cargo build --verbose --target ${{ matrix.target }} - name: Build release binary - run: cargo build --release + run: cargo build --release --target ${{ matrix.target }} - name: Upload a Build Artifact uses: actions/upload-artifact@v4 with: @@ -53,3 +65,58 @@ jobs: target/**/ornithe-installer-rs* !target/**/ornithe-installer-rs.d !target/**/build/ + build_macos: + runs-on: ubuntu-latest + container: ghcr.io/rust-cross/cargo-zigbuild:0.20 + steps: + - uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 + - run: rustup target add aarch64-apple-darwin + - run: rustup target add x86_64-apple-darwin + - name: Build + run: cargo zigbuild --verbose --target universal2-apple-darwin + - name: Build release binary + run: cargo zigbuild --release --target universal2-apple-darwin + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + name: CI builds (macos) + path: | + target/**/ornithe-installer-rs* + !target/**/ornithe-installer-rs.d + !target/**/build/ + build_linux_cross: + strategy: + matrix: + build: [linux-aarch64] + include: + - build: linux-aarch64 + target: aarch64-unknown-linux-gnu + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 + with: + key: linux-cross + - run: cargo install cross --git https://github.com/cross-rs/cross + - run: rustup target add ${{ matrix.target }} + - name: Build + run: cross build --verbose --target ${{ matrix.target }} + - name: Build release binary + run: cross build --release --target ${{ matrix.target }} + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + name: CI builds (${{ matrix.build }}) + path: | + target/**/ornithe-installer-rs* + !target/**/ornithe-installer-rs.d + !target/**/build/ \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 650194f..99806a8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,28 +13,31 @@ jobs: publish: strategy: matrix: + build: [linux-x86_64, windows-x86, windows-x86_64, windows-aarch64] include: - - build: linux-x86 + - build: linux-x86_64 os: ubuntu-latest target: x86_64-unknown-linux-gnu - build: windows-x86 + os: windows-latest + target: i686-pc-windows-msvc + msvc_arch: amd64_x86 + - build: windows-x86_64 os: windows-latest target: x86_64-pc-windows-msvc - #- build: windows-i686 - # os: windows-latest - # target: i686-pc-windows-msvc - #- build: windows-aarch64 - # os: windows-latest - # target: aarch64-pc-windows-msvc - #- build: macos-x86 - # os: macos-latest - # target: x86_64-apple-darwin - - build: macos-aarch64 - os: macos-latest - target: aarch64-apple-darwin + msvc_arch: amd64 + - build: windows-aarch64 + os: windows-latest + target: aarch64-pc-windows-msvc + msvc_arch: amd64_arm64 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + - name: Install C toolchain (Windows) + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.msvc_arch }} - name: Install packages (Linux) if: runner.os == 'Linux' uses: awalsh128/cache-apt-pkgs-action@v1.4.3 @@ -53,6 +56,8 @@ jobs: with: toolchain: stable - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.build }} - run: rustup target add ${{ matrix.target }} # Build the CLI only binary - run: cargo build --no-default-features --release --target ${{ matrix.target }} @@ -76,12 +81,124 @@ jobs: MAVEN_URL: ${{ secrets.NEW_MAVEN_URL }} MAVEN_USERNAME: ${{ secrets.NEW_MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.NEW_MAVEN_PASSWORD }} + SNAPSHOTS_URL: ${{ secrets.NEW_MAVEN_SNAPSHOT_URL }} + SNAPSHOTS_USERNAME: ${{ secrets.NEW_MAVEN_SNAPSHOT_USERNAME }} + SNAPSHOTS_PASSWORD: ${{ secrets.NEW_MAVEN_SNAPSHOT_PASSWORD }} TARGET: ${{ matrix.target }} OS: ${{ matrix.build }} + publish_macos: + runs-on: ubuntu-latest + container: ghcr.io/rust-cross/cargo-zigbuild:0.20 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: "microsoft" + java-version: "21" + cache: "gradle" + - uses: gradle/actions/wrapper-validation@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 + - run: rustup target add aarch64-apple-darwin + - run: rustup target add x86_64-apple-darwin + # Build the CLI only binary + - run: cargo zigbuild --no-default-features --release --target universal2-apple-darwin + - name: Rename CLI Binaries + run: | + mv "target/aarch64-apple-darwin/release/ornithe-installer-rs" "target/aarch64-apple-darwin/release/ornithe-installer-rs-cli.bin" + mv "target/x86_64-apple-darwin/release/ornithe-installer-rs" "target/x86_64-apple-darwin/release/ornithe-installer-rs-cli.bin" + mv "target/universal2-apple-darwin/release/ornithe-installer-rs" "target/universal2-apple-darwin/release/ornithe-installer-rs-cli.bin" + # Regular build with GUI + - run: cargo zigbuild --release --target universal2-apple-darwin + - name: Rename Binaries + run: | + mv "target/aarch64-apple-darwin/release/ornithe-installer-rs" "target/aarch64-apple-darwin/release/ornithe-installer-rs.bin" + mv "target/x86_64-apple-darwin/release/ornithe-installer-rs" "target/x86_64-apple-darwin/release/ornithe-installer-rs.bin" + mv "target/universal2-apple-darwin/release/ornithe-installer-rs" "target/universal2-apple-darwin/release/ornithe-installer-rs.bin" + - uses: actions/upload-artifact@v4 + with: + name: Artifacts macos + path: | + target/**/release/ornithe-installer-rs* + !target/**/ornithe-installer-rs.d + !target/**/build/ + - run: ./gradlew publish --stacktrace + env: + MAVEN_URL: ${{ secrets.NEW_MAVEN_URL }} + MAVEN_USERNAME: ${{ secrets.NEW_MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.NEW_MAVEN_PASSWORD }} + SNAPSHOTS_URL: ${{ secrets.NEW_MAVEN_SNAPSHOT_URL }} + SNAPSHOTS_USERNAME: ${{ secrets.NEW_MAVEN_SNAPSHOT_USERNAME }} + SNAPSHOTS_PASSWORD: ${{ secrets.NEW_MAVEN_SNAPSHOT_PASSWORD }} + TARGET: aarch64-apple-darwin + OS: macos-aarch64 + - run: ./gradlew publish --stacktrace + env: + MAVEN_URL: ${{ secrets.NEW_MAVEN_URL }} + MAVEN_USERNAME: ${{ secrets.NEW_MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.NEW_MAVEN_PASSWORD }} + SNAPSHOTS_URL: ${{ secrets.NEW_MAVEN_SNAPSHOT_URL }} + SNAPSHOTS_USERNAME: ${{ secrets.NEW_MAVEN_SNAPSHOT_USERNAME }} + SNAPSHOTS_PASSWORD: ${{ secrets.NEW_MAVEN_SNAPSHOT_PASSWORD }} + TARGET: x86_64-apple-darwin + OS: macos-x86_64 + - run: ./gradlew publish --stacktrace + env: + MAVEN_URL: ${{ secrets.NEW_MAVEN_URL }} + MAVEN_USERNAME: ${{ secrets.NEW_MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.NEW_MAVEN_PASSWORD }} + SNAPSHOTS_URL: ${{ secrets.NEW_MAVEN_SNAPSHOT_URL }} + SNAPSHOTS_USERNAME: ${{ secrets.NEW_MAVEN_SNAPSHOT_USERNAME }} + SNAPSHOTS_PASSWORD: ${{ secrets.NEW_MAVEN_SNAPSHOT_PASSWORD }} + TARGET: universal2-apple-darwin + OS: macos-universal2 + publish_linux_cross: + strategy: + matrix: + build: [linux-aarch64] + include: + - build: linux-aarch64 + target: aarch64-unknown-linux-gnu + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: "microsoft" + java-version: "21" + cache: "gradle" + - uses: gradle/actions/wrapper-validation@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 + with: + key: linux-cross + - run: cargo install cross --git https://github.com/cross-rs/cross + # Build the CLI only binary + - run: cross build --no-default-features --release --target ${{ matrix.target }} + - run: mv "target/${{ matrix.target }}/release/ornithe-installer-rs" "target/${{ matrix.target }}/release/ornithe-installer-rs-cli.bin" + # Regular build with GUI + - run: cross build --release --target ${{ matrix.target }} + - run: mv "target/${{ matrix.target }}/release/ornithe-installer-rs" "target/${{ matrix.target }}/release/ornithe-installer-rs.bin" + - uses: actions/upload-artifact@v4 + with: + name: Artifacts ${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/ornithe-installer-rs* + !target/**/ornithe-installer-rs.d + !target/**/build/ - run: ./gradlew publish --stacktrace env: + MAVEN_URL: ${{ secrets.NEW_MAVEN_URL }} + MAVEN_USERNAME: ${{ secrets.NEW_MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.NEW_MAVEN_PASSWORD }} SNAPSHOTS_URL: ${{ secrets.NEW_MAVEN_SNAPSHOT_URL }} SNAPSHOTS_USERNAME: ${{ secrets.NEW_MAVEN_SNAPSHOT_USERNAME }} SNAPSHOTS_PASSWORD: ${{ secrets.NEW_MAVEN_SNAPSHOT_PASSWORD }} TARGET: ${{ matrix.target }} - OS: ${{ matrix.build }} + OS: ${{ matrix.build }} \ No newline at end of file diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..754cd04 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,5 @@ +[build] +pre-build = [ + "dpkg --add-architecture $CROSS_DEB_ARCH", + "apt-get update && apt-get --assume-yes install libxcb-render0-dev:$CROSS_DEB_ARCH libxcb-shape0-dev:$CROSS_DEB_ARCH libxcb-xfixes0-dev:$CROSS_DEB_ARCH libxkbcommon-dev:$CROSS_DEB_ARCH libssl-dev:$CROSS_DEB_ARCH libgtk-3-dev:$CROSS_DEB_ARCH" +] \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 7fa367b..0d33e5d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -54,6 +54,7 @@ publishing { repositories { if (env["MAVEN_URL"] != null) { repositories.maven { + name = "Release" url = uri(env["MAVEN_URL"]!!) credentials { @@ -61,8 +62,11 @@ publishing { password = env["MAVEN_PASSWORD"] } } - } else if (env["SNAPSHOTS_URL"] != null) { + } + + if (env["SNAPSHOTS_URL"] != null) { repositories.maven { + name = "Snapshots" url = uri(env["SNAPSHOTS_URL"]!!) credentials {