Skip to content

Prepare 117 bindings #800

Prepare 117 bindings

Prepare 117 bindings #800

Workflow file for this run

name: Test Bindings
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check_bindings:
name: Swift Package Manager Tests
runs-on: ubuntu-latest
env:
TOOLCHAIN: stable
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Print environment versions
run: |
node --version
npm --version
yarn --version
- name: Install native Rust toolchain and build utilities
run: |
# sudo apt-get purge grub\*
# sudo apt-get --only-upgrade install grub-efi-amd64-signed
# sudo apt-get autoremove
# sudo update-grub
sudo apt-get update
# sudo apt-get -y upgrade
sudo apt-get -y install cargo lld git g++ clang curl
- name: Install Dependencies
uses: ./.github/actions/install-dependencies
with:
destination: ./ci
configureRustNightly: false
env:
LDK_SWIFT_GENERATOR_OUTPUT_DIRECTORY_PATH: ci/LDKSwift/Sources/LDKSwift/bindings
- name: Print header file checksum
run: sha256sum $LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH
env:
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: ci/ldk-c-bindings/lightning-c-bindings/include/lightning.h
- name: Copy new headers into bindings
run: |
python3 ./scripts/copy_c_files.py
env:
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
H_FILE_OUTPUT_DIRECTORY: ${{ github.workspace }}/ci/LDKSwift/Sources/LDKHeaders/include
C_FILE_OUTPUT_DIRECTORY: ${{ github.workspace }}/ci/LDKSwift/Sources/LDKHeaders
- name: Install Swift Toolchain
run: |
curl --verbose -L -o swift-5.7.2-RELEASE-ubuntu22.04.tar.gz https://download.swift.org/swift-5.7.2-release/ubuntu2204/swift-5.7.2-RELEASE/swift-5.7.2-RELEASE-ubuntu22.04.tar.gz
echo "Sha sum: $(sha256sum swift-5.7.2-RELEASE-ubuntu22.04.tar.gz | awk '{ print $1 }')"
if [ "$(sha256sum swift-5.7.2-RELEASE-ubuntu22.04.tar.gz | awk '{ print $1 }')" != "${EXPECTED_SWIFT_SHASUM}" ]; then
echo "Bad hash"
echo "Contents: \n$(cat swift-5.7.2-RELEASE-ubuntu22.04.tar.gz)"
exit 1
fi
tar xvvf swift-5.7.2-RELEASE-ubuntu22.04.tar.gz
env:
EXPECTED_SWIFT_SHASUM: e729912846b0cff98bf8e0e5ede2e17bc2d1098de3cdb6fa13b3ff52c36ee5d6
- name: Install Swift Formatter
run: |
git clone https://github.com/apple/swift-format.git
cd swift-format
git checkout "tags/$VERSION"
swift build -c release
env:
VERSION: 508.0.1
- name: Regenerate Swift files
run: |
npm install
npm run tsc
node ./src/index.mjs
env:
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: ci/ldk-c-bindings/lightning-c-bindings/include/lightning.h
SWIFT_FORMAT_PATH: ${{ github.workspace }}/swift-format/.build/release/swift-format
- name: Test bindings parsing and generation
run: npm test
- name: Verify generated output recency
run: |
git diff --exit-code out/ ':(exclude)out/VersionDescriptor.swift'
- name: Build Swift bindings package
run: |
cd ci/LDKSwift
../../swift-5.7.2-RELEASE-ubuntu22.04/usr/bin/swift build
env:
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-14/lib/clang/14.0.0/lib/linux/libclang_rt.asan-x86_64.a
RUST_BACKTRACE: 1
- name: Test Swift bindings package without address sanitizer
run: |
cd ci/LDKSwift
../../swift-5.7.2-RELEASE-ubuntu22.04/usr/bin/swift test -v
env:
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
RUST_BACKTRACE: 1
- name: Test Swift bindings package with address sanitizer
continue-on-error: true
run: |
cd ci/LDKSwift
../../swift-5.7.2-RELEASE-ubuntu22.04/usr/bin/swift test -v
env:
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-14/lib/clang/14.0.0/lib/linux/libclang_rt.asan-x86_64.a
RUST_BACKTRACE: 1