Skip to content

test: nr

test: nr #3

name: Build and Upload Binary
on:
push:
branches:
- main
- desktop-build
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install target for ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- name: Install cross-compilation tools for Linux
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Install cross-compilation tools for Windows
if: matrix.target == 'x86_64-pc-windows-msvc'
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64
sudo apt-get install -y wine
curl -L https://github.com/messense/xwin/releases/download/v0.1.8/xwin-v0.1.8-x86_64-unknown-linux-gnu.tar.gz | sudo tar -xzf - -C /usr/local
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-registry-
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-build-
- name: Build the crate
env:
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER: x86_64-w64-mingw32-gcc
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUNNER: wine
run: cargo build -p calimero-node --release --target ${{ matrix.target }}
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: calimero-node_${{ matrix.target }}
path: target/${{ matrix.target }}/release/calimero-node*