diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 122287a..6412da4 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -9,40 +9,49 @@ on: jobs: build: name: Build - ${{ matrix.platform }} - runs-on: ${{ matrix.os }} + runs-on: gitea-runner container: - image: rust:latest # or a specific version like rust:1.75-slim - options: --user 1000:1000 # Good practice to run as non-root + image: ${{ matrix.docker_image }} strategy: matrix: include: - platform: linux - os: gitea-runner + docker_image: rust:latest target: x86_64-unknown-linux-gnu artifact_name: rlogg-linux-x86_64 binary_extension: "" -# - platform: macos -# os: macos-latest -# target: x86_64-apple-darwin -# artifact_name: rlogg-macos-x86_64 -# binary_extension: "" -# - platform: windows -# os: windows-latest -# target: x86_64-pc-windows-msvc -# artifact_name: rlogg-windows-x86_64 -# binary_extension: ".exe" + setup_cmd: "" + - platform: macos + docker_image: messense/cargo-zigbuild:latest + target: x86_64-apple-darwin + artifact_name: rlogg-macos-x86_64 + binary_extension: "" + setup_cmd: "" + - platform: windows + docker_image: rust:latest + target: x86_64-pc-windows-gnu + artifact_name: rlogg-windows-x86_64 + binary_extension: ".exe" + setup_cmd: "apt-get update && apt-get install -y mingw-w64" steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - target: ${{ matrix.target }} + - name: Setup cross-compilation tools + if: matrix.setup_cmd != '' + run: ${{ matrix.setup_cmd }} + + - name: Add Rust target + run: rustup target add ${{ matrix.target }} - name: Build release binary - run: cargo build --release --target ${{ matrix.target }} + run: | + if [ "${{ matrix.platform }}" = "macos" ]; then + cargo zigbuild --release --target ${{ matrix.target }} + else + cargo build --release --target ${{ matrix.target }} + fi - name: Prepare artifact shell: bash