diff --git a/.github/workflows/macos-11.7-compile.yml b/.github/workflows/macos-11.7-compile.yml index eb12db1b5..3fccb6dce 100644 --- a/.github/workflows/macos-11.7-compile.yml +++ b/.github/workflows/macos-11.7-compile.yml @@ -13,91 +13,11 @@ jobs: with: submodules: 'recursive' - - name: Compile Secp256k1 + - name: Build TON run: | - export NONINTERACTIVE=1 - brew install ninja secp256k1 libsodium libmicrohttpd pkg-config automake libtool - git clone https://github.com/libbitcoin/secp256k1.git - cd secp256k1 - ./autogen.sh - ./configure --enable-module-recovery - make - make install - - - name: Build all - run: | - brew unlink openssl@1.1 - brew install openssl@3 - brew unlink openssl@3 && brew link --overwrite openssl@3 - rootPath=`pwd` - mkdir build - cd build - cmake -GNinja -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=11.7 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release .. - - ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tonlib tonlibjson tonlib-cli validator-engine \ - lite-client pow-miner validator-engine-console generate-random-id json2tlo dht-server \ - http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator \ - test-ed25519 test-ed25519-crypto test-bigint test-vm test-fift test-cells test-smartcont test-net test-tdactor \ - test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain test-fec test-tddb test-db test-validator-session-state - - - name: Strip binaries - run: | - strip build/storage/storage-daemon/storage-daemon - strip build/storage/storage-daemon/storage-daemon-cli - strip build/blockchain-explorer/blockchain-explorer - strip build/crypto/fift - strip build/crypto/func - strip build/crypto/create-state - strip build/crypto/tlbc - strip build/validator-engine-console/validator-engine-console - strip build/tonlib/tonlib-cli - strip build/http/http-proxy - strip build/rldp-http-proxy/rldp-http-proxy - strip build/dht-server/dht-server - strip build/lite-client/lite-client - strip build/validator-engine/validator-engine - strip build/utils/generate-random-id - strip build/utils/json2tlo - strip build/adnl/adnl-proxy - - - name: Run tests - run: | - cd build - ctest --output-on-failure -E "test-catchain|test-actors" - - - name: Find & copy binaries - run: | - mkdir artifacts - cp build/storage/storage-daemon/storage-daemon artifacts/ - cp build/storage/storage-daemon/storage-daemon-cli artifacts/ - cp build/blockchain-explorer/blockchain-explorer artifacts/ - cp build/crypto/fift artifacts/ - cp build/crypto/func artifacts/ - cp build/crypto/create-state artifacts/ - cp build/crypto/tlbc artifacts/ - cp build/validator-engine-console/validator-engine-console artifacts/ - cp build/tonlib/tonlib-cli artifacts/ - cp build/tonlib/libtonlibjson.0.5.dylib artifacts/libtonlibjson.dylib - cp build/http/http-proxy artifacts/ - cp build/rldp-http-proxy/rldp-http-proxy artifacts/ - cp build/dht-server/dht-server artifacts/ - cp build/lite-client/lite-client artifacts/ - cp build/validator-engine/validator-engine artifacts/ - cp build/utils/generate-random-id artifacts/ - cp build/utils/json2tlo artifacts/ - cp build/adnl/adnl-proxy artifacts/ - cp build/emulator/*emulator.* artifacts/ - chmod +x artifacts/* - rsync -r crypto/smartcont artifacts/ - rsync -r crypto/fift/lib artifacts/ - ls -laRt artifacts - - - name: Simple binaries test - run: | - artifacts/validator-engine -V - artifacts/lite-client -V - artifacts/fift -V - artifacts/func -V + cp assembly/native/build-macos-shared.sh . + chmod +x build-macos-shared.sh + sudo ./build-macos-shared.sh -t -a - name: Upload artifacts uses: actions/upload-artifact@master diff --git a/.github/workflows/macos-12.6-compile.yml b/.github/workflows/macos-12.6-compile.yml index f41efc669..169b60bcf 100644 --- a/.github/workflows/macos-12.6-compile.yml +++ b/.github/workflows/macos-12.6-compile.yml @@ -13,91 +13,11 @@ jobs: with: submodules: 'recursive' - - name: Compile Secp256k1 + - name: Build TON run: | - export NONINTERACTIVE=1 - brew install ninja secp256k1 libsodium libmicrohttpd pkg-config automake libtool - git clone https://github.com/libbitcoin/secp256k1.git - cd secp256k1 - ./autogen.sh - ./configure --enable-module-recovery - make - make install - - - name: Build all - run: | - brew unlink openssl@1.1 - brew install openssl@3 - brew unlink openssl@3 && brew link --overwrite openssl@3 - rootPath=`pwd` - mkdir build - cd build - cmake -GNinja -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=12.6 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release .. - - ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tonlib tonlibjson tonlib-cli \ - validator-engine lite-client pow-miner validator-engine-console generate-random-id json2tlo dht-server \ - http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator \ - test-ed25519 test-ed25519-crypto test-bigint test-vm test-fift test-cells test-smartcont test-net test-tdactor \ - test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain test-fec test-tddb test-db test-validator-session-state - - - name: Strip binaries - run: | - strip build/storage/storage-daemon/storage-daemon - strip build/storage/storage-daemon/storage-daemon-cli - strip build/blockchain-explorer/blockchain-explorer - strip build/crypto/fift - strip build/crypto/func - strip build/crypto/create-state - strip build/crypto/tlbc - strip build/validator-engine-console/validator-engine-console - strip build/tonlib/tonlib-cli - strip build/http/http-proxy - strip build/rldp-http-proxy/rldp-http-proxy - strip build/dht-server/dht-server - strip build/lite-client/lite-client - strip build/validator-engine/validator-engine - strip build/utils/generate-random-id - strip build/utils/json2tlo - strip build/adnl/adnl-proxy - - - name: Run tests - run: | - cd build - ctest --output-on-failure -E "test-catchain|test-actors" - - - name: Find & copy binaries - run: | - mkdir artifacts - cp build/storage/storage-daemon/storage-daemon artifacts/ - cp build/storage/storage-daemon/storage-daemon-cli artifacts/ - cp build/blockchain-explorer/blockchain-explorer artifacts/ - cp build/crypto/fift artifacts/ - cp build/crypto/func artifacts/ - cp build/crypto/create-state artifacts/ - cp build/crypto/tlbc artifacts/ - cp build/validator-engine-console/validator-engine-console artifacts/ - cp build/tonlib/tonlib-cli artifacts/ - cp build/tonlib/libtonlibjson.0.5.dylib artifacts/libtonlibjson.dylib - cp build/http/http-proxy artifacts/ - cp build/rldp-http-proxy/rldp-http-proxy artifacts/ - cp build/dht-server/dht-server artifacts/ - cp build/lite-client/lite-client artifacts/ - cp build/validator-engine/validator-engine artifacts/ - cp build/utils/generate-random-id artifacts/ - cp build/utils/json2tlo artifacts/ - cp build/adnl/adnl-proxy artifacts/ - cp build/emulator/*emulator.* artifacts/ - chmod +x artifacts/* - rsync -r crypto/smartcont artifacts/ - rsync -r crypto/fift/lib artifacts/ - ls -laRt artifacts - - - name: Simple binaries test - run: | - artifacts/validator-engine -V - artifacts/lite-client -V - artifacts/fift -V - artifacts/func -V + cp assembly/native/build-macos-shared.sh . + chmod +x build-macos-shared.sh + sudo ./build-macos-shared.sh -t -a - name: Upload artifacts uses: actions/upload-artifact@master diff --git a/.github/workflows/ton-aarch64-linux.yml b/.github/workflows/ton-aarch64-linux.yml deleted file mode 100644 index 3c600bee5..000000000 --- a/.github/workflows/ton-aarch64-linux.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "TON aarch64 Linux binaries" - -on: [workflow_dispatch,workflow_call] - -jobs: - build: - runs-on: ubuntu-22.04 - - steps: - - run: | - sudo apt update - sudo apt install -y apt-utils - sudo apt install -q -y qemu-system-aarch64 qemu-efi binfmt-support qemu-user-static - - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - uses: cachix/install-nix-action@v18 - with: - extra_nix_config: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - - name: Compile - run: nix build .?submodules=1#packages.aarch64-linux.ton-oldglibc_staticbinaries --print-build-logs --system aarch64-linux -o result-aarch64 - - - name: Copy binaries - run: | - ls -lart - mkdir artifacts - cp $PWD/result-aarch64-linux/bin/* artifacts/ - chmod +x artifacts/* - cp $PWD/result-aarch64-linux/lib/libtonlibjson.so.0.5 artifacts/libtonlibjson.so - cp $PWD/result-aarch64-linux/lib/libemulator.so artifacts/ - cp -R crypto/smartcont artifacts/ - cp -R crypto/fift/lib artifacts/ - - - name: Simple binaries test - run: | - sudo mv /nix/store /nix/store2 - artifacts/validator-engine -V - artifacts/lite-client -V - artifacts/fift -V - artifacts/func -V - - - name: Upload artifacts - uses: actions/upload-artifact@master - with: - name: ton-aarch64-linux-binaries - path: artifacts \ No newline at end of file diff --git a/.github/workflows/ton-aarch64-macos.yml b/.github/workflows/ton-aarch64-macos.yml deleted file mode 100644 index 75fcec789..000000000 --- a/.github/workflows/ton-aarch64-macos.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: "TON aarch64 macOS binaries" - -on: [workflow_dispatch,workflow_call] - -jobs: - build: - runs-on: macos-12 - - steps: - - run: brew install qemu - - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - uses: cachix/install-nix-action@v18 - with: - extra_nix_config: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - - name: Compile - run: nix build .?submodules=1#packages.aarch64-darwin.ton-staticbin-dylib --print-build-logs -o result-aarch64-darwin - - - name: Copy binaries - run: | - ls -lart - mkdir artifacts - cp $PWD/result-aarch64-darwin/bin/* artifacts/ - chmod +x artifacts/* - cp $PWD/result-aarch64-darwin/lib/libtonlibjson* artifacts/ - cp $PWD/result-aarch64-darwin/lib/libemulator* artifacts/ - cp -R crypto/smartcont artifacts/ - cp -R crypto/fift/lib artifacts/ - - - name: Simple binaries test - run: | - sudo mv /nix/store /nix/store2 - artifacts/validator-engine -V - artifacts/lite-client -V - artifacts/fift -V - artifacts/func -V - - - name: Upload artifacts - uses: actions/upload-artifact@master - with: - name: ton-aarch64-macos-binaries - path: artifacts diff --git a/.github/workflows/tonlib-android-jni.yml b/.github/workflows/ton-android-tonlib.yml similarity index 89% rename from .github/workflows/tonlib-android-jni.yml rename to .github/workflows/ton-android-tonlib.yml index 7dd832a0b..a8bdb77a1 100644 --- a/.github/workflows/tonlib-android-jni.yml +++ b/.github/workflows/ton-android-tonlib.yml @@ -1,4 +1,4 @@ -name: Tonlib Android JNI +name: Tonlib Android on: [push,workflow_dispatch,workflow_call] @@ -21,5 +21,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@master with: - name: tonlib-android-jni + name: tonlib-android path: artifacts \ No newline at end of file diff --git a/.github/workflows/ton-ccpcheck.yml b/.github/workflows/ton-ccpcheck.yml index 8e9d6ad2f..6d8fdc720 100644 --- a/.github/workflows/ton-ccpcheck.yml +++ b/.github/workflows/ton-ccpcheck.yml @@ -1,4 +1,4 @@ -name: TON Ccpcheck +name: TON Static Code Analysis on: [push,workflow_dispatch,workflow_call] diff --git a/assembly/native/build-macos-shared.sh b/assembly/native/build-macos-shared.sh new file mode 100644 index 000000000..c5b863f0c --- /dev/null +++ b/assembly/native/build-macos-shared.sh @@ -0,0 +1,125 @@ +#/bin/bash + +with_tests=false +with_artifacts=false + + +while getopts 'ta' flag; do + case "${flag}" in + t) with_tests=true ;; + a) with_artifacts=true ;; + *) break + ;; + esac +done + +if [ ! -d "build" ]; then + mkdir build + cd build +else + cd build + rm -rf .ninja* CMakeCache.txt +fi + +export NONINTERACTIVE=1 +brew install ninja libsodium libmicrohttpd pkg-config automake libtool + +if [ ! -d "secp256k1" ]; then + git clone https://github.com/bitcoin-core/secp256k1.git + cd secp256k1 + secp256k1Path=`pwd` + git checkout v0.3.2 + ./autogen.sh + ./configure --enable-module-recovery --enable-static --disable-tests --disable-benchmark + make -j12 + test $? -eq 0 || { echo "Can't compile secp256k1"; exit 1; } + cd .. +else + secp256k1Path=$(pwd)/secp256k1 + echo "Using compiled secp256k1" +fi + +brew unlink openssl@1.1 +brew install openssl@3 +brew unlink openssl@3 && brew link --overwrite openssl@3 + +cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. \ +-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15 \ +-DCMAKE_CXX_FLAGS="-stdlib=libc++" \ +-DSECP256K1_FOUND=1 \ +-DSECP256K1_INCLUDE_DIR=$secp256k1Path/include \ +-DSECP256K1_LIBRARY=$secp256k1Path/.libs/libsecp256k1.a + +test $? -eq 0 || { echo "Can't configure ton"; exit 1; } + +if [ "$with_tests" = true ]; then + ninja storage-daemon storage-daemon-cli blockchain-explorer \ + tonlib tonlibjson tonlib-cli validator-engine func fift \ + lite-client pow-miner validator-engine-console generate-random-id json2tlo dht-server \ + http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator \ + test-ed25519 test-ed25519-crypto test-bigint test-vm test-fift test-cells test-smartcont \ + test-net test-tdactor test-tdutils test-tonlib-offline test-adnl test-dht test-rldp \ + test-rldp2 test-catchain test-fec test-tddb test-db test-validator-session-state + test $? -eq 0 || { echo "Can't compile ton"; exit 1; } +else + ninja storage-daemon storage-daemon-cli blockchain-explorer \ + tonlib tonlibjson tonlib-cli validator-engine func fift \ + lite-client pow-miner validator-engine-console generate-random-id json2tlo dht-server \ + http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator + test $? -eq 0 || { echo "Can't compile ton"; exit 1; } +fi + + +strip storage/storage-daemon/storage-daemon +strip storage/storage-daemon/storage-daemon-cli +strip blockchain-explorer/blockchain-explorer +strip crypto/fift +strip crypto/func +strip crypto/create-state +strip crypto/tlbc +strip validator-engine-console/validator-engine-console +strip tonlib/tonlib-cli +strip http/http-proxy +strip rldp-http-proxy/rldp-http-proxy +strip dht-server/dht-server +strip lite-client/lite-client +strip validator-engine/validator-engine +strip utils/generate-random-id +strip utils/json2tlo +strip adnl/adnl-proxy + +cd .. + +if [ "$with_artifacts" = true ]; then + echo Creating artifacts... + + mkdir artifacts + cp build/storage/storage-daemon/storage-daemon artifacts/ + cp build/storage/storage-daemon/storage-daemon-cli artifacts/ + cp build/blockchain-explorer/blockchain-explorer artifacts/ + cp build/crypto/fift artifacts/ + cp build/crypto/func artifacts/ + cp build/crypto/create-state artifacts/ + cp build/crypto/tlbc artifacts/ + cp build/validator-engine-console/validator-engine-console artifacts/ + cp build/tonlib/tonlib-cli artifacts/ + cp build/tonlib/libtonlibjson.0.5.dylib artifacts/libtonlibjson.dylib + cp build/http/http-proxy artifacts/ + cp build/rldp-http-proxy/rldp-http-proxy artifacts/ + cp build/dht-server/dht-server artifacts/ + cp build/lite-client/lite-client artifacts/ + cp build/validator-engine/validator-engine artifacts/ + cp build/utils/generate-random-id artifacts/ + cp build/utils/json2tlo artifacts/ + cp build/adnl/adnl-proxy artifacts/ + cp build/emulator/*emulator.* artifacts/ + chmod +x artifacts/* + rsync -r crypto/smartcont artifacts/ + rsync -r crypto/fift/lib artifacts/ +fi + +if [ "$with_tests" = true ]; then + echo Running tests... + cd build + ctest --output-on-failure -E "test-catchain|test-actors" +fi diff --git a/assembly/native/build-ubuntu-20.04-portable.sh b/assembly/native/build-ubuntu-20.04-portable.sh index 2fb175c3c..e9e13cdc6 100644 --- a/assembly/native/build-ubuntu-20.04-portable.sh +++ b/assembly/native/build-ubuntu-20.04-portable.sh @@ -151,15 +151,15 @@ ninja storage-daemon storage-daemon-cli fift func tonlib tonlibjson tonlib-cli \ test-vm test-fift test-cells test-smartcont test-net test-tdactor test-tdutils \ test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain \ test-fec test-tddb test-db test-validator-session-state + test $? -eq 0 || { echo "Can't compile ton"; exit 1; } else ninja storage-daemon storage-daemon-cli fift func tonlib tonlibjson tonlib-cli \ validator-engine lite-client pow-miner validator-engine-console \ generate-random-id json2tlo dht-server http-proxy rldp-http-proxy \ adnl-proxy create-state emulator + test $? -eq 0 || { echo "Can't compile ton"; exit 1; } fi -test $? -eq 0 || { echo "Can't compile ton"; exit 1; } - strip -g storage/storage-daemon/storage-daemon \ storage/storage-daemon/storage-daemon-cli \ crypto/fift \ diff --git a/assembly/native/build-ubuntu-20.04-shared.sh b/assembly/native/build-ubuntu-20.04-shared.sh index 3d9da60ab..56189f2b4 100644 --- a/assembly/native/build-ubuntu-20.04-shared.sh +++ b/assembly/native/build-ubuntu-20.04-shared.sh @@ -70,15 +70,15 @@ ninja storage-daemon storage-daemon-cli fift func tonlib tonlibjson tonlib-cli \ test-vm test-fift test-cells test-smartcont test-net test-tdactor test-tdutils \ test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain \ test-fec test-tddb test-db test-validator-session-state + test $? -eq 0 || { echo "Can't compile ton"; exit 1; } else ninja storage-daemon storage-daemon-cli fift func tonlib tonlibjson tonlib-cli \ validator-engine lite-client pow-miner validator-engine-console \ generate-random-id json2tlo dht-server http-proxy rldp-http-proxy \ adnl-proxy create-state emulator + test $? -eq 0 || { echo "Can't compile ton"; exit 1; } fi -test $? -eq 0 || { echo "Can't compile ton"; exit 1; } - strip -g storage/storage-daemon/storage-daemon \ storage/storage-daemon/storage-daemon-cli \ crypto/fift \