name: Build on: push: branches: - main workflow_dispatch: jobs: build: name: Build - ${{ matrix.platform }} runs-on: gitea-runner container: image: ${{ matrix.docker_image }} volumes: - /tmp/gitea-sccache:/tmp/sccache strategy: matrix: include: - platform: linux docker_image: gitea.staspast.click/stas/rust-node-builder:v5 target: x86_64-unknown-linux-gnu artifact_name: rlogg-linux-x86_64 binary_extension: "" setup_cmd: "" - platform: windows docker_image: gitea.staspast.click/stas/rust-node-builder:v5 target: x86_64-pc-windows-gnu artifact_name: rlogg-windows-x86_64 binary_extension: ".exe" setup_cmd: "" steps: - name: Checkout code uses: actions/checkout@v4 - name: Configure sccache run: | # Configure sccache cache directory (persists on runner between builds) mkdir -p /tmp/sccache echo "SCCACHE_DIR=/tmp/sccache" >> $GITHUB_ENV echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - 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: | if [ "${{ matrix.platform }}" = "macos" ]; then cargo zigbuild --release --target ${{ matrix.target }} 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 echo "=== sccache stats ===" sccache --show-stats - name: Prepare artifact shell: sh run: | mkdir -p dist if [ "${{ matrix.platform }}" = "linux" ]; then cp target/release/rlogg${{ matrix.binary_extension }} dist/${{ matrix.artifact_name }}${{ matrix.binary_extension }} else cp target/${{ matrix.target }}/release/rlogg${{ matrix.binary_extension }} dist/${{ matrix.artifact_name }}${{ matrix.binary_extension }} fi - name: Upload artifact uses: actions/upload-artifact@v3 with: name: ${{ matrix.artifact_name }} path: dist/${{ matrix.artifact_name }}${{ matrix.binary_extension }} retention-days: 14