diff --git a/.forgejo/workflows/rust.yml b/.forgejo/workflows/rust.yml index d1a1ffb..7c4df6f 100644 --- a/.forgejo/workflows/rust.yml +++ b/.forgejo/workflows/rust.yml @@ -1,4 +1,5 @@ name: Build Zenyx ⚡ + on: push: pull_request: @@ -7,14 +8,27 @@ jobs: build: name: Build ${{ matrix.target }} runs-on: ubuntu-latest + + services: + docker: + image: docker:dind + options: >- + --privileged + --env DOCKER_TLS_CERTDIR="" + ports: + - 2375:2375 + strategy: fail-fast: false matrix: target: - x86_64-unknown-linux-gnu - aarch64-unknown-linux-gnu + - powerpc64le-unknown-linux-gnu + - s390x-unknown-linux-gnu + - riscv64gc-unknown-linux-gnu - x86_64-pc-windows-gnu - # - aarch64-apple-darwin + - x86_64-pc-windows-msvc include: - target: x86_64-unknown-linux-gnu binary_name: zenyx-x86_64-linux @@ -22,32 +36,30 @@ jobs: - target: aarch64-unknown-linux-gnu binary_name: zenyx-aarch64-linux ext: "" + - target: powerpc64le-unknown-linux-gnu + binary_name: zenyx-powerpc64le-linux + ext: "" + - target: s390x-unknown-linux-gnu + binary_name: zenyx-s390x-linux + ext: "" + - target: riscv64gc-unknown-linux-gnu + binary_name: zenyx-riscv64-linux + ext: "" - target: x86_64-pc-windows-gnu - binary_name: zenyx-x86_64-windows.exe + binary_name: zenyx-x86_64-windows-gnu.exe + ext: ".exe" + - target: x86_64-pc-windows-msvc + binary_name: zenyx-x86_64-windows-msvc.exe ext: ".exe" - # - target: aarch64-apple-darwin - # binary_name: zenyx-aarch64-apple - # ext: "" steps: - name: 📥 Checkout source - uses: actions/checkout@v4 + uses: https://github.com/actions/checkout@v4 - - name: 🐳 Setup Docker-in-Docker - run: | - # Install Docker using the convenience script - curl -fsSL https://get.docker.com -o get-docker.sh - sh get-docker.sh - - # Start Docker daemon directly (instead of using service) - sudo dockerd & - - # Give the Docker daemon a moment to initialize - sleep 10 - - # Verify Docker is working - docker info || true - docker --version + - name: 🐳 Set up Docker CLI + uses: https://github.com/docker/setup-docker-action@v3 + with: + docker-binaries: true - name: 🛠️ Install Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 @@ -55,24 +67,32 @@ jobs: toolchain: stable target: ${{ matrix.target }} override: true + components: rust-src + + - name: 🧩 Restore Cargo cache + uses: https://github.com/actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-${{ matrix.target }}- - name: 🧰 Install Cross run: cargo install cross --locked - name: 🚀 Build with cross - uses: https://github.com/actions-rs/cargo@v1 env: - CROSS_CONTAINER_IN_CONTAINER : true - with: - use-cross: true - command: build - args: --target ${{ matrix.target }} + DOCKER_HOST: tcp://localhost:2375 + CROSS_CONTAINER_IN_CONTAINER: true + run: cross build --target ${{ matrix.target }} --release - name: 📦 Package artifact run: | mkdir -p artifacts - cp target/${{ matrix.target }}/debug/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }} - chmod +x artifacts/${{ matrix.binary_name }} + cp target/${{ matrix.target }}/release/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }} - name: ⬆️ Upload artifact uses: https://code.forgejo.org/forgejo/upload-artifact@v4