Skip to content

Commit

Permalink
Add cross compile to build workflow (#34)
Browse files Browse the repository at this point in the history
* Use matrix strategy

* Fix

* Fix

* Fix tests

* Fix tests and add cache for OSX deps

* Fix
  • Loading branch information
Mixa84 authored May 23, 2024
1 parent 2fdd2ad commit 2e52cd4
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 22 deletions.
64 changes: 50 additions & 14 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,85 @@ jobs:
build_and_test:
runs-on: ubuntu-22.04

continue-on-error: true
strategy:
max-parallel: 2
matrix:
target: [x86_64-pc-linux-gnu, x86_64-w64-mingw32, x86_64-apple-darwin]
env:
TARGET: ${{matrix.target}}

steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install ccache build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 libevent-dev libboost-dev
wget -O - "https://apt.llvm.org/llvm.sh" | sudo bash -s 18
sudo apt-get install ccache build-essential libtool autotools-dev automake pkg-config bsdmainutils python3
sudo /usr/sbin/update-ccache-symlinks
echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc
source ~/.bashrc
- name: Install Windows dependencies
if: ${{ env.TARGET == 'x86_64-w64-mingw32' }}
run: sudo apt-get install g++-mingw-w64-x86-64-posix

- name: Restore OSX deps cache
id: osx-deps-cache-restore
if: ${{ env.TARGET == 'x86_64-apple-darwin' }}
uses: actions/cache@v4
with:
path: ${{github.workspace}}/depends/SDKs
key: ${{ env.TRAGET }}-osx-deps

- name: Install OSX dependencies
if: ${{ env.TARGET == 'x86_64-apple-darwin' && steps.osx-deps-cache-restore.cache-hit != 'true'}}
run: |
sudo apt-get install curl bsdmainutils cmake libz-dev python3-setuptools libtinfo5 xorriso cpio
cd depends && mkdir SDKs && cd SDKs
wget http://mixakuca.ddns.net:8000/Xcode-12.2.tar.gz
tar -xzf Xcode-12.2.tar.gz
- name: Save OSX deps cache
id: osx-deps-cache-save
if: ${{ env.TARGET == 'x86_64-apple-darwin' && steps.osx-deps-cache-restore.cache-hit != 'true'}}
uses: actions/cache/save@v4
with:
path: ${{github.workspace}}/depends/SDKs
key: ${{ env.TRAGET }}-osx-deps

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-${{ runner.os }}
key: ${{ github.job }}-${{ env.TARGET }}
max-size: 2G

- name: Build depends
run: make -j$(nproc) -C depends HOST=${{env.TARGET}} NO_QT=1 NO_NATPMP=1 NO_UPNP=1 NO_ZMQ=1 NO_USDT=1

- name: Build
env:
BDB_PREFIX: '/home/runner/work/SEQ-Core-Elements/SEQ-Core-Elements/db4'
CONFIG_SITE: ${{github.workspace}}/depends/${{env.TARGET}}/share/config.site
NOWARN_CXXFLAGS: -Wno-deprecated -Wno-unused-result
CC: clang-18
CXX: clang++-18
run: |
./autogen.sh
CFLAGS='-Wno-error=implicit-function-declaration -Wno-deprecated-non-prototype' ./contrib/install_db4.sh .
BDB_CFLAGS='-I${BDB_PREFIX}/include' BDB_LIBS='-L${BDB_PREFIX}/lib -ldb_cxx-4.8' ./configure --without-gui --without-natpmp --without-miniupnpc --disable-tests
./configure --enable-any-asset-fees
make clean
make -j$(nproc)
- name: Run tests
if: ${{ env.TARGET == 'x86_64-pc-linux-gnu' }}
run: |
echo "Running tests"
./test/functional/test_runner.py
- name: Publish artifact - linux
uses: actions/upload-artifact@v4
with:
name: sequentia-linux
name: sequentia-${{ env.TARGET }}
path: |
src/elementsd
src/elements-cli
src/elements-tx
src/elements-util
src/elements-wallet
src/elementsd*
src/elements-cli*
src/elements-tx*
src/elements-util*
src/elements-wallet*
2 changes: 1 addition & 1 deletion test/functional/interface_bitcoin_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def run_test(self):
assert_equal(int(cli_get_info['Keypool size']), wallet_info['keypoolsize'])
assert_equal(int(cli_get_info['Unlocked until']), wallet_info['unlocked_until'])
assert_equal(Decimal(cli_get_info['Transaction fee rate (-paytxfee) (RFU/kvB)']), wallet_info['paytxfee'])
assert_equal(Decimal(cli_get_info['Min tx relay fee rate (BTC/kvB)']), network_info['relayfee'])
assert_equal(Decimal(cli_get_info['Min tx relay fee rate (RFU/kvB)']), network_info['relayfee'])
assert_equal(self.nodes[0].cli.getwalletinfo(), wallet_info)

# Setup to test -getinfo, -generate, and -rpcwallet= with multiple wallets.
Expand Down
2 changes: 1 addition & 1 deletion test/functional/rpc_fundrawtransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ def test_option_feerate(self):
node.fundrawtransaction(rawtx, {"feeRate": 0.00000999, "add_inputs": True})

self.log.info("- raises RPC error if both feeRate and fee_rate are passed")
assert_raises_rpc_error(-8, "Cannot specify both fee_rate (rfa/vB) and feeRate (BTC/kvB)",
assert_raises_rpc_error(-8, "Cannot specify both fee_rate (rfa/vB) and feeRate (RFU/kvB)",
node.fundrawtransaction, rawtx, {"fee_rate": 0.1, "feeRate": 0.1, "add_inputs": True})

self.log.info("- raises RPC error if both feeRate and estimate_mode passed")
Expand Down
2 changes: 1 addition & 1 deletion test/functional/rpc_psbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def run_basic_tests(self, confidential):
self.nodes[1].walletcreatefundedpsbt, inputs, outputs, 0, {"fee_rate": invalid_value, "add_inputs": True})

self.log.info("- raises RPC error if both feeRate and fee_rate are passed")
assert_raises_rpc_error(-8, "Cannot specify both fee_rate (rfa/vB) and feeRate (BTC/kvB)",
assert_raises_rpc_error(-8, "Cannot specify both fee_rate (rfa/vB) and feeRate (RFU/kvB)",
self.nodes[1].walletcreatefundedpsbt, inputs, outputs, 0, {"fee_rate": 0.1, "feeRate": 0.1, "add_inputs": True})

self.log.info("- raises RPC error if both feeRate and estimate_mode passed")
Expand Down
6 changes: 3 additions & 3 deletions test/functional/wallet_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def run_test(self):

self.log.info("Test sendmany raises if an invalid fee_rate is passed")
# Test fee_rate with zero values.
msg = "Fee rate (0.000 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)"
msg = "Fee rate (0.000 rfa/vB) is lower than the minimum fee rate setting (1.000 rfa/vB)"
for zero_value in [0, 0.000, 0.00000000, "0", "0.000", "0.00000000"]:
assert_raises_rpc_error(-6, msg, self.nodes[2].sendmany, amounts={address: 1}, fee_rate=zero_value)
msg = "Invalid amount"
Expand Down Expand Up @@ -489,12 +489,12 @@ def run_test(self):

# Test setting explicit fee rate just below the minimum.
self.log.info("Test sendtoaddress raises 'fee rate too low' if fee_rate of 0.99999999 is passed")
assert_raises_rpc_error(-6, "Fee rate (0.999 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)",
assert_raises_rpc_error(-6, "Fee rate (0.999 rfa/vB) is lower than the minimum fee rate setting (1.000 rfa/vB)",
self.nodes[2].sendtoaddress, address=address, amount=1, fee_rate=0.999)

self.log.info("Test sendtoaddress raises if an invalid fee_rate is passed")
# Test fee_rate with zero values.
msg = "Fee rate (0.000 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)"
msg = "Fee rate (0.000 rfa/vB) is lower than the minimum fee rate setting (1.000 rfa/vB)"
for zero_value in [0, 0.000, 0.00000000, "0", "0.000", "0.00000000"]:
assert_raises_rpc_error(-6, msg, self.nodes[2].sendtoaddress, address=address, amount=1, fee_rate=zero_value)
msg = "Invalid amount"
Expand Down
4 changes: 2 additions & 2 deletions test/functional/wallet_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,13 @@ def run_test(self):

# Test setting explicit fee rate just below the minimum of 1 sat/vB.
self.log.info("Explicit fee rate raises RPC error 'fee rate too low' if fee_rate of 0.99999999 is passed")
msg = "Fee rate (0.999 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)"
msg = "Fee rate (0.999 rfa/vB) is lower than the minimum fee rate setting (1.000 rfa/vB)"
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, fee_rate=0.999, expect_error=(-4, msg))
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, arg_fee_rate=0.999, expect_error=(-4, msg))

self.log.info("Explicit fee rate raises if invalid fee_rate is passed")
# Test fee_rate with zero values.
msg = "Fee rate (0.000 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)"
msg = "Fee rate (0.000 rfa/vB) is lower than the minimum fee rate setting (1.000 rfa/vB)"
for zero_value in [0, 0.000, 0.00000000, "0", "0.000", "0.00000000"]:
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, fee_rate=zero_value, expect_error=(-4, msg))
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, arg_fee_rate=zero_value, expect_error=(-4, msg))
Expand Down

0 comments on commit 2e52cd4

Please sign in to comment.