fix: explicit rustup target add for cross-compilation #14
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: ['v*'] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Release tag (e.g. v0.1.0)' | |
| required: true | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| suffix: linux-amd64 | |
| use_cross: false | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| suffix: linux-arm64 | |
| use_cross: true | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| suffix: macos-amd64 | |
| use_cross: false | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| suffix: macos-arm64 | |
| use_cross: false | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| suffix: windows-amd64 | |
| use_cross: false | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ matrix.use_cross }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Ensure target is installed | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Install cross | |
| if: matrix.use_cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Create swap (Linux) | |
| if: runner.os == 'Linux' | |
| continue-on-error: true | |
| run: | | |
| sudo swapoff /swapfile 2>/dev/null || true | |
| sudo rm -f /swapfile | |
| sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 | |
| sudo chmod 600 /swapfile | |
| sudo mkswap /swapfile | |
| sudo swapon /swapfile | |
| free -h | |
| - name: Install system deps (Linux) | |
| if: runner.os == 'Linux' && !matrix.use_cross | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pkg-config libssl-dev protobuf-compiler | |
| - name: Install system deps (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install protobuf | |
| - name: Install system deps (Windows) | |
| if: runner.os == 'Windows' | |
| run: choco install protoc --yes | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }}-ci | |
| - name: Build (cross) | |
| if: matrix.use_cross | |
| run: cross build --profile ci --bin openprx --bin prx-node --target ${{ matrix.target }} | |
| - name: Build (native) | |
| if: "!matrix.use_cross" | |
| env: | |
| CARGO_BUILD_JOBS: "2" | |
| run: cargo build --profile ci --bin openprx --bin prx-node --target ${{ matrix.target }} | |
| - name: Package (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| cd target/${{ matrix.target }}/ci | |
| chmod +x openprx prx-node | |
| tar czf ../../../openprx-${{ matrix.suffix }}.tar.gz openprx | |
| tar czf ../../../prx-node-${{ matrix.suffix }}.tar.gz prx-node | |
| cd ../../.. | |
| sha256sum openprx-${{ matrix.suffix }}.tar.gz > openprx-${{ matrix.suffix }}.tar.gz.sha256 | |
| sha256sum prx-node-${{ matrix.suffix }}.tar.gz > prx-node-${{ matrix.suffix }}.tar.gz.sha256 | |
| - name: Package (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| cd target/${{ matrix.target }}/ci | |
| Compress-Archive -Path openprx.exe -DestinationPath ../../../openprx-${{ matrix.suffix }}.zip | |
| Compress-Archive -Path prx-node.exe -DestinationPath ../../../prx-node-${{ matrix.suffix }}.zip | |
| cd ../../.. | |
| Get-FileHash openprx-${{ matrix.suffix }}.zip -Algorithm SHA256 | Format-List Hash | Out-File openprx-${{ matrix.suffix }}.zip.sha256 | |
| Get-FileHash prx-node-${{ matrix.suffix }}.zip -Algorithm SHA256 | Format-List Hash | Out-File prx-node-${{ matrix.suffix }}.zip.sha256 | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openprx-${{ matrix.suffix }} | |
| path: | | |
| openprx-${{ matrix.suffix }}.* | |
| prx-node-${{ matrix.suffix }}.* | |
| if-no-files-found: ignore | |
| release: | |
| needs: build | |
| if: always() && !cancelled() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Determine tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create or Update Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag }} | |
| name: OpenPRX ${{ steps.tag.outputs.tag }} | |
| files: artifacts/* | |
| body: | | |
| ## OpenPRX ${{ steps.tag.outputs.tag }} | |
| Self-evolving AI assistant framework. | |
| ### openprx (AI daemon) | |
| | Platform | Architecture | File | | |
| |----------|-------------|------| | |
| | Linux | x86_64 | `openprx-linux-amd64.tar.gz` | | |
| | Linux | ARM64 | `openprx-linux-arm64.tar.gz` | | |
| | macOS | Intel | `openprx-macos-amd64.tar.gz` | | |
| | macOS | Apple Silicon | `openprx-macos-arm64.tar.gz` | | |
| | Windows | x86_64 | `openprx-windows-amd64.zip` | | |
| ### prx-node (remote node agent) | |
| | Platform | Architecture | File | | |
| |----------|-------------|------| | |
| | Linux | x86_64 | `prx-node-linux-amd64.tar.gz` | | |
| | Linux | ARM64 | `prx-node-linux-arm64.tar.gz` | | |
| | macOS | Intel | `prx-node-macos-amd64.tar.gz` | | |
| | macOS | Apple Silicon | `prx-node-macos-arm64.tar.gz` | | |
| | Windows | x86_64 | `prx-node-windows-amd64.zip` | |