-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
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 additional dependencies | ||
if: matrix.target == 'x86_64-pc-windows-msvc' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y mingw-w64 | ||
- 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 | ||
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* |