Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,8 @@ jobs:
path: ${{ runner.temp }}/dashd-test-logs/
retention-days: 7
if-no-files-found: ignore
- name: Validate headers
if: matrix.group == 'ffi' && inputs.os == 'ubuntu-latest'
run: |
sudo apt update && sudo apt install -y build-essential
bash ffi-c-tests/validate-headers.sh ./target/llvm-cov-target/debug/include
2 changes: 2 additions & 0 deletions dash-spv-ffi/cbindgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include_guard = "DASH_SPV_FFI_H"
autogen_warning = "/* Warning: This file is auto-generated by cbindgen. Do not modify manually. */"
include_version = true
cpp_compat = true
includes = ["../key-wallet-ffi/key-wallet-ffi.h"]

[export]
include = ["FFI"]
Expand All @@ -26,6 +27,7 @@ postfix = ""
rename_fields = "None"

[enum]
prefix_with_name = true
rename_variants = "None"

[parse]
Expand Down
3 changes: 3 additions & 0 deletions ffi-c-tests/header-tests/dash-spv.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "dash-spv-ffi/dash-spv-ffi.h"

int main() { return 0; }
3 changes: 3 additions & 0 deletions ffi-c-tests/header-tests/key-wallet.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "key-wallet-ffi/key-wallet-ffi.h"

int main() { return 0; }
4 changes: 4 additions & 0 deletions ffi-c-tests/header-tests/spv_and_key_wallet.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "dash-spv-ffi/dash-spv-ffi.h"
#include "key-wallet-ffi/key-wallet-ffi.h"

int main() { return 0; }
34 changes: 34 additions & 0 deletions ffi-c-tests/validate-headers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -euo pipefail

RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'

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

if [ $# -lt 1 ]; then
echo "Usage: $0 <include_dir>"
exit 1
fi

INCLUDE_DIR="$1"

if [ ! -d "$INCLUDE_DIR" ]; then
echo "Error: INCLUDE_DIR '$INCLUDE_DIR' does not exist or is not a directory."
exit 1
fi

EXIT_CODE=0

for file in "$HEADER_TESTS_DIR"/*.c; do
if gcc -c "$file" -I"$INCLUDE_DIR" -o /dev/null; then
echo -e "${GREEN}Passed: $file${NC}"
else
echo -e "${RED}Failed: $file${NC}"
EXIT_CODE=1
fi
done

exit $EXIT_CODE
1 change: 1 addition & 0 deletions key-wallet-ffi/cbindgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ item_types = ["functions", "enums", "structs", "typedefs", "opaque", "constants"

[enum]
# Configure enum generation
prefix_with_name = true
rename_variants = "ScreamingSnakeCase"
add_sentinel = false
derive_helper_methods = false
Expand Down
Loading