diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index d29e2afaf4..b73ffc8347 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -4,8 +4,8 @@ # - canary.yml # # Platform Build Strategy: -# - Linux: Uses Ubuntu runner with cross-compilation -# - macOS: Uses macOS runner with cross-compilation +# - Linux: Uses native Ubuntu runners, including arm64 hosted runners +# - macOS: Uses native macOS runners for each architecture # - Windows: Uses Windows runner with native MSVC build on: workflow_call: @@ -31,43 +31,35 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-latest + - platform: linux architecture: x86_64 target-suffix: unknown-linux-gnu - build-on: ubuntu-latest - use-cross: true - cc: gcc-10 + build-on: ubuntu-24.04 variant: standard - - os: ubuntu-latest + - platform: linux architecture: aarch64 target-suffix: unknown-linux-gnu - build-on: ubuntu-latest - use-cross: true - cc: gcc-10 + build-on: ubuntu-24.04-arm variant: standard - - os: macos-latest + - platform: macos architecture: x86_64 target-suffix: apple-darwin - build-on: macos-latest - use-cross: true + build-on: macos-15-intel variant: standard - - os: macos-latest + - platform: macos architecture: aarch64 target-suffix: apple-darwin build-on: macos-latest - use-cross: true variant: standard - - os: windows + - platform: windows architecture: x86_64 target-suffix: pc-windows-msvc build-on: windows-latest - use-cross: false variant: standard - - os: windows + - platform: windows architecture: x86_64 target-suffix: pc-windows-msvc build-on: windows-latest - use-cross: false variant: cuda steps: @@ -83,29 +75,37 @@ jobs: sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml rm -f Cargo.toml.bak - - name: Install cross - if: matrix.use-cross - run: source ./bin/activate-hermit && cargo install cross --git https://github.com/cross-rs/cross + - name: Install Linux build dependencies + if: matrix.platform == 'linux' + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential \ + pkg-config \ + libssl-dev \ + libdbus-1-dev \ + libxcb1-dev \ + libvulkan-dev \ + libvulkan1 \ + glslc - name: Cache Cargo artifacts (Linux/macOS) - if: matrix.use-cross + if: matrix.platform != 'windows' uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 with: - key: ${{ matrix.architecture }}-${{ matrix.target-suffix }}-macos-deployment-target-12 + key: ${{ matrix.architecture }}-${{ matrix.target-suffix }}-native-macos-deployment-target-12 - name: Cache Cargo artifacts (Windows) - if: matrix.os == 'windows' + if: matrix.platform == 'windows' uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 with: key: windows-msvc-cli-${{ matrix.variant }} - name: Build CLI (Linux/macOS) - if: matrix.use-cross + if: matrix.platform != 'windows' env: - CROSS_NO_WARNINGS: 0 RUST_LOG: debug RUST_BACKTRACE: 1 - CROSS_VERBOSE: 1 run: | source ./bin/activate-hermit export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}" @@ -113,25 +113,22 @@ jobs: echo "Building for target: ${TARGET}" echo "Rust toolchain info:" rustup show - echo "Cross version:" - cross --version - export CC="${{ matrix.cc || ''}}" FEATURE_ARGS=() if [[ "${TARGET}" == *-unknown-linux-gnu ]]; then FEATURE_ARGS=(--features vulkan) fi - cross build --release --target ${TARGET} -p goose-cli "${FEATURE_ARGS[@]}" + cargo build --release --target ${TARGET} -p goose-cli "${FEATURE_ARGS[@]}" - name: Setup Rust (Windows) - if: matrix.os == 'windows' + if: matrix.platform == 'windows' shell: bash run: | rustup show rustup target add x86_64-pc-windows-msvc - name: Install CUDA toolkit (Windows CUDA) - if: ${{ matrix.os == 'windows' && matrix.variant == 'cuda' }} + if: ${{ matrix.platform == 'windows' && matrix.variant == 'cuda' }} uses: Jimver/cuda-toolkit@v0.2.35 with: cuda: '12.9.1' @@ -139,13 +136,13 @@ jobs: log-file-suffix: 'build-cli-windows-cuda.txt' - name: Set up MSVC developer environment (Windows CUDA) - if: ${{ matrix.os == 'windows' && matrix.variant == 'cuda' }} + if: ${{ matrix.platform == 'windows' && matrix.variant == 'cuda' }} uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 with: arch: amd64 - name: Verify CUDA toolchain (Windows CUDA) - if: ${{ matrix.os == 'windows' && matrix.variant == 'cuda' }} + if: ${{ matrix.platform == 'windows' && matrix.variant == 'cuda' }} shell: pwsh env: CUDA_COMPUTE_CAP: "80" @@ -157,7 +154,7 @@ jobs: nvcc -V - name: Build CLI (Windows) - if: matrix.os == 'windows' + if: matrix.platform == 'windows' shell: pwsh env: CUDA_COMPUTE_CAP: ${{ matrix.variant == 'cuda' && '80' || '' }} @@ -179,7 +176,7 @@ jobs: Get-Item ./target/x86_64-pc-windows-msvc/release/goose.exe - name: Package CLI (Linux/macOS) - if: matrix.use-cross + if: matrix.platform != 'windows' run: | source ./bin/activate-hermit export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}" @@ -197,7 +194,7 @@ jobs: echo "ARTIFACT_GZ=target/${TARGET}/release/goose-${TARGET}.tar.gz" >> $GITHUB_ENV - name: Package CLI (Windows) - if: matrix.os == 'windows' + if: matrix.platform == 'windows' shell: bash run: | export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}" diff --git a/.github/workflows/bundle-desktop-linux.yml b/.github/workflows/bundle-desktop-linux.yml index 1c4c66d5af..5ca48d2c05 100644 --- a/.github/workflows/bundle-desktop-linux.yml +++ b/.github/workflows/bundle-desktop-linux.yml @@ -21,7 +21,7 @@ name: "Bundle Desktop (Linux)" jobs: build-desktop-linux: name: Build Desktop (Linux) - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout repository @@ -94,9 +94,6 @@ jobs: echo "CARGO_HOME=$CARGO_HOME" >> $GITHUB_ENV echo "RUSTUP_HOME=$RUSTUP_HOME" >> $GITHUB_ENV - - name: Install cross - run: source ./bin/activate-hermit && cargo install cross --git https://github.com/cross-rs/cross - - name: Cache Rust dependencies uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 with: @@ -104,16 +101,13 @@ jobs: - name: Build goosed binary env: - CROSS_NO_WARNINGS: 0 RUST_LOG: debug RUST_BACKTRACE: 1 - CROSS_VERBOSE: 1 - CC: gcc-10 run: | source ./bin/activate-hermit export TARGET="x86_64-unknown-linux-gnu" rustup target add "${TARGET}" - cross build --release --target ${TARGET} -p goose-server --features vulkan + cargo build --release --target ${TARGET} -p goose-server --features vulkan - name: Copy binaries into Electron folder run: | diff --git a/.github/workflows/bundle-goose2.yml b/.github/workflows/bundle-goose2.yml index b363ebf1a2..20f2a5a144 100644 --- a/.github/workflows/bundle-goose2.yml +++ b/.github/workflows/bundle-goose2.yml @@ -244,7 +244,7 @@ jobs: # ─────────────────────────────────────────────── bundle-macos-intel: name: "macOS x86_64" - runs-on: macos-latest + runs-on: macos-15-intel environment: ${{ inputs.environment || '' }} timeout-minutes: 60 env: @@ -360,7 +360,7 @@ jobs: certificate-base64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} certificate-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} - # ── Tauri bundle (cross-compile for Intel) ── + # ── Tauri bundle ── - name: Bundle Goose 2 for Intel env: APPLE_SIGNING_IDENTITY: ${{ inputs.signing && 'Developer ID Application' || '' }} @@ -423,7 +423,7 @@ jobs: # ─────────────────────────────────────────────── bundle-linux: name: "Linux x86_64" - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 60 permissions: contents: read diff --git a/Cross.toml b/Cross.toml deleted file mode 100644 index f7457d6510..0000000000 --- a/Cross.toml +++ /dev/null @@ -1,50 +0,0 @@ -# Configuration for cross-compiling using cross -[build.env] -passthrough = [ "CC" ] - -[target.aarch64-unknown-linux-gnu] -xargo = false -pre-build = [ - # Add the ARM64 architecture and install necessary dependencies - "dpkg --add-architecture arm64", - """\ - apt-get update --fix-missing && apt-get install -y \ - curl \ - unzip \ - pkg-config \ - libssl-dev:arm64 \ - libdbus-1-dev:arm64 \ - libxcb1-dev:arm64 \ - libvulkan-dev:arm64 \ - glslc \ - gcc-10 - """ -] - -[target.x86_64-unknown-linux-gnu] -xargo = false -pre-build = [ - """\ - apt-get update && apt-get install -y \ - curl \ - unzip \ - pkg-config \ - libssl-dev \ - libdbus-1-dev \ - libxcb1-dev \ - libvulkan-dev \ - glslc \ - gcc-10 - """ -] - -[target.x86_64-pc-windows-gnu] -image = "ghcr.io/cross-rs/x86_64-pc-windows-gnu:latest" -env = { "RUST_LOG" = "debug", "RUST_BACKTRACE" = "1", "CROSS_VERBOSE" = "1", "PKG_CONFIG_ALLOW_CROSS" = "1" } -pre-build = [ - """\ - apt-get update && apt-get install -y \ - curl \ - unzip - """ -] diff --git a/run_cross_local.md b/run_cross_local.md deleted file mode 100644 index cfcde7426f..0000000000 --- a/run_cross_local.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -draft: true ---- -# Instructions for running cross to test release builds locally - -## Prerequisites -Before start, check the comments in `Cross.toml` to turn on some commented configs for the target you want to build. - -## Targets -### aarch64-unknown-linux-gnu - -#### Build release -```sh -CROSS_BUILD_OPTS="--platform linux/amd64 --no-cache" CROSS_CONTAINER_OPTS="--platform linux/amd64" cross build --release --target aarch64-unknown-linux-gnu -``` - -#### Inspect container created by cross for debugging -```sh -docker run --platform linux/amd64 -it /bin/bash -``` - -#### Testing the binary - -1. Download docker image for testing environment -```sh -docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -docker pull arm64v8/ubuntu -``` -2. Run the container -pwd is the directory which contains the binary built in the previous step on your host machine -```sh -docker run --rm -v "$(pwd)":/app -it --platform linux/arm64 arm64v8/ubuntu /bin/bash -``` - -3. Install dependencies in the container and set up api testing environment -```sh -apt update -apt install libxcb1 libxcb1-dev libdbus-1-3 nvi -mkdir -p ~/.config/goose -# create goose config file -# set api key env variable -``` - -### x86_64-unknown-linux-gnu - -#### Build release -```sh -CROSS_BUILD_OPTS="--platform linux/amd64 --no-cache" CROSS_CONTAINER_OPTS="--platform linux/amd64" cross build --release --target x86_64-unknown-linux-gnu -``` -#### inspect container created by cross for debugging -```sh -docker run --platform linux/amd64 -it /bin/bash -``` - -#### Testing the binary - -1. Download docker image for testing environment -```sh -docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -docker pull --platform linux/amd64 debian:latest -``` - -2. Run the container -pwd is the directory contains the binary built in the previous step on your host machine -```sh -docker run --rm -v "$(pwd)":/app -it --platform linux/amd64 ubuntu:latest /bin/bash -``` - -3. Install dependencies in the container and set up api testing environment -```sh -apt update -apt install libxcb1 libxcb1-dev libdbus-1-3 nvi -mkdir -p ~/.config/goose -# create goose config file -# set api key env variable -``` - -### aarch64-apple-darwin - -#### build release -```sh -cross build --release --target aarch64-apple-darwin -``` -There is no docker image available for aarch64-apple-darwin. It will fall back to your host machine for building the binary if your host machine matches. - -#### testing the build -If the binary is signed with a certificate, run -```sh -xattr -d com.apple.quarantine goose -```` - -### x86_64-apple-darwin - -#### build release -```sh -cross build --release --target x86_64-apple-darwin -``` - -There is no docker image available for x86_64-apple-darwin. It will fall back to your host machine for building the binary if your host machine matches. - -#### testing the build -1. If the binary is signed with a certificate, run -```sh -xattr -d com.apple.quarantine goose -```` -2. If you are on Apple Silicon (ARM), you can use Rosetta to test the binary -```sh -softwareupdate --install-rosetta # make sure Rosetta 2 is installed -``` - -```sh -arch -x86_64 ./goose help -```