Skip to content

Commit 8e0f2ec

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

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ HEADER_TESTS_DIR="$SCRIPT_DIR/header-tests"
1111
TARGET_DIR="$SCRIPT_DIR/../target"
1212
LIB_DIR="$TARGET_DIR/debug"
1313

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
14+
# Build FFI crates to generate static libraries and header files if they dont yet exist
15+
cargo rustc -p dash-spv-ffi --lib --crate-type staticlib
16+
cargo rustc -p key-wallet-ffi --lib --crate-type staticlib
1717

1818
# Move to ffi-c-tests directory, where the script lives, and run tests
1919
cd "$SCRIPT_DIR" || exit 1
2020

2121
EXIT_CODE=0
2222

2323
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
24+
if gcc "$file" -o test.bin -g -L"$LIB_DIR" -ldash_spv_ffi -lkey_wallet_ffi -lm; then
2525
echo -e "${GREEN}Passed: $file${NC}"
2626
else
2727
echo -e "${RED}Failed: $file${NC}"

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)