From 06a02fb07dfba84e6edd1591355d5f1b626438d1 Mon Sep 17 00:00:00 2001 From: "C.Lee Taylor" <47312074+leet4tari@users.noreply.github.com> Date: Wed, 17 Jan 2024 11:50:21 +0200 Subject: [PATCH] chore(fix): include protobuf during build (#6077) 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. Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify --- .github/workflows/base_node_binaries.yml | 11 +++++++--- .github/workflows/build_libffis.yml | 28 +++++++++++++++++++----- README.md | 5 ++++- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/base_node_binaries.yml b/.github/workflows/base_node_binaries.yml index a9db5267db..e3a52fd72d 100644 --- a/.github/workflows/base_node_binaries.yml +++ b/.github/workflows/base_node_binaries.yml @@ -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 @@ -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 @@ -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 @@ -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 }} diff --git a/.github/workflows/build_libffis.yml b/.github/workflows/build_libffis.yml index 96819a741a..71ca69a7c4 100644 --- a/.github/workflows/build_libffis.yml +++ b/.github/workflows/build_libffis.yml @@ -9,6 +9,7 @@ name: Build ffi libraries - 'build-ffis-*' schedule: - cron: '05 00 * * *' + workflow_dispatch: env: CARGO_UNSTABLE_SPARSE_REGISTRY: true @@ -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 @@ -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 }} @@ -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 diff --git a/README.md b/README.md index 434c2a9db8..d1984db6fe 100644 --- a/README.md +++ b/README.md @@ -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 ``` @@ -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`