Skip to content

Commit

Permalink
chore(fix): include protobuf during build (#6077)
Browse files Browse the repository at this point in the history
Description
Include ```protobuf``` as a dependancy during build.

Motivation and Context
Fix binary and lib-ffi builds. Still need to fix Android and iOS
multi-lib builds.

How Has This Been Tested?
Built in local fork.

What process can a PR reviewer use to test or verify this change?
Check the binary and lib ffis builds.

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
  • Loading branch information
leet4tari authored Jan 17, 2024
1 parent 3ab7d5d commit 06a02fb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/base_node_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
- name: Install macOS dependencies
if: startsWith(runner.os,'macOS')
run: |
brew install cmake coreutils automake autoconf
brew install openssl cmake coreutils automake autoconf protobuf
rustup target add ${{ matrix.builds.target }}
- name: Install Windows dependencies
Expand All @@ -156,9 +156,11 @@ jobs:
choco upgrade openssl -y
# Should already be installed
# choco upgrade strawberryperl -y
choco upgrade protoc -y
- name: Set environment variables - Nix
if: ${{ ! startsWith(runner.os,'Windows') }}
shell: bash
run: |
echo "SHARUN=shasum --algorithm 256" >> $GITHUB_ENV
echo "CC=gcc" >> $GITHUB_ENV
Expand All @@ -169,12 +171,14 @@ jobs:
- name: Set environment variables - macOS
if: startsWith(runner.os,'macOS')
shell: bash
run: |
echo "PLATFORM_SPECIFIC_DIR=osx" >> $GITHUB_ENV
echo "LIB_EXT=.dylib" >> $GITHUB_ENV
- name: Set environment variables - Ubuntu
if: startsWith(runner.os,'Linux')
shell: bash
run: |
echo "LIB_EXT=.so" >> $GITHUB_ENV
Expand All @@ -197,10 +201,11 @@ jobs:
echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" >> $GITHUB_ENV
echo "C:\Strawberry\perl\bin" >> $GITHUB_PATH
# Don't use caches for binary builds. Start from a clean slate - on release
- name: Cache cargo files and outputs
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
if: ${{ ( ! startsWith(github.ref, 'refs/tags/v') ) && ( ! matrix.builds.cross ) }}
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.builds.target }}

- name: Install and setup cargo cross
if: ${{ matrix.builds.cross }}
Expand Down
28 changes: 22 additions & 6 deletions .github/workflows/build_libffis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ name: Build ffi libraries
- 'build-ffis-*'
schedule:
- cron: '05 00 * * *'
workflow_dispatch:

env:
CARGO_UNSTABLE_SPARSE_REGISTRY: true
Expand Down Expand Up @@ -129,6 +130,18 @@ jobs:
tempEnv=${tempEnv#*_}
echo "TARGET_NAME=${tempEnv%_*}" >> $GITHUB_ENV
- name: Install Linux dependencies - Ubuntu
if: ${{ startsWith(runner.os,'Linux') && ( ! matrix.builds.cross ) }}
run: |
sudo apt-get update
sudo bash scripts/install_ubuntu_dependencies.sh
- name: Install macOS dependencies
if: startsWith(runner.os,'macOS')
run: |
brew install openssl cmake coreutils automake autoconf protobuf
rustup target add ${{ matrix.builds.target }}
- name: Setup Rust toolchain
if: ${{ ! matrix.builds.cross }}
uses: dtolnay/rust-toolchain@master
Expand All @@ -140,6 +153,8 @@ jobs:
- name: Cache cargo files and outputs
if: ${{ ( ! startsWith(github.ref, 'refs/tags/v') ) && ( ! matrix.builds.cross ) }}
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.builds.target }}

- name: Install and setup cargo cross
if: ${{ matrix.builds.cross }}
Expand All @@ -165,12 +180,13 @@ jobs:
echo "cross flag: ${{ matrix.builds.cross }}"
- name: Build ${{ matrix.libffis }} libraries
shell: bash
run: |
${{ env.CARGO }} build --lib ${{ env.CARGO_OPTIONS }} \
--package ${{ matrix.libffis }} \
--target=${{ matrix.builds.target }} \
--locked
# can't use bash for windows build, perl not supported (openssl)
# don't mess with indentation - breaks inline multiline (readiblity)
run: >
${{ env.CARGO }} build --lib ${{ env.CARGO_OPTIONS }}
--package ${{ matrix.libffis }}
--target ${{ matrix.builds.target }}
--locked
- name: Prepare ${{ matrix.libffis }} libraries
shell: bash
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ First you'll need to make sure you have a full development environment set up:

```
brew update
brew install cmake openssl tor coreutils automake
brew install openssl cmake coreutils automake autoconf protobuf tor
brew install --cask powershell
```

Expand Down Expand Up @@ -168,6 +168,9 @@ First you'll need to make sure you have a full development environment set up:
- OpenSSL is compiled and statically linked by the included [rust-openssl](https://github.com/sfackler/rust-openssl) crate
- Perl is required to compile this source on Windows, please download and install [StrawberryPerl](https://strawberryperl.com/)
- [Protocol Buffers](https://protobuf.dev/)
- Install from https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation or if you using [The Package Manager for Windows](https://chocolatey.org/), run ```choco upgrade protoc -y```
- Tor
- Download [Tor Windows Expert Bundle](https://www.torproject.org/download/tor/)
- Extract to local path, e.g. `C:\Program Files (x86)\Tor Services`
Expand Down

0 comments on commit 06a02fb

Please sign in to comment.