Skip to content

fix: fix ubuntu 3

fix: fix ubuntu 3 #9

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]
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 dependencies for Linux
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu libssl-dev pkg-config
- name: Download and set up OpenSSL for cross-compilation
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
tar -xzf openssl-1.1.1k.tar.gz
cd openssl-1.1.1k
./Configure linux-aarch64 --prefix=$HOME/openssl-aarch64 --cross-compile-prefix=aarch64-linux-gnu-
make -j$(nproc)
make install_sw
cd ..
echo "OPENSSL_DIR=$HOME/openssl-aarch64" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$HOME/openssl-aarch64/lib/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
echo "PKG_CONFIG_SYSROOT_DIR=/" >> $GITHUB_ENV
- 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 for aarch64
if: matrix.target == 'aarch64-unknown-linux-gnu'
env:
OPENSSL_DIR: ${{ env.OPENSSL_DIR }}
PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }}
PKG_CONFIG_ALLOW_CROSS: ${{ env.PKG_CONFIG_ALLOW_CROSS }}
PKG_CONFIG_SYSROOT_DIR: ${{ env.PKG_CONFIG_SYSROOT_DIR }}
run: cargo build -p calimero-node --release --target ${{ matrix.target }}
- name: Build the crate for x86_64
if: matrix.target == 'x86_64-unknown-linux-gnu'
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*