Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build sample apps in CI #909

Merged
merged 9 commits into from
Apr 15, 2020
Merged
4 changes: 2 additions & 2 deletions samples/go/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

// #cgo CFLAGS: -I/wallet-core/include
// #cgo LDFLAGS: -L/wallet-core/build -L/wallet-core/build/trezor-crypto -lTrustWalletCore -lprotobuf -lTrezorCrypto -lc++ -lm
// #cgo CFLAGS: -I../../include
// #cgo LDFLAGS: -L../../build -L../../build/trezor-crypto -lTrustWalletCore -lprotobuf -lTrezorCrypto -lc++ -lm
// #include <TrustWalletCore/TWHDWallet.h>
// #include <TrustWalletCore/TWString.h>
// #include <TrustWalletCore/TWData.h>
Expand Down
7 changes: 3 additions & 4 deletions tests/FIO/AddressTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ TEST(FIOAddress, ValidateData) {
}

TEST(FIOAddress, FromString) {
ASSERT_EQ(
Address("FIO5kJKNHwctcfUM5XZyiWSqSTM5HTzznJP9F3ZdbhaQAHEVq575o").string(),
"FIO5kJKNHwctcfUM5XZyiWSqSTM5HTzznJP9F3ZdbhaQAHEVq575o"
);
Address addr("FIO5kJKNHwctcfUM5XZyiWSqSTM5HTzznJP9F3ZdbhaQAHEVq575o");
ASSERT_EQ(addr.string(), "FIO5kJKNHwctcfUM5XZyiWSqSTM5HTzznJP9F3ZdbhaQAHEVq575o");
ASSERT_EQ(hex(addr.bytes), "0271195c66ec2799e436757a70cd8431d4b17733a097b18a5f7f1b6b085978ff0f343fc54e");
}

TEST(FIOAddress, FromStringInvalid) {
Expand Down
73 changes: 73 additions & 0 deletions tools/samples-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash
#
# This script builds the sample applications.

set -e

if [ -z $1 ]
then
echo "No platform argument given, use all|linux|ios|android"
set $1 'linux'
fi

if [ ! "$1" = "linux" ] && [ ! "$1" = "ios" ] && [ ! "$1" = "android" ] && [ ! "$1" = "all" ]
then
echo "Wrong platform argument given, use all|linux|ios|android"
set $1 'linux'
fi

echo "Platform argument: "$1

build_cpp() {
pushd samples/cpp
echo "Building CPP sample app:"`pwd`
cmake . -DWALLET_CORE=../../
make
echo "Building CPP sample app: done"
popd
optout21 marked this conversation as resolved.
Show resolved Hide resolved
}

build_ios() {
pushd samples/osx/cocoapods
echo "Building OSX sample app:"`pwd`
pod repo update
pod install
echo "Building OSX sample app: done"
popd
}

build_android() {
pushd samples/android
echo "Building Android sample app:"`pwd`
./gradlew assembleDebug
echo "Building Android sample app: done"
popd
}

build_go() {
pushd samples/go
echo "Building GO sample app:"`pwd`
go build -o main
echo "Building GO sample app: done"
popd
}

if [ "$1" = "linux" ]; then
build_cpp
build_go
fi

if [ "$1" = "ios" ]; then
build_ios
fi

if [ "$1" = "android" ]; then
build_android
fi

if [ "$1" = "all" ]; then
build_cpp
build_go
build_ios
build_android
fi