diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 9fed2f6..3046709 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -21,18 +21,18 @@ jobs: artifact_name: rlogg-linux-x86_64 binary_extension: "" 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" + - platform: macos + docker_image: gitea.staspast.click/stas/rust-node-builder:v2 + target: x86_64-apple-darwin + artifact_name: rlogg-macos-x86_64 + binary_extension: "" + setup_cmd: "" + - platform: windows + docker_image: gitea.staspast.click/stas/rust-node-builder:v3 + target: x86_64-pc-windows-gnu + artifact_name: rlogg-windows-x86_64 + binary_extension: ".exe" + setup_cmd: "" steps: - name: Checkout code @@ -56,9 +56,11 @@ jobs: run: | if [ "${{ matrix.platform }}" = "macos" ]; then cargo zigbuild --release --target ${{ matrix.target }} - else - # Define RUSTFLAGS to use the system linker (cc) and disable debug compression + elif [ "${{ matrix.platform }}" = "linux" ]; then cargo build --release + else + # Cross-compile for other targets (e.g., Windows) + cargo build --release --target ${{ matrix.target }} fi # Show sccache statistics diff --git a/docker/build-linux-image.sh b/docker/build-linux-image.sh index a5c004d..7f8f7bc 100755 --- a/docker/build-linux-image.sh +++ b/docker/build-linux-image.sh @@ -1 +1 @@ -docker build -t gitea.staspast.click/stas/rust-node-builder:v2 -f linux-build.Dockerfile . && docker push gitea.staspast.click/stas/rust-node-builder:v2 \ No newline at end of file +docker build -t gitea.staspast.click/stas/rust-node-builder:v3 -f linux-build.Dockerfile . && docker push gitea.staspast.click/stas/rust-node-builder:v3 \ No newline at end of file diff --git a/docker/linux-build.Dockerfile b/docker/linux-build.Dockerfile index ef67fd3..436a88a 100644 --- a/docker/linux-build.Dockerfile +++ b/docker/linux-build.Dockerfile @@ -1,5 +1,6 @@ FROM rust:latest -# Install GNU tar and ensure it's used instead of BusyBox tar + +# Install system dependencies and tools RUN apt-get update && \ apt-get install -y --no-install-recommends \ nodejs \ @@ -7,6 +8,7 @@ RUN apt-get update && \ tar \ gzip \ curl \ + mingw-w64 \ && rm -rf /var/lib/apt/lists/* && \ # Check if /bin/tar is BusyBox and replace it with GNU tar if /bin/tar --version 2>&1 | grep -q "BusyBox"; then \ @@ -21,4 +23,8 @@ RUN SCCACHE_VERSION=0.7.4 && \ curl -L "$SCCACHE_URL" | tar xz && \ chmod +x sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache && \ mv sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache /usr/local/bin/ && \ - rm -rf sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl \ No newline at end of file + rm -rf sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl + +# Install cargo-zigbuild for cross-compilation (macOS targets) +RUN cargo install cargo-zigbuild && \ + rm -rf /usr/local/cargo/registry \ No newline at end of file