Skip to content

Commit 15ba47e

Browse files
committed
add ffi-c-tests github workflow with the validation headers job
1 parent 2d14104 commit 15ba47e

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

.github/workflows/build-and-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,8 @@ jobs:
9090
path: ${{ runner.temp }}/dashd-test-logs/
9191
retention-days: 7
9292
if-no-files-found: ignore
93+
- name: Validate headers
94+
if: matrix.group == 'ffi' && inputs.os == 'ubuntu-latest'
95+
run: |
96+
sudo apt update && sudo apt install -y build-essential
97+
bash ffi-c-tests/validate-headers.sh
Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,23 @@ set -euo pipefail
33

44
RED='\033[0;31m'
55
GREEN='\033[0;32m'
6-
NC='\033[0m' # No Color
6+
NC='\033[0m'
77

88
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
99
HEADER_TESTS_DIR="$SCRIPT_DIR/header-tests"
1010

11-
TARGET_DIR="$SCRIPT_DIR/../target"
12-
LIB_DIR="$TARGET_DIR/debug"
13-
14-
# Build FFI crates to generate static libraries and header files
15-
cargo build -p dash-spv-ffi --profile dev
16-
cargo build -p key-wallet-ffi --profile dev
17-
1811
# Move to ffi-c-tests directory, where the script lives, and run tests
1912
cd "$SCRIPT_DIR" || exit 1
2013

2114
EXIT_CODE=0
2215

2316
for file in "$HEADER_TESTS_DIR"/*.c; do
24-
if gcc "$file" -o test.bin -g -L"$LIB_DIR" -ldash_spv_ffi -lkey_wallet_ffi; then
17+
if gcc -c "$file" -o /dev/null; then
2518
echo -e "${GREEN}Passed: $file${NC}"
2619
else
2720
echo -e "${RED}Failed: $file${NC}"
2821
EXIT_CODE=1
2922
fi
3023
done
3124

32-
rm -f test.bin
33-
3425
exit $EXIT_CODE

key-wallet-ffi/src/transaction.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,9 +1003,13 @@ impl From<FFIAssetLockFundingType> for AssetLockFundingType {
10031003
match ffi {
10041004
FFIAssetLockFundingType::IdentityRegistrationFundingType => Self::IdentityRegistration,
10051005
FFIAssetLockFundingType::IdentityTopUpFundingType => Self::IdentityTopUp,
1006-
FFIAssetLockFundingType::IdentityTopUpNotBoundFundingType => Self::IdentityTopUpNotBound,
1006+
FFIAssetLockFundingType::IdentityTopUpNotBoundFundingType => {
1007+
Self::IdentityTopUpNotBound
1008+
}
10071009
FFIAssetLockFundingType::IdentityInvitationFundingType => Self::IdentityInvitation,
1008-
FFIAssetLockFundingType::AssetLockAddressTopUpFundingType => Self::AssetLockAddressTopUp,
1010+
FFIAssetLockFundingType::AssetLockAddressTopUpFundingType => {
1011+
Self::AssetLockAddressTopUp
1012+
}
10091013
FFIAssetLockFundingType::AssetLockShieldedAddressTopUpFundingType => {
10101014
Self::AssetLockShieldedAddressTopUp
10111015
}

0 commit comments

Comments
 (0)