Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiarch builds on CI #3

Merged
merged 26 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
shell: bash
run: |
curl -Lo /tmp/protoc.zip \
"https://github.com/protocolbuffers/protobuf/releases/download/v27.3/protoc-27.3-linux-x86_64.zip"
"https://github.com/protocolbuffers/protobuf/releases/download/v28.2/protoc-28.2-linux-x86_64.zip"
unzip -o /tmp/protoc.zip -d ${HOME}/.local
echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV
export PATH="${PATH}:${HOME}/.local/bin"

- name: Build
run: cargo build --verbose
run: cargo build --verbose
61 changes: 46 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,76 @@ on:
- published

jobs:
test:
name: Build
runs-on: ubuntu-22.04
timeout-minutes: 60
build_linux_x86_64:
name: Build Linux (x86_64)
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: sudo apt-get install -y build-essential pkg-config libssl-dev clang cmake llvm

- name: Install protoc
id: deps-protoc
shell: bash
run: |
curl -Lo /tmp/protoc.zip \
"https://github.com/protocolbuffers/protobuf/releases/download/v27.3/protoc-27.3-linux-x86_64.zip"
"https://github.com/protocolbuffers/protobuf/releases/download/v28.2/protoc-28.2-linux-x86_64.zip"
unzip -o /tmp/protoc.zip -d ${HOME}/.local
echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV
export PATH="${PATH}:${HOME}/.local/bin"

- name: Install dependencies
run: sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Add Rust targets
run: rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu x86_64-apple-darwin aarch64-apple-darwin
run: rustup target add x86_64-unknown-linux-gnu

- name: Build for Linux x86
run: cargo build -r --target=x86_64-unknown-linux-gnu --verbose && mv target/x86_64-unknown-linux-gnu/release/platform-cli ./platform-cli-gnu-x86_64

- name: Build for Linux arm64
run: cargo build -r --target=aarch64-unknown-linux-gnu --verbose && mv target/unknown-linux-gnu/release/platform-cli ./platform-cli-gnu-arm64
- uses: softprops/action-gh-release@v2
with:
files: |
platform-cli_gnu-x86_64

build_mac_x86_64:
name: Build Apple (x86_64)
runs-on: macos-13
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- name: Add Rust targets
run: brew install llvm protobuf

- name: Add Rust targets
run: rustup target add x86_64-apple-darwin

- name: Build for Apple x86
run: cargo build -r --target=x86_64-apple-darwin --verbose && mv target/x86_64-apple-darwin/release/platform-cli ./platform-cli_darwin-x86_64

- uses: softprops/action-gh-release@v2
with:
files: |
platform-cli_darwin-x86_64

build_mac_arm64:
name: Build Apple (arm64)
runs-on: macos-15
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- name: Add Rust targets
run: brew install llvm protobuf

- name: Add Rust targets
run: rustup target add aarch64-apple-darwin

- name: Build for Apple Silicon
run: cargo build -r --target=aarch64-apple-darwin --verbose && mv target/aarch64-apple-darwin/release/platform-cli ./platform-cli_darwin-arm64

- uses: softprops/action-gh-release@v2
with:
files: |
platform-cli_gnu-x86_64
platform-cli-gnu-arm64
platform-cli_darwin-x86_64
platform-cli_darwin-arm64
platform-cli_darwin-arm64

4 changes: 2 additions & 2 deletions src/commands/masternode_vote_dpns_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use dpp::identifier::{Identifier, MasternodeIdentifiers};
use dpp::identity::accessors::IdentityGettersV0;
use dpp::identity::hash::IdentityPublicKeyHashMethodsV0;
use dpp::identity::{IdentityPublicKey};
use dpp::native_bls::NativeBlsModule;
use dpp::platform_value::string_encoding::Encoding::{Base58};
use dpp::platform_value::Value;
use dpp::serialization::PlatformSerializable;
Expand Down Expand Up @@ -63,7 +64,6 @@ impl MasternodeVoteDPNSNameCommand {
}

let secp = Secp256k1::new();
let bls = dpp::native_bls::NativeBlsModule {};

let private_key_data = fs::read_to_string(&self.private_key).expect("Unable to read file");
let private_key = PrivateKey::from_wif(&private_key_data).expect("Could not load private key from WIF");
Expand Down Expand Up @@ -112,7 +112,7 @@ impl MasternodeVoteDPNSNameCommand {

let mut masternode_vote_state_transition = StateTransition::from(masternode_vote_transition);

masternode_vote_state_transition.sign(&identity_public_key, private_key.to_bytes().as_slice(), &bls).unwrap();
masternode_vote_state_transition.sign(&identity_public_key, private_key.to_bytes().as_slice(), &NativeBlsModule).unwrap();

let preorder_buffer = masternode_vote_state_transition.clone().serialize_to_bytes().unwrap();

Expand Down
6 changes: 3 additions & 3 deletions src/commands/register_dpns_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use dpp::identifier::Identifier;
use dpp::identity::accessors::IdentityGettersV0;
use dpp::identity::hash::IdentityPublicKeyHashMethodsV0;
use dpp::identity::IdentityPublicKey;
use dpp::native_bls::NativeBlsModule;
use dpp::platform_value::string_encoding::Encoding::Base58;
use dpp::platform_value::{platform_value, Value};
use dpp::serialization::PlatformSerializable;
Expand Down Expand Up @@ -75,7 +76,6 @@ impl RegisterDPNSNameCommand {
}

let secp = Secp256k1::new();
let bls = dpp::native_bls::NativeBlsModule {};

let private_key_data = fs::read_to_string(&self.private_key).expect("Unable to read file");
let private_key = PrivateKey::from_wif(&private_key_data).expect("Could not load private key from WIF");
Expand Down Expand Up @@ -133,7 +133,7 @@ impl RegisterDPNSNameCommand {
transitions: vec![pre_order_transition]
});

preorder_state_transition.sign(identity_public_key, private_key.to_bytes().as_slice(), &bls).unwrap();
preorder_state_transition.sign(identity_public_key, private_key.to_bytes().as_slice(), &NativeBlsModule).unwrap();

let preorder_buffer = preorder_state_transition.clone().serialize_to_bytes().unwrap();

Expand Down Expand Up @@ -179,7 +179,7 @@ impl RegisterDPNSNameCommand {
transitions: vec![domain_document_transition]
});

domain_state_transition.sign(identity_public_key, private_key.to_bytes().as_slice(), &bls).unwrap();
domain_state_transition.sign(identity_public_key, private_key.to_bytes().as_slice(), &NativeBlsModule).unwrap();

let domain_buffer = domain_state_transition.clone().serialize_to_bytes().unwrap();

Expand Down
4 changes: 2 additions & 2 deletions src/commands/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use dpp::identity::accessors::IdentityGettersV0;
use dpp::identity::core_script::CoreScript;
use dpp::identity::hash::IdentityPublicKeyHashMethodsV0;
use dpp::identity::IdentityPublicKey;
use dpp::native_bls::NativeBlsModule;
use dpp::platform_value::string_encoding::Encoding::{Base58};
use dpp::serialization::{PlatformSerializable};
use dpp::state_transition::identity_credit_withdrawal_transition::v1::IdentityCreditWithdrawalTransitionV1;
Expand Down Expand Up @@ -63,7 +64,6 @@ impl WithdrawCommand {
}

let secp = Secp256k1::new();
let bls = dpp::native_bls::NativeBlsModule {};

let private_key_data = fs::read_to_string(&self.private_key).expect("Unable to read file");
let private_key = PrivateKey::from_wif(&private_key_data).expect("Could not load private key from WIF");
Expand Down Expand Up @@ -106,7 +106,7 @@ impl WithdrawCommand {

let mut state_transition = StateTransition::from(identity_credit_withdrawal_transition);

state_transition.sign(&identity_public_key, private_key.to_bytes().as_slice(), &bls).unwrap();
state_transition.sign(&identity_public_key, private_key.to_bytes().as_slice(), &NativeBlsModule).unwrap();

let buffer = state_transition.serialize_to_bytes().unwrap();
let tx_hash = digest(buffer.clone());
Expand Down