From b97a3050c88d6728f6d6af58e955d0ba336378c9 Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Sun, 22 Jun 2025 18:22:13 +0800 Subject: [PATCH 01/12] Updates actions/checkout and upload-artifact Updates the checkout and upload-artifact GitHub actions to their latest major versions in all workflow files. This ensures that the workflows benefit from the latest features, improvements, and security patches provided by these actions. --- .github/workflows/build-ton-linux-android-tonlib.yml | 6 +++--- .github/workflows/build-ton-linux-arm64-appimage.yml | 4 ++-- .github/workflows/build-ton-linux-arm64-shared.yml | 2 +- .github/workflows/build-ton-linux-x86-64-appimage.yml | 4 ++-- .github/workflows/build-ton-linux-x86-64-shared.yml | 2 +- .github/workflows/build-ton-macos-13-x86-64-portable.yml | 4 ++-- .github/workflows/build-ton-macos-14-arm64-portable.yml | 4 ++-- .github/workflows/build-ton-macos-15-arm64-shared.yml | 2 +- .github/workflows/build-ton-macos-arm64-shared.yml | 2 +- .github/workflows/build-ton-macos-x86-64-shared.yml | 2 +- .github/workflows/build-ton-wasm-emscripten.yml | 4 ++-- .github/workflows/create-release.yml | 8 +++----- .github/workflows/create-tolk-release.yml | 8 +++----- .github/workflows/docker-ubuntu-branch-image.yml | 4 ++-- .github/workflows/docker-ubuntu-image.yml | 6 +++--- .github/workflows/ton-ccpcheck.yml | 4 ++-- .github/workflows/ton-x86-64-windows.yml | 4 ++-- 17 files changed, 33 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build-ton-linux-android-tonlib.yml b/.github/workflows/build-ton-linux-android-tonlib.yml index 5cd74e363..2e89baad1 100644 --- a/.github/workflows/build-ton-linux-android-tonlib.yml +++ b/.github/workflows/build-ton-linux-android-tonlib.yml @@ -8,8 +8,8 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 - with: + uses: actions/checkout@v4 + with: submodules: 'recursive' - name: Install system libraries @@ -36,7 +36,7 @@ jobs: ./build-android-tonlib.sh -a - name: Upload artifacts - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ton-android-tonlib path: artifacts diff --git a/.github/workflows/build-ton-linux-arm64-appimage.yml b/.github/workflows/build-ton-linux-arm64-appimage.yml index a0ba4a022..b9b4a0e2d 100644 --- a/.github/workflows/build-ton-linux-arm64-appimage.yml +++ b/.github/workflows/build-ton-linux-arm64-appimage.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' @@ -92,7 +92,7 @@ jobs: cp ./artifacts/libemulator.so appimages/artifacts/ - name: Upload artifacts - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ton-arm64-linux path: appimages/artifacts diff --git a/.github/workflows/build-ton-linux-arm64-shared.yml b/.github/workflows/build-ton-linux-arm64-shared.yml index 540fffece..c48be8642 100644 --- a/.github/workflows/build-ton-linux-arm64-shared.yml +++ b/.github/workflows/build-ton-linux-arm64-shared.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' diff --git a/.github/workflows/build-ton-linux-x86-64-appimage.yml b/.github/workflows/build-ton-linux-x86-64-appimage.yml index 7ad873d22..402615c10 100644 --- a/.github/workflows/build-ton-linux-x86-64-appimage.yml +++ b/.github/workflows/build-ton-linux-x86-64-appimage.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' @@ -90,7 +90,7 @@ jobs: cp ./artifacts/libemulator.so appimages/artifacts/ - name: Upload artifacts - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ton-x86_64-linux path: appimages/artifacts diff --git a/.github/workflows/build-ton-linux-x86-64-shared.yml b/.github/workflows/build-ton-linux-x86-64-shared.yml index ed05d18aa..8ce0e26ef 100644 --- a/.github/workflows/build-ton-linux-x86-64-shared.yml +++ b/.github/workflows/build-ton-linux-x86-64-shared.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' diff --git a/.github/workflows/build-ton-macos-13-x86-64-portable.yml b/.github/workflows/build-ton-macos-13-x86-64-portable.yml index 6a6a6a255..b2374717f 100644 --- a/.github/workflows/build-ton-macos-13-x86-64-portable.yml +++ b/.github/workflows/build-ton-macos-13-x86-64-portable.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' @@ -53,7 +53,7 @@ jobs: ctest --output-on-failure --timeout 1800 - name: Upload artifacts - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ton-x86_64-macos path: artifacts diff --git a/.github/workflows/build-ton-macos-14-arm64-portable.yml b/.github/workflows/build-ton-macos-14-arm64-portable.yml index 995ff1c40..7ff5973e7 100644 --- a/.github/workflows/build-ton-macos-14-arm64-portable.yml +++ b/.github/workflows/build-ton-macos-14-arm64-portable.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' @@ -53,7 +53,7 @@ jobs: ctest --output-on-failure --timeout 1800 - name: Upload artifacts - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ton-arm64-macos path: artifacts diff --git a/.github/workflows/build-ton-macos-15-arm64-shared.yml b/.github/workflows/build-ton-macos-15-arm64-shared.yml index 1423b4eb0..edf717fe1 100644 --- a/.github/workflows/build-ton-macos-15-arm64-shared.yml +++ b/.github/workflows/build-ton-macos-15-arm64-shared.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' diff --git a/.github/workflows/build-ton-macos-arm64-shared.yml b/.github/workflows/build-ton-macos-arm64-shared.yml index 5ef9266af..eae3a9f28 100644 --- a/.github/workflows/build-ton-macos-arm64-shared.yml +++ b/.github/workflows/build-ton-macos-arm64-shared.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' diff --git a/.github/workflows/build-ton-macos-x86-64-shared.yml b/.github/workflows/build-ton-macos-x86-64-shared.yml index 6200af663..9144df528 100644 --- a/.github/workflows/build-ton-macos-x86-64-shared.yml +++ b/.github/workflows/build-ton-macos-x86-64-shared.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' diff --git a/.github/workflows/build-ton-wasm-emscripten.yml b/.github/workflows/build-ton-wasm-emscripten.yml index f9f861148..d3cd5f540 100644 --- a/.github/workflows/build-ton-wasm-emscripten.yml +++ b/.github/workflows/build-ton-wasm-emscripten.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' @@ -65,7 +65,7 @@ jobs: npx func-js stdlib.fc intrinsics.fc --fift ./output.f - name: Upload artifacts - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ton-wasm path: artifacts diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 05a3db265..3fda40734 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Download Linux arm64 artifacts uses: dawidd6/action-download-artifact@v6 @@ -159,12 +159,10 @@ jobs: - name: Create release id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: softprops/action-gh-release@v1 with: tag_name: ${{ steps.tag.outputs.TAG }} - release_name: TON ${{ steps.tag.outputs.TAG }} + name: TON ${{ steps.tag.outputs.TAG }} body: | ${{ steps.read_release.outputs.CHANGELOG_BODY }} draft: false diff --git a/.github/workflows/create-tolk-release.yml b/.github/workflows/create-tolk-release.yml index fb8438a12..92bf9cf53 100644 --- a/.github/workflows/create-tolk-release.yml +++ b/.github/workflows/create-tolk-release.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Download and unzip Linux arm64 artifacts uses: dawidd6/action-download-artifact@v6 @@ -83,12 +83,10 @@ jobs: - name: Create release id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: softprops/action-gh-release@v1 with: tag_name: ${{ inputs.tag }} - release_name: ${{ inputs.tag }} + name: ${{ inputs.tag }} draft: false prerelease: false diff --git a/.github/workflows/docker-ubuntu-branch-image.yml b/.github/workflows/docker-ubuntu-branch-image.yml index bd97ed233..7f28bbceb 100644 --- a/.github/workflows/docker-ubuntu-branch-image.yml +++ b/.github/workflows/docker-ubuntu-branch-image.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-22.04-arm steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' diff --git a/.github/workflows/docker-ubuntu-image.yml b/.github/workflows/docker-ubuntu-image.yml index 7a5eee10a..779eaa402 100644 --- a/.github/workflows/docker-ubuntu-image.yml +++ b/.github/workflows/docker-ubuntu-image.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-22.04-arm steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' @@ -101,7 +101,7 @@ jobs: - build-arm64 steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get next tag id: tag diff --git a/.github/workflows/ton-ccpcheck.yml b/.github/workflows/ton-ccpcheck.yml index 95bef5f3d..8318ed3d3 100644 --- a/.github/workflows/ton-ccpcheck.yml +++ b/.github/workflows/ton-ccpcheck.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' @@ -20,7 +20,7 @@ jobs: generate report: true - name: Upload report - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ton-ccpcheck-report path: output diff --git a/.github/workflows/ton-x86-64-windows.yml b/.github/workflows/ton-x86-64-windows.yml index 8de9e11be..7b2d9e846 100644 --- a/.github/workflows/ton-x86-64-windows.yml +++ b/.github/workflows/ton-x86-64-windows.yml @@ -17,7 +17,7 @@ jobs: systeminfo | findstr /B /C:"OS Name" /C:"OS Version" - name: Check out current repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: 'recursive' @@ -47,7 +47,7 @@ jobs: # ctest -C Release --output-on-failure -E "test-bigint" --timeout 1800 - name: Upload artifacts - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: ton-x86-64-windows path: artifacts From 772bdca6393f029623059f14dc2158df34026bcd Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Mon, 23 Jun 2025 15:21:48 +0800 Subject: [PATCH 02/12] Optimizes CI workflows for faster builds Speeds up build times by: - Implementing ccache for faster rebuilds - Adding date-based keys for cache invalidation - Installing clang from default repos for Ubuntu 24.04 - Parallelizing test execution and preparation - Improving artifact upload efficiency with batching - Refactors release creation to improve reliability - Adds static code analysis workflow --- .../build-ton-linux-x86-64-shared.yml | 41 +- .../workflows/build-ton-wasm-emscripten.yml | 68 +- .github/workflows/create-release.yml | 828 ++++++------------ .github/workflows/create-tolk-release.yml | 112 +-- .github/workflows/docker-ubuntu-image.yml | 89 +- .github/workflows/ton-ccpcheck.yml | 43 +- .github/workflows/ton-x86-64-windows.yml | 35 +- 7 files changed, 468 insertions(+), 748 deletions(-) diff --git a/.github/workflows/build-ton-linux-x86-64-shared.yml b/.github/workflows/build-ton-linux-x86-64-shared.yml index 8ce0e26ef..aa64b397c 100644 --- a/.github/workflows/build-ton-linux-x86-64-shared.yml +++ b/.github/workflows/build-ton-linux-x86-64-shared.yml @@ -26,13 +26,25 @@ jobs: run: | sudo apt-get update sudo apt-get install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev libjemalloc-dev ccache - mkdir ~/.ccache + mkdir -p ~/.ccache - - if: matrix.os != 'ubuntu-24.04' + # Smart LLVM installation based on Ubuntu version + - name: Install LLVM/Clang run: | - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 16 clang + UBUNTU_VERSION=$(lsb_release -rs) + echo "Detected Ubuntu version: $UBUNTU_VERSION" + + if [[ "$UBUNTU_VERSION" == "24.04" ]]; then + # Ubuntu 24.04 has newer clang available in default repos + echo "Installing clang from default repos for Ubuntu 24.04" + sudo apt-get install -y clang-16 || sudo apt-get install -y clang + else + # For older Ubuntu versions, use LLVM script + echo "Installing clang-16 from LLVM repos for Ubuntu $UBUNTU_VERSION" + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 16 clang || echo "Warning: LLVM script failed, using system clang" + fi - name: Cache OpenSSL id: cache-openssl @@ -41,12 +53,15 @@ jobs: path: openssl_3 key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.os }}-openssl_3-${{ hashFiles('**/assembly/native/build-ubuntu-shared.sh') }} - - name: Restore cache TON - uses: actions/cache@v4 + # Improved ccache setup with better restore keys + - name: Restore ccache + uses: actions/cache/restore@v4 with: path: ~/.ccache key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.os }}-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.os }}-shared-ccache + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-${{ matrix.os }}-shared-ccache- + ${{ runner.os }}-${{ runner.arch }}-shared-ccache- - name: Build TON run: | @@ -57,7 +72,15 @@ jobs: ./build-ubuntu-shared.sh -t -c ccache -sp + - name: Save ccache + uses: actions/cache/save@v4 + if: always() # Save cache even if build fails + with: + path: ~/.ccache + key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.os }}-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} + + # Run tests in parallel with reduced timeout for faster feedback - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 1800 + ctest --output-on-failure --timeout 900 --parallel $(nproc) diff --git a/.github/workflows/build-ton-wasm-emscripten.yml b/.github/workflows/build-ton-wasm-emscripten.yml index d3cd5f540..e85241f20 100644 --- a/.github/workflows/build-ton-wasm-emscripten.yml +++ b/.github/workflows/build-ton-wasm-emscripten.yml @@ -12,17 +12,33 @@ jobs: with: submodules: 'recursive' + - name: Date Stamp + shell: bash + id: date-stamp + run: | + echo "timestamp=$(date -u "+%Y%m%d%H%M_%S")" >> "$GITHUB_OUTPUT" + - name: Install system libraries run: | sudo apt-get update - sudo apt-get install -y build-essential git openssl cmake ninja-build zlib1g-dev libssl-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev libjemalloc-dev - mkdir -p 3pp_emscripten + sudo apt-get install -y build-essential git openssl cmake ninja-build zlib1g-dev libssl-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev libjemalloc-dev ccache + mkdir -p 3pp_emscripten ~/.ccache + # Smart LLVM installation with fallback for Ubuntu 24.04 compatibility - name: Install clang-16 run: | - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 16 clang + UBUNTU_VERSION=$(lsb_release -rs) + echo "Detected Ubuntu version: $UBUNTU_VERSION" + + if [[ "$UBUNTU_VERSION" == "24.04" ]]; then + echo "Installing clang from default repos for Ubuntu 24.04" + sudo apt-get install -y clang-16 || sudo apt-get install -y clang + else + echo "Installing clang-16 from LLVM repos" + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 16 clang || echo "Warning: LLVM script failed, using system clang" + fi - name: Cache OpenSSL id: cache-openssl @@ -38,6 +54,16 @@ jobs: path: 3pp_emscripten key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-3pp_em-${{ hashFiles('**/assembly/wasm/fift-func-wasm-build-ubuntu.sh') }} + # Add ccache for faster rebuilds + - name: Restore ccache + uses: actions/cache/restore@v4 + with: + path: ~/.ccache + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-wasm-ccache-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-wasm-ccache- + ${{ runner.os }}-${{ runner.arch }}-wasm-ccache- + - name: Build TON WASM artifacts run: | git submodule sync --recursive @@ -45,23 +71,43 @@ jobs: cp assembly/wasm/fift-func-wasm-build-ubuntu.sh . chmod +x fift-func-wasm-build-ubuntu.sh ./fift-func-wasm-build-ubuntu.sh -a + ccache -sp + + - name: Save ccache + uses: actions/cache/save@v4 + if: always() # Save cache even if build fails + with: + path: ~/.ccache + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-wasm-ccache-${{ steps.date-stamp.outputs.timestamp }} + + # Parallelize test preparation and execution + - name: Prepare test dependencies + run: | + # Prepare test files and clone func-js in parallel + cp assembly/wasm/*.fc . & + git clone --depth 1 https://github.com/ton-community/func-js.git & + wait - - name: Prepare test + - name: Setup func-js run: | - cp assembly/wasm/*.fc . - git clone https://github.com/ton-community/func-js.git cd func-js - npm install + npm ci # Use npm ci for faster, more reliable installs npm run build npm link - name: Test TON WASM artifacts run: | + # Optimize base64 encoding and file operations base64 -w 0 artifacts/funcfiftlib.wasm > artifacts/funcfiftlib.wasm.js printf "module.exports = { FuncFiftLibWasm: '" | cat - artifacts/funcfiftlib.wasm.js > temp.txt && mv temp.txt artifacts/funcfiftlib.wasm.js echo "'}" >> artifacts/funcfiftlib.wasm.js - cp artifacts/funcfiftlib.wasm.js func-js/node_modules/@ton-community/func-js-bin/dist/funcfiftlib.wasm.js - cp artifacts/funcfiftlib.js func-js/node_modules/@ton-community/func-js-bin/dist/funcfiftlib.js + + # Copy files in parallel + cp artifacts/funcfiftlib.wasm.js func-js/node_modules/@ton-community/func-js-bin/dist/funcfiftlib.wasm.js & + cp artifacts/funcfiftlib.js func-js/node_modules/@ton-community/func-js-bin/dist/funcfiftlib.js & + wait + + # Run test npx func-js stdlib.fc intrinsics.fc --fift ./output.f - name: Upload artifacts diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 3fda40734..69f50ce43 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -8,22 +8,35 @@ env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - create-release: + prepare-tag: runs-on: ubuntu-22.04 + outputs: + tag: ${{ steps.tag.outputs.TAG }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for tags + + - name: Get next tag + id: tag + run: | + git fetch --all --tags + NEW_TAG=v$(date +'%Y.%m') + FOUND=$(git tag -l | grep -c "^$NEW_TAG" || true) + if [ $FOUND -eq 0 ]; then + echo "TAG=$NEW_TAG" >> $GITHUB_OUTPUT + else + echo "TAG=$NEW_TAG-$FOUND" >> $GITHUB_OUTPUT + fi + download-artifacts: + runs-on: ubuntu-22.04 + needs: prepare-tag steps: - uses: actions/checkout@v4 + # Download all artifacts in parallel (only unpacked versions needed) - name: Download Linux arm64 artifacts - uses: dawidd6/action-download-artifact@v6 - with: - workflow: build-ton-linux-arm64-appimage.yml - path: artifacts - workflow_conclusion: success - branch: master - skip_unpack: true - - - name: Download and unzip Linux arm64 artifacts uses: dawidd6/action-download-artifact@v6 with: workflow: build-ton-linux-arm64-appimage.yml @@ -32,16 +45,7 @@ jobs: branch: master skip_unpack: false - - name: Download Linux x86-64 artifacts - uses: dawidd6/action-download-artifact@v6 - with: - workflow: build-ton-linux-x86-64-appimage.yml - path: artifacts - workflow_conclusion: success - branch: master - skip_unpack: true - - - name: Download and unzip Linux x86-64 artifacts + - name: Download Linux x86-64 artifacts uses: dawidd6/action-download-artifact@v6 with: workflow: build-ton-linux-x86-64-appimage.yml @@ -51,24 +55,6 @@ jobs: skip_unpack: false - name: Download Mac x86-64 artifacts - uses: dawidd6/action-download-artifact@v6 - with: - workflow: build-ton-macos-13-x86-64-portable.yml - path: artifacts - workflow_conclusion: success - branch: master - skip_unpack: true - - - name: Download Mac arm64 artifacts - uses: dawidd6/action-download-artifact@v6 - with: - workflow: build-ton-macos-14-arm64-portable.yml - path: artifacts - workflow_conclusion: success - branch: master - skip_unpack: true - - - name: Download and unzip Mac x86-64 artifacts uses: dawidd6/action-download-artifact@v6 with: workflow: build-ton-macos-13-x86-64-portable.yml @@ -77,7 +63,7 @@ jobs: branch: master skip_unpack: false - - name: Download and unzip arm64 artifacts + - name: Download Mac arm64 artifacts uses: dawidd6/action-download-artifact@v6 with: workflow: build-ton-macos-14-arm64-portable.yml @@ -87,15 +73,6 @@ jobs: skip_unpack: false - name: Download Windows artifacts - uses: dawidd6/action-download-artifact@v6 - with: - workflow: ton-x86-64-windows.yml - path: artifacts - workflow_conclusion: success - branch: master - skip_unpack: true - - - name: Download and unzip Windows artifacts uses: dawidd6/action-download-artifact@v6 with: workflow: ton-x86-64-windows.yml @@ -124,380 +101,198 @@ jobs: - name: Show all artifacts run: | - tree artifacts - + tree artifacts || ls -la artifacts - # create release + # Prepare packaged artifacts for upload + - name: Create packaged artifacts + run: | + cd artifacts + # Create zip files for bulk uploads if they don't exist + [ ! -f ton-x86-64-windows.zip ] && zip -r ton-x86-64-windows.zip ton-x86-64-windows/ + [ ! -f ton-x86_64-macos.zip ] && zip -r ton-x86_64-macos.zip ton-x86_64-macos/ + [ ! -f ton-arm64-macos.zip ] && zip -r ton-arm64-macos.zip ton-arm64-macos/ + [ ! -f ton-x86_64-linux.zip ] && zip -r ton-x86_64-linux.zip ton-x86_64-linux/ + [ ! -f ton-arm64-linux.zip ] && zip -r ton-arm64-linux.zip ton-arm64-linux/ + + - name: Upload packaged artifacts + uses: actions/upload-artifact@v4 + with: + name: release-artifacts + path: artifacts + + create-release: + runs-on: ubuntu-22.04 + needs: [prepare-tag, download-artifacts] + outputs: + release_id: ${{ steps.create_release.outputs.id }} + steps: + - uses: actions/checkout@v4 - name: Read Changelog.md and use it as a body of new release id: read_release shell: bash run: | - r=$(cat recent_changelog.md) - r="${r//'%'/'%25'}" - r="${r//$'\n'/'%0A'}" - r="${r//$'\r'/'%0D'}" - echo "::set-output name=CHANGELOG_BODY::$r" - - - name: Get next tag - id: tag - run: | - git fetch --all --tags - git tag -l - NEW_TAG=v$(date +'%Y.%m') - FOUND=$(git tag -l | grep $NEW_TAG | wc -l) - if [ $FOUND -eq 0 ]; then - echo "TAG=$NEW_TAG" >> $GITHUB_OUTPUT + if [ -f recent_changelog.md ]; then + r=$(cat recent_changelog.md) + r="${r//'%'/'%25'}" + r="${r//$'\n'/'%0A'}" + r="${r//$'\r'/'%0D'}" + echo "CHANGELOG_BODY=$r" >> $GITHUB_OUTPUT else - echo "TAG=$NEW_TAG-$FOUND" >> $GITHUB_OUTPUT + echo "CHANGELOG_BODY=Release ${{ needs.prepare-tag.outputs.tag }}" >> $GITHUB_OUTPUT fi - - name: Get registration token - id: getRegToken - run: | - curl -X POST -H \"Accept: application/vnd.github+json\" -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/ton-blockchain/ton/actions/runners/registration-token - - name: Create release id: create_release uses: softprops/action-gh-release@v1 with: - tag_name: ${{ steps.tag.outputs.TAG }} - name: TON ${{ steps.tag.outputs.TAG }} + tag_name: ${{ needs.prepare-tag.outputs.tag }} + name: TON ${{ needs.prepare-tag.outputs.tag }} body: | ${{ steps.read_release.outputs.CHANGELOG_BODY }} draft: false prerelease: false - # upload - - # win + # Parallel upload jobs for better performance + upload-windows: + runs-on: ubuntu-22.04 + needs: [prepare-tag, create-release, download-artifacts] + steps: + - name: Download release artifacts + uses: actions/download-artifact@v4 + with: + name: release-artifacts + path: artifacts - - name: Upload Windows 2019 artifacts + - name: Upload Windows bundle uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: artifacts/ton-x86-64-windows.zip asset_name: ton-win-x86-64.zip - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - fift - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/fift.exe - asset_name: fift.exe - tag: ${{ steps.tag.outputs.TAG }} + tag: ${{ needs.prepare-tag.outputs.tag }} - - name: Upload Windows 2019 single artifact - func - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/func.exe - asset_name: func.exe - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - tolk - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/tolk.exe - asset_name: tolk.exe - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - lite-client - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/lite-client.exe - asset_name: lite-client.exe - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - proxy-liteserver - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/proxy-liteserver.exe - asset_name: proxy-liteserver.exe - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - rldp-http-proxy - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/rldp-http-proxy.exe - asset_name: rldp-http-proxy.exe - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - http-proxy - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/http-proxy.exe - asset_name: http-proxy.exe - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - storage-daemon-cli - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/storage-daemon-cli.exe - asset_name: storage-daemon-cli.exe - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - storage-daemon - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/storage-daemon.exe - asset_name: storage-daemon.exe - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - tonlibjson - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/tonlibjson.dll - asset_name: tonlibjson.dll - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - libemulator - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/emulator.dll - asset_name: libemulator.dll - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Windows 2019 single artifact - tonlib-cli - uses: svenstaro/upload-release-action@v2 + # Batch upload Windows binaries using gh CLI for efficiency + - name: Upload Windows binaries + run: | + TAG="${{ needs.prepare-tag.outputs.tag }}" + cd artifacts/ton-x86-64-windows + + # Upload all Windows binaries in one command + gh release upload "$TAG" \ + --repo ${{ github.repository }} \ + fift.exe \ + func.exe \ + tolk.exe \ + lite-client.exe \ + proxy-liteserver.exe \ + rldp-http-proxy.exe \ + http-proxy.exe \ + storage-daemon-cli.exe \ + storage-daemon.exe \ + tonlib-cli.exe \ + tonlibjson.dll \ + emulator.dll#libemulator.dll + + upload-macos-x86: + runs-on: ubuntu-22.04 + needs: [prepare-tag, create-release, download-artifacts] + steps: + - name: Download release artifacts + uses: actions/download-artifact@v4 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/tonlib-cli.exe - asset_name: tonlib-cli.exe - tag: ${{ steps.tag.outputs.TAG }} - - # mac x86-64 + name: release-artifacts + path: artifacts - - name: Upload Mac x86-64 artifacts + - name: Upload Mac x86-64 bundle uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: artifacts/ton-x86_64-macos.zip asset_name: ton-mac-x86-64.zip - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - fift - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/fift - asset_name: fift-mac-x86-64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - func - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/func - asset_name: func-mac-x86-64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - tolk - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/tolk - asset_name: tolk-mac-x86-64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - lite-client - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/lite-client - asset_name: lite-client-mac-x86-64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - proxy-liteserver - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/proxy-liteserver - asset_name: proxy-liteserver-mac-x86-64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - rldp-http-proxy - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/rldp-http-proxy - asset_name: rldp-http-proxy-mac-x86-64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - http-proxy - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/http-proxy - asset_name: http-proxy-mac-x86-64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - storage-daemon-cli - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/storage-daemon-cli - asset_name: storage-daemon-cli-mac-x86-64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - storage-daemon - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/storage-daemon - asset_name: storage-daemon-mac-x86-64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - tonlibjson - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/libtonlibjson.dylib - asset_name: tonlibjson-mac-x86-64.dylib - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac x86-64 single artifact - libemulator - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/libemulator.dylib - asset_name: libemulator-mac-x86-64.dylib - tag: ${{ steps.tag.outputs.TAG }} + tag: ${{ needs.prepare-tag.outputs.tag }} - - name: Upload Mac x86-64 single artifact - tonlib-cli - uses: svenstaro/upload-release-action@v2 + # Batch upload Mac x86-64 binaries using gh CLI for efficiency + - name: Upload Mac x86-64 binaries + run: | + TAG="${{ needs.prepare-tag.outputs.tag }}" + cd artifacts/ton-x86_64-macos + + # Upload all Mac x86-64 binaries in batches to avoid command line limits + gh release upload "$TAG" --repo ${{ github.repository }} \ + fift#fift-mac-x86-64 \ + func#func-mac-x86-64 \ + tolk#tolk-mac-x86-64 \ + lite-client#lite-client-mac-x86-64 \ + proxy-liteserver#proxy-liteserver-mac-x86-64 \ + rldp-http-proxy#rldp-http-proxy-mac-x86-64 + + gh release upload "$TAG" --repo ${{ github.repository }} \ + http-proxy#http-proxy-mac-x86-64 \ + storage-daemon-cli#storage-daemon-cli-mac-x86-64 \ + storage-daemon#storage-daemon-mac-x86-64 \ + tonlib-cli#tonlib-cli-mac-x86-64 \ + libtonlibjson.dylib#tonlibjson-mac-x86-64.dylib \ + libemulator.dylib#libemulator-mac-x86-64.dylib + + upload-macos-arm64: + runs-on: ubuntu-22.04 + needs: [prepare-tag, create-release, download-artifacts] + steps: + - name: Download release artifacts + uses: actions/download-artifact@v4 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/tonlib-cli - asset_name: tonlib-cli-mac-x86-64 - tag: ${{ steps.tag.outputs.TAG }} - - - # mac arm64 + name: release-artifacts + path: artifacts - - name: Upload Mac arm64 artifacts + - name: Upload Mac arm64 bundle uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: artifacts/ton-arm64-macos.zip asset_name: ton-mac-arm64.zip - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - fift - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/fift - asset_name: fift-mac-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - func - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/func - asset_name: func-mac-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - tolk - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/tolk - asset_name: tolk-mac-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - lite-client - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/lite-client - asset_name: lite-client-mac-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - proxy-liteserver - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/proxy-liteserver - asset_name: proxy-liteserver-mac-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - rldp-http-proxy - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/rldp-http-proxy - asset_name: rldp-http-proxy-mac-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - http-proxy - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/http-proxy - asset_name: http-proxy-mac-arm64 - tag: ${{ steps.tag.outputs.TAG }} + tag: ${{ needs.prepare-tag.outputs.tag }} - - name: Upload Mac arm64 single artifact - storage-daemon-cli - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/storage-daemon-cli - asset_name: storage-daemon-cli-mac-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - storage-daemon - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/storage-daemon - asset_name: storage-daemon-mac-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - tonlibjson - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/libtonlibjson.dylib - asset_name: tonlibjson-mac-arm64.dylib - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - libemulator - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/libemulator.dylib - asset_name: libemulator-mac-arm64.dylib - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Mac arm64 single artifact - tonlib-cli - uses: svenstaro/upload-release-action@v2 + # Batch upload Mac arm64 binaries using gh CLI for efficiency + - name: Upload Mac arm64 binaries + run: | + TAG="${{ needs.prepare-tag.outputs.tag }}" + cd artifacts/ton-arm64-macos + + # Upload all Mac arm64 binaries in batches + gh release upload "$TAG" --repo ${{ github.repository }} \ + fift#fift-mac-arm64 \ + func#func-mac-arm64 \ + tolk#tolk-mac-arm64 \ + lite-client#lite-client-mac-arm64 \ + proxy-liteserver#proxy-liteserver-mac-arm64 \ + rldp-http-proxy#rldp-http-proxy-mac-arm64 + + gh release upload "$TAG" --repo ${{ github.repository }} \ + http-proxy#http-proxy-mac-arm64 \ + storage-daemon-cli#storage-daemon-cli-mac-arm64 \ + storage-daemon#storage-daemon-mac-arm64 \ + tonlib-cli#tonlib-cli-mac-arm64 \ + libtonlibjson.dylib#tonlibjson-mac-arm64.dylib \ + libemulator.dylib#libemulator-mac-arm64.dylib + + upload-linux-x86: + runs-on: ubuntu-22.04 + needs: [prepare-tag, create-release, download-artifacts] + steps: + - name: Download release artifacts + uses: actions/download-artifact@v4 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/tonlib-cli - asset_name: tonlib-cli-mac-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - # linux x86-64 + name: release-artifacts + path: artifacts - - name: Upload Linux x86-64 artifacts + - name: Upload Linux x86-64 bundle uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: artifacts/ton-x86_64-linux.zip asset_name: ton-linux-x86_64.zip - tag: ${{ steps.tag.outputs.TAG }} + tag: ${{ needs.prepare-tag.outputs.tag }} - name: Upload generic smartcont+lib artifact run: | @@ -505,224 +300,89 @@ jobs: cd smartcont_lib cp -r ../artifacts/ton-x86_64-linux/{smartcont,lib} . zip -r smartcont_lib.zip . - gh release upload ${{ steps.tag.outputs.TAG }} smartcont_lib.zip - - - name: Upload Linux x86-64 single artifact - fift - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/fift - asset_name: fift-linux-x86_64 - tag: ${{ steps.tag.outputs.TAG }} + gh release upload ${{ needs.prepare-tag.outputs.tag }} smartcont_lib.zip --repo ${{ github.repository }} - - name: Upload Linux x86-64 single artifact - func - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/func - asset_name: func-linux-x86_64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux x86-64 single artifact - tolk - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/tolk - asset_name: tolk-linux-x86_64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux x86-64 single artifact - lite-client - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/lite-client - asset_name: lite-client-linux-x86_64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux x86-64 single artifact - proxy-liteserver - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/proxy-liteserver - asset_name: proxy-liteserver-linux-x86_64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux x86-64 single artifact - rldp-http-proxy - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/rldp-http-proxy - asset_name: rldp-http-proxy-linux-x86_64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux x86-64 single artifact - http-proxy - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/http-proxy - asset_name: http-proxy-linux-x86_64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux x86-64 single artifact - storage-daemon-cli - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/storage-daemon-cli - asset_name: storage-daemon-cli-linux-x86_64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux x86-64 single artifact - storage-daemon - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/storage-daemon - asset_name: storage-daemon-linux-x86_64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux x86-64 single artifact - tonlibjson - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/libtonlibjson.so - asset_name: tonlibjson-linux-x86_64.so - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux x86-64 single artifact - libemulator - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/libemulator.so - asset_name: libemulator-linux-x86_64.so - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux x86-64 single artifact - tonlib-cli - uses: svenstaro/upload-release-action@v2 + # Batch upload Linux x86-64 binaries using gh CLI for efficiency + - name: Upload Linux x86-64 binaries + run: | + TAG="${{ needs.prepare-tag.outputs.tag }}" + cd artifacts/ton-x86_64-linux + + # Upload all Linux x86-64 binaries in batches + gh release upload "$TAG" --repo ${{ github.repository }} \ + fift#fift-linux-x86_64 \ + func#func-linux-x86_64 \ + tolk#tolk-linux-x86_64 \ + lite-client#lite-client-linux-x86_64 \ + proxy-liteserver#proxy-liteserver-linux-x86_64 \ + rldp-http-proxy#rldp-http-proxy-linux-x86_64 + + gh release upload "$TAG" --repo ${{ github.repository }} \ + http-proxy#http-proxy-linux-x86_64 \ + storage-daemon-cli#storage-daemon-cli-linux-x86_64 \ + storage-daemon#storage-daemon-linux-x86_64 \ + tonlib-cli#tonlib-cli-linux-x86_64 \ + libtonlibjson.so#tonlibjson-linux-x86_64.so \ + libemulator.so#libemulator-linux-x86_64.so + + + upload-linux-arm64: + runs-on: ubuntu-22.04 + needs: [prepare-tag, create-release, download-artifacts] + steps: + - name: Download release artifacts + uses: actions/download-artifact@v4 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/tonlib-cli - asset_name: tonlib-cli-linux-x86_64 - tag: ${{ steps.tag.outputs.TAG }} - - - # linux arm64 + name: release-artifacts + path: artifacts - - name: Upload Linux arm64 artifacts + - name: Upload Linux arm64 bundle uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: artifacts/ton-arm64-linux.zip asset_name: ton-linux-arm64.zip - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - fift - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/fift - asset_name: fift-linux-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - func - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/func - asset_name: func-linux-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - tolk - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/tolk - asset_name: tolk-linux-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - lite-client - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/lite-client - asset_name: lite-client-linux-arm64 - tag: ${{ steps.tag.outputs.TAG }} + tag: ${{ needs.prepare-tag.outputs.tag }} - - name: Upload Linux arm64 single artifact - proxy-liteserver - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/proxy-liteserver - asset_name: proxy-liteserver-linux-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - rldp-http-proxy - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/rldp-http-proxy - asset_name: rldp-http-proxy-linux-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - http-proxy - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/http-proxy - asset_name: http-proxy-linux-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - storage-daemon-cli - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/storage-daemon-cli - asset_name: storage-daemon-cli-linux-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - storage-daemon - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/storage-daemon - asset_name: storage-daemon-linux-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - tonlibjson - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/libtonlibjson.so - asset_name: tonlibjson-linux-arm64.so - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - libemulator - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/libemulator.so - asset_name: libemulator-linux-arm64.so - tag: ${{ steps.tag.outputs.TAG }} - - - name: Upload Linux arm64 single artifact - tonlib-cli - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/tonlib-cli - asset_name: tonlib-cli-linux-arm64 - tag: ${{ steps.tag.outputs.TAG }} - - - - name: Upload WASM artifacts - uses: svenstaro/upload-release-action@v2 + # Batch upload Linux arm64 binaries using gh CLI for efficiency + - name: Upload Linux arm64 binaries + run: | + TAG="${{ needs.prepare-tag.outputs.tag }}" + cd artifacts/ton-arm64-linux + + # Upload all Linux arm64 binaries in batches + gh release upload "$TAG" --repo ${{ github.repository }} \ + fift#fift-linux-arm64 \ + func#func-linux-arm64 \ + tolk#tolk-linux-arm64 \ + lite-client#lite-client-linux-arm64 \ + proxy-liteserver#proxy-liteserver-linux-arm64 \ + rldp-http-proxy#rldp-http-proxy-linux-arm64 + + gh release upload "$TAG" --repo ${{ github.repository }} \ + http-proxy#http-proxy-linux-arm64 \ + storage-daemon-cli#storage-daemon-cli-linux-arm64 \ + storage-daemon#storage-daemon-linux-arm64 \ + tonlib-cli#tonlib-cli-linux-arm64 \ + libtonlibjson.so#tonlibjson-linux-arm64.so \ + libemulator.so#libemulator-linux-arm64.so + + upload-wasm-android: + runs-on: ubuntu-22.04 + needs: [prepare-tag, create-release, download-artifacts] + steps: + - name: Download release artifacts + uses: actions/download-artifact@v4 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-wasm.zip - asset_name: ton-wasm.zip - tag: ${{ steps.tag.outputs.TAG }} + name: release-artifacts + path: artifacts - - name: Upload Android Tonlib artifacts - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-android-tonlib.zip - asset_name: ton-android-tonlib.zip - tag: ${{ steps.tag.outputs.TAG }} + # Upload WASM and Android artifacts together since they're smaller + - name: Upload WASM and Android artifacts + run: | + TAG="${{ needs.prepare-tag.outputs.tag }}" + + # Upload WASM and Android bundles simultaneously + gh release upload "$TAG" --repo ${{ github.repository }} \ + artifacts/ton-wasm.zip \ + artifacts/ton-android-tonlib.zip diff --git a/.github/workflows/create-tolk-release.yml b/.github/workflows/create-tolk-release.yml index 92bf9cf53..35d5e670a 100644 --- a/.github/workflows/create-tolk-release.yml +++ b/.github/workflows/create-tolk-release.yml @@ -10,13 +10,14 @@ on: permissions: write-all jobs: - create-release: + # Download artifacts in parallel for better performance + download-artifacts: runs-on: ubuntu-22.04 - steps: - uses: actions/checkout@v4 - - name: Download and unzip Linux arm64 artifacts + # Download all artifacts in parallel (only unpacked versions needed) + - name: Download Linux arm64 artifacts uses: dawidd6/action-download-artifact@v6 with: workflow: build-ton-linux-arm64-appimage.yml @@ -25,7 +26,7 @@ jobs: branch: master skip_unpack: false - - name: Download and unzip Linux x86-64 artifacts + - name: Download Linux x86-64 artifacts uses: dawidd6/action-download-artifact@v6 with: workflow: build-ton-linux-x86-64-appimage.yml @@ -34,7 +35,7 @@ jobs: branch: master skip_unpack: false - - name: Download and unzip Mac x86-64 artifacts + - name: Download Mac x86-64 artifacts uses: dawidd6/action-download-artifact@v6 with: workflow: build-ton-macos-13-x86-64-portable.yml @@ -43,7 +44,7 @@ jobs: branch: master skip_unpack: false - - name: Download and unzip arm64 artifacts + - name: Download Mac arm64 artifacts uses: dawidd6/action-download-artifact@v6 with: workflow: build-ton-macos-14-arm64-portable.yml @@ -52,7 +53,7 @@ jobs: branch: master skip_unpack: false - - name: Download and unzip Windows artifacts + - name: Download Windows artifacts uses: dawidd6/action-download-artifact@v6 with: workflow: ton-x86-64-windows.yml @@ -72,14 +73,25 @@ jobs: - name: Show all artifacts run: | - tree artifacts - + tree artifacts || ls -la artifacts - # create release - - name: Get registration token - id: getRegToken - run: | - curl -X POST -H \"Accept: application/vnd.github+json\" -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/ton-blockchain/ton/actions/runners/registration-token + - name: Upload artifacts for release job + uses: actions/upload-artifact@v4 + with: + name: tolk-release-artifacts + path: artifacts + + create-release: + runs-on: ubuntu-22.04 + needs: download-artifacts + steps: + - uses: actions/checkout@v4 + + - name: Download release artifacts + uses: actions/download-artifact@v4 + with: + name: tolk-release-artifacts + path: artifacts - name: Create release id: create_release @@ -90,63 +102,17 @@ jobs: draft: false prerelease: false - # upload - - # win - - - name: Upload Windows 2019 single artifact - tolk - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86-64-windows/tolk.exe - asset_name: tolk.exe - tag: ${{ inputs.tag }} - - # mac x86-64 - - - name: Upload Mac x86-64 single artifact - tolk - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-macos/tolk - asset_name: tolk-mac-x86-64 - tag: ${{ inputs.tag }} - - # mac arm64 - - - name: Upload Mac arm64 single artifact - tolk - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-macos/tolk - asset_name: tolk-mac-arm64 - tag: ${{ inputs.tag }} - - # linux x86-64 - - - name: Upload Linux x86-64 single artifact - tolk - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-x86_64-linux/tolk - asset_name: tolk-linux-x86_64 - tag: ${{ inputs.tag }} - - # linux arm64 - - - name: Upload Linux arm64 single artifact - tolk - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-arm64-linux/tolk - asset_name: tolk-linux-arm64 - tag: ${{ inputs.tag }} - - - name: Upload WASM artifacts - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/ton-wasm.zip - asset_name: ton-wasm.zip - tag: ${{ inputs.tag }} + # Batch upload all tolk binaries using gh CLI for efficiency + - name: Upload all tolk binaries + run: | + TAG="${{ inputs.tag }}" + + # Upload all tolk binaries in one efficient command + gh release upload "$TAG" --repo ${{ github.repository }} \ + artifacts/ton-x86-64-windows/tolk.exe \ + artifacts/ton-x86_64-macos/tolk#tolk-mac-x86-64 \ + artifacts/ton-arm64-macos/tolk#tolk-mac-arm64 \ + artifacts/ton-x86_64-linux/tolk#tolk-linux-x86_64 \ + artifacts/ton-arm64-linux/tolk#tolk-linux-arm64 \ + artifacts/ton-wasm.zip diff --git a/.github/workflows/docker-ubuntu-image.yml b/.github/workflows/docker-ubuntu-image.yml index 779eaa402..479d1e80d 100644 --- a/.github/workflows/docker-ubuntu-image.yml +++ b/.github/workflows/docker-ubuntu-image.yml @@ -10,17 +10,38 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: + # Generate tag once and share across all jobs for consistency + prepare-tag: + runs-on: ubuntu-22.04 + outputs: + tag: ${{ steps.tag.outputs.TAG }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for tags + + - name: Get next tag + id: tag + run: | + git fetch --all --tags + NEW_TAG=v$(date +'%Y.%m') + FOUND=$(git tag -l | grep -c "^$NEW_TAG" || true) + if [ $FOUND -eq 0 ]; then + echo "TAG=$NEW_TAG" >> $GITHUB_OUTPUT + else + echo "TAG=$NEW_TAG-$FOUND" >> $GITHUB_OUTPUT + fi + + # Build both architectures in parallel with better caching build-arm64: runs-on: ubuntu-22.04-arm + needs: prepare-tag steps: - name: Check out repository uses: actions/checkout@v4 with: submodules: 'recursive' - - name: Set up QEMU - uses: docker/setup-qemu-action@v3.5.0 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.10.0 @@ -31,38 +52,25 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Get next tag - id: tag - run: | - git fetch --all --tags - git tag -l - NEW_TAG=v$(date +'%Y.%m') - FOUND=$(git tag -l | grep $NEW_TAG | wc -l) - if [ $FOUND -eq 0 ]; then - echo "TAG=$NEW_TAG" >> $GITHUB_OUTPUT - else - echo "TAG=$NEW_TAG-$FOUND" >> $GITHUB_OUTPUT - fi - - name: Build and push uses: docker/build-push-action@v6 with: platforms: linux/arm64 push: true context: ./ - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.TAG }}-arm64 + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.prepare-tag.outputs.tag }}-arm64 + cache-from: type=gha + cache-to: type=gha,mode=max build-amd64: runs-on: ubuntu-22.04 + needs: prepare-tag steps: - name: Check out repository uses: actions/checkout@v4 with: submodules: 'recursive' - - name: Set up QEMU - uses: docker/setup-qemu-action@v3.5.0 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.10.0 @@ -73,49 +81,20 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Get next tag - id: tag - run: | - git fetch --all --tags - git tag -l - NEW_TAG=v$(date +'%Y.%m') - FOUND=$(git tag -l | grep $NEW_TAG | wc -l) - if [ $FOUND -eq 0 ]; then - echo "TAG=$NEW_TAG" >> $GITHUB_OUTPUT - else - echo "TAG=$NEW_TAG-$FOUND" >> $GITHUB_OUTPUT - fi - - name: Build and push uses: docker/build-push-action@v6 with: platforms: linux/amd64 push: true context: ./ - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.TAG }}-amd64 + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.prepare-tag.outputs.tag }}-amd64 + cache-from: type=gha + cache-to: type=gha,mode=max merge: runs-on: ubuntu-22.04 - needs: - - build-amd64 - - build-arm64 + needs: [prepare-tag, build-amd64, build-arm64] steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Get next tag - id: tag - run: | - git fetch --all --tags - git tag -l - NEW_TAG=v$(date +'%Y.%m') - FOUND=$(git tag -l | grep $NEW_TAG | wc -l) - if [ $FOUND -eq 0 ]; then - echo "TAG=$NEW_TAG" >> $GITHUB_OUTPUT - else - echo "TAG=$NEW_TAG-$FOUND" >> $GITHUB_OUTPUT - fi - - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -130,8 +109,8 @@ jobs: run: | docker buildx imagetools create \ --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.TAG }}-arm64 \ - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.TAG }}-amd64 + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.prepare-tag.outputs.tag }}-arm64 \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.prepare-tag.outputs.tag }}-amd64 - name: Inspect image run: | diff --git a/.github/workflows/ton-ccpcheck.yml b/.github/workflows/ton-ccpcheck.yml index 8318ed3d3..a3d8531bd 100644 --- a/.github/workflows/ton-ccpcheck.yml +++ b/.github/workflows/ton-ccpcheck.yml @@ -3,24 +3,53 @@ name: TON Static Code Analysis on: [push,workflow_dispatch,workflow_call] jobs: - build: + cppcheck: runs-on: ubuntu-22.04 + # Only run on pushes to main branches or manual triggers to save resources + if: github.event_name == 'workflow_dispatch' || contains(github.ref, 'master') || contains(github.ref, 'main') steps: - name: Check out repository uses: actions/checkout@v4 with: submodules: 'recursive' + # Shallow clone for faster checkout since we only need current state + fetch-depth: 1 + # Install cppcheck directly for better performance control + - name: Install Cppcheck + run: | + sudo apt-get update + sudo apt-get install -y cppcheck + + # Run cppcheck with optimized settings for better performance - name: Run Cppcheck - uses: Bedzior/run-cppcheck@master - with: - enabled checks: all - enable inconclusive: true - generate report: true + run: | + mkdir -p output + cppcheck \ + --enable=warning,style,performance,portability \ + --inconclusive \ + --xml \ + --xml-version=2 \ + --output-file=output/cppcheck-report.xml \ + --suppress=missingIncludeSystem \ + --suppress=unusedFunction \ + --quiet \ + --force \ + --parallel=$(nproc) \ + --std=c++17 \ + --platform=unix64 \ + . 2>&1 || true + + # Generate HTML report for better readability + cppcheck-htmlreport \ + --file=output/cppcheck-report.xml \ + --report-dir=output/html-report \ + --source-dir=. || true - name: Upload report uses: actions/upload-artifact@v4 + if: always() # Upload even if cppcheck finds issues with: - name: ton-ccpcheck-report + name: ton-cppcheck-report path: output diff --git a/.github/workflows/ton-x86-64-windows.yml b/.github/workflows/ton-x86-64-windows.yml index 7b2d9e846..226227334 100644 --- a/.github/workflows/ton-x86-64-windows.yml +++ b/.github/workflows/ton-x86-64-windows.yml @@ -8,7 +8,6 @@ defaults: jobs: build: - runs-on: windows-2022 steps: @@ -21,16 +20,26 @@ jobs: with: submodules: 'recursive' + - name: Date Stamp + shell: pwsh + id: date-stamp + run: | + $timestamp = Get-Date -Format "yyyyMMddHHmm_ss" -AsUTC + echo "timestamp=$timestamp" >> $env:GITHUB_OUTPUT + - name: Create directories run: | mkdir third_libs - - name: Cache 3pp - id: cache-3pp - uses: actions/cache@v4 + # Improved cache with better restore keys + - name: Restore 3pp cache + uses: actions/cache/restore@v4 with: path: third_libs - key: ${{ runner.os }}-${{ runner.arch }}-windows-2022-3pp-${{ hashFiles('**/assembly/native/build-windows-2022.bat') }} + key: ${{ runner.os }}-${{ runner.arch }}-windows-2022-3pp-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-windows-2022-3pp- + ${{ runner.os }}-${{ runner.arch }}-3pp- - name: Build TON run: | @@ -41,10 +50,18 @@ jobs: build-windows-github-2022.bat Enterprise ccache -sp -# - name: Run Tests -# run: | -# cd build -# ctest -C Release --output-on-failure -E "test-bigint" --timeout 1800 + - name: Save 3pp cache + uses: actions/cache/save@v4 + if: always() # Save cache even if build fails + with: + path: third_libs + key: ${{ runner.os }}-${{ runner.arch }}-windows-2022-3pp-${{ steps.date-stamp.outputs.timestamp }} + + # Re-enable tests with optimized settings + - name: Run Tests + run: | + cd build + ctest -C Release --output-on-failure -E "test-bigint" --timeout 900 --parallel %NUMBER_OF_PROCESSORS% - name: Upload artifacts uses: actions/upload-artifact@v4 From 49a49db6bf68711316017065449e19a195c69c56 Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Mon, 23 Jun 2025 16:32:13 +0800 Subject: [PATCH 03/12] Improves CI build workflows Refactors CI workflows for better reliability and performance. - Adapts Linux builds to automatically use the distribution-provided clang on Ubuntu 24.04. - Enhances macOS builds with explicit tool installation and improved caching strategies using timestamp-based keys and save operations. - Reduces test timeout and enables parallel test execution on macOS. - Fixes an issue preventing creation of necessary directories. - Uses `npm install` for func-js due to potentially missing `package-lock.json`. - Updates MacOS versions, target architectures, and artifacts names to reflect build changes. --- .../build-ton-linux-arm64-appimage.yml | 22 +++++++-- .../build-ton-linux-x86-64-appimage.yml | 22 +++++++-- .../build-ton-macos-13-x86-64-portable.yml | 46 +++++++++++++------ .../build-ton-macos-14-arm64-portable.yml | 46 +++++++++++++------ .../build-ton-macos-15-arm64-shared.yml | 26 ++++++++--- .../build-ton-macos-arm64-shared.yml | 26 ++++++++--- .../build-ton-macos-x86-64-shared.yml | 26 ++++++++--- .../workflows/build-ton-wasm-emscripten.yml | 2 +- 8 files changed, 158 insertions(+), 58 deletions(-) diff --git a/.github/workflows/build-ton-linux-arm64-appimage.yml b/.github/workflows/build-ton-linux-arm64-appimage.yml index b9b4a0e2d..2188174f9 100644 --- a/.github/workflows/build-ton-linux-arm64-appimage.yml +++ b/.github/workflows/build-ton-linux-arm64-appimage.yml @@ -23,13 +23,25 @@ jobs: sudo apt update sudo apt install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev ccache sudo apt remove libgsl-dev - mkdir ~/.ccache 3pp + mkdir -p ~/.ccache 3pp - - name: Install clang-16 + # Smart LLVM installation based on Ubuntu version + - name: Install LLVM/Clang run: | - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 16 clang + UBUNTU_VERSION=$(lsb_release -rs) + echo "Detected Ubuntu version: $UBUNTU_VERSION" + + if [[ "$UBUNTU_VERSION" == "24.04" ]]; then + # Ubuntu 24.04 has newer clang available in default repos + echo "Installing clang from default repos for Ubuntu 24.04" + sudo apt-get install -y clang-16 || sudo apt-get install -y clang + else + # For older Ubuntu versions, use LLVM script + echo "Installing clang-16 from LLVM repos for Ubuntu $UBUNTU_VERSION" + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 16 clang || echo "Warning: LLVM script failed, using system clang" + fi - name: Cache 3pp id: cache-3pp diff --git a/.github/workflows/build-ton-linux-x86-64-appimage.yml b/.github/workflows/build-ton-linux-x86-64-appimage.yml index 402615c10..38c9fdf41 100644 --- a/.github/workflows/build-ton-linux-x86-64-appimage.yml +++ b/.github/workflows/build-ton-linux-x86-64-appimage.yml @@ -22,13 +22,25 @@ jobs: run: | sudo apt update sudo apt install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev ccache libgsl-dev libblas-dev - mkdir ~/.ccache 3pp + mkdir -p ~/.ccache 3pp - - name: Install clang-16 + # Smart LLVM installation based on Ubuntu version + - name: Install LLVM/Clang run: | - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 16 clang + UBUNTU_VERSION=$(lsb_release -rs) + echo "Detected Ubuntu version: $UBUNTU_VERSION" + + if [[ "$UBUNTU_VERSION" == "24.04" ]]; then + # Ubuntu 24.04 has newer clang available in default repos + echo "Installing clang from default repos for Ubuntu 24.04" + sudo apt-get install -y clang-16 || sudo apt-get install -y clang + else + # For older Ubuntu versions, use LLVM script + echo "Installing clang-16 from LLVM repos for Ubuntu $UBUNTU_VERSION" + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 16 clang || echo "Warning: LLVM script failed, using system clang" + fi - name: Cache 3pp id: cache-3pp diff --git a/.github/workflows/build-ton-macos-13-x86-64-portable.yml b/.github/workflows/build-ton-macos-13-x86-64-portable.yml index b2374717f..0bc8c52d6 100644 --- a/.github/workflows/build-ton-macos-13-x86-64-portable.yml +++ b/.github/workflows/build-ton-macos-13-x86-64-portable.yml @@ -18,25 +18,30 @@ jobs: run: | echo "timestamp=$(date -u "+%Y%m%d%H%M_%S")" >> "$GITHUB_OUTPUT" - - name: Create directories + - name: Setup build environment run: | - mkdir -p ~/.ccache - mkdir -p 3pp + # Install required tools for macOS build + brew install autoconf automake libtool ccache + mkdir -p ~/.ccache 3pp - - name: Cache 3pp - id: cache-3pp - uses: actions/cache@v4 + # Improved cache with better restore keys + - name: Restore 3pp cache + uses: actions/cache/restore@v4 with: path: 3pp - key: ${{ runner.os }}-${{ runner.arch }}-13-3pp-${{ hashFiles('**/assembly/native/build-macos-portable.sh') }} + key: ${{ runner.os }}-${{ runner.arch }}-macos-13-3pp-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-macos-13-3pp- + ${{ runner.os }}-${{ runner.arch }}-3pp- - - name: Cache TON test - id: cache-ton - uses: actions/cache@v4 + - name: Restore ccache + uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-13-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: ${{ runner.os }}-${{ runner.arch }}-13-portable-ccache + key: ${{ runner.os }}-${{ runner.arch }}-macos-13-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-macos-13-portable-ccache- + ${{ runner.os }}-${{ runner.arch }}-portable-ccache- - name: Build TON run: | @@ -47,10 +52,25 @@ jobs: ./build-macos-portable.sh -t -a -c -o 13.0 ccache -sp + - name: Save 3pp cache + uses: actions/cache/save@v4 + if: always() # Save cache even if build fails + with: + path: 3pp + key: ${{ runner.os }}-${{ runner.arch }}-macos-13-3pp-${{ steps.date-stamp.outputs.timestamp }} + + - name: Save ccache + uses: actions/cache/save@v4 + if: always() # Save cache even if build fails + with: + path: ~/.ccache + key: ${{ runner.os }}-${{ runner.arch }}-macos-13-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} + + # Run tests in parallel with reduced timeout for faster feedback - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 1800 + ctest --output-on-failure --timeout 900 --parallel $(sysctl -n hw.ncpu) - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build-ton-macos-14-arm64-portable.yml b/.github/workflows/build-ton-macos-14-arm64-portable.yml index 7ff5973e7..4dda29a14 100644 --- a/.github/workflows/build-ton-macos-14-arm64-portable.yml +++ b/.github/workflows/build-ton-macos-14-arm64-portable.yml @@ -18,25 +18,30 @@ jobs: run: | echo "timestamp=$(date -u "+%Y%m%d%H%M_%S")" >> "$GITHUB_OUTPUT" - - name: Create directories + - name: Setup build environment run: | - mkdir -p ~/.ccache - mkdir -p 3pp + # Install required tools for macOS build + brew install autoconf automake libtool ccache + mkdir -p ~/.ccache 3pp - - name: Cache 3pp - id: cache-3pp - uses: actions/cache@v4 + # Improved cache with better restore keys + - name: Restore 3pp cache + uses: actions/cache/restore@v4 with: path: 3pp - key: ${{ runner.os }}-${{ runner.arch }}-14-3pp-${{ hashFiles('**/assembly/native/build-macos-portable.sh') }} + key: ${{ runner.os }}-${{ runner.arch }}-macos-14-3pp-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-macos-14-3pp- + ${{ runner.os }}-${{ runner.arch }}-3pp- - - name: Cache TON - id: cache-ton - uses: actions/cache@v4 + - name: Restore ccache + uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-14-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: ${{ runner.os }}-${{ runner.arch }}-14-portable-ccache + key: ${{ runner.os }}-${{ runner.arch }}-macos-14-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-macos-14-portable-ccache- + ${{ runner.os }}-${{ runner.arch }}-portable-ccache- - name: Build TON run: | @@ -47,10 +52,25 @@ jobs: ./build-macos-portable.sh -t -a -c -o 14.0 ccache -sp + - name: Save 3pp cache + uses: actions/cache/save@v4 + if: always() # Save cache even if build fails + with: + path: 3pp + key: ${{ runner.os }}-${{ runner.arch }}-macos-14-3pp-${{ steps.date-stamp.outputs.timestamp }} + + - name: Save ccache + uses: actions/cache/save@v4 + if: always() # Save cache even if build fails + with: + path: ~/.ccache + key: ${{ runner.os }}-${{ runner.arch }}-macos-14-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} + + # Run tests in parallel with reduced timeout for faster feedback - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 1800 + ctest --output-on-failure --timeout 900 --parallel $(sysctl -n hw.ncpu) - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build-ton-macos-15-arm64-shared.yml b/.github/workflows/build-ton-macos-15-arm64-shared.yml index edf717fe1..63d1cbfa5 100644 --- a/.github/workflows/build-ton-macos-15-arm64-shared.yml +++ b/.github/workflows/build-ton-macos-15-arm64-shared.yml @@ -18,17 +18,21 @@ jobs: run: | echo "timestamp=$(date -u "+%Y%m%d%H%M_%S")" >> "$GITHUB_OUTPUT" - - name: Create ~/.ccache + - name: Setup build environment run: | + # Install ccache for faster builds + brew install ccache mkdir -p ~/.ccache - - name: Cache TON - id: cache-ton - uses: actions/cache@v4 + # Improved cache with better restore keys + - name: Restore ccache + uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-15-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: ${{ runner.os }}-${{ runner.arch }}-15-shared-ccache + key: ${{ runner.os }}-${{ runner.arch }}-macos-15-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-macos-15-shared-ccache- + ${{ runner.os }}-${{ runner.arch }}-shared-ccache- - name: Build TON run: | @@ -39,7 +43,15 @@ jobs: ./build-macos-shared.sh -t -c -o 15.0 ccache -sp + - name: Save ccache + uses: actions/cache/save@v4 + if: always() # Save cache even if build fails + with: + path: ~/.ccache + key: ${{ runner.os }}-${{ runner.arch }}-macos-15-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} + + # Run tests in parallel with reduced timeout for faster feedback - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 1800 + ctest --output-on-failure --timeout 900 --parallel $(sysctl -n hw.ncpu) diff --git a/.github/workflows/build-ton-macos-arm64-shared.yml b/.github/workflows/build-ton-macos-arm64-shared.yml index eae3a9f28..af816d661 100644 --- a/.github/workflows/build-ton-macos-arm64-shared.yml +++ b/.github/workflows/build-ton-macos-arm64-shared.yml @@ -18,17 +18,21 @@ jobs: run: | echo "timestamp=$(date -u "+%Y%m%d%H%M_%S")" >> "$GITHUB_OUTPUT" - - name: Create ~/.ccache + - name: Setup build environment run: | + # Install ccache for faster builds + brew install ccache mkdir -p ~/.ccache - - name: Cache TON - id: cache-ton - uses: actions/cache@v4 + # Improved cache with better restore keys + - name: Restore ccache + uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-14-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: ${{ runner.os }}-${{ runner.arch }}-14-shared-ccache + key: ${{ runner.os }}-${{ runner.arch }}-macos-14-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-macos-14-shared-ccache- + ${{ runner.os }}-${{ runner.arch }}-shared-ccache- - name: Build TON run: | @@ -39,7 +43,15 @@ jobs: ./build-macos-shared.sh -t -c -o 14.0 ccache -sp + - name: Save ccache + uses: actions/cache/save@v4 + if: always() # Save cache even if build fails + with: + path: ~/.ccache + key: ${{ runner.os }}-${{ runner.arch }}-macos-14-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} + + # Run tests in parallel with reduced timeout for faster feedback - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 1800 + ctest --output-on-failure --timeout 900 --parallel $(sysctl -n hw.ncpu) diff --git a/.github/workflows/build-ton-macos-x86-64-shared.yml b/.github/workflows/build-ton-macos-x86-64-shared.yml index 9144df528..41aeed052 100644 --- a/.github/workflows/build-ton-macos-x86-64-shared.yml +++ b/.github/workflows/build-ton-macos-x86-64-shared.yml @@ -18,17 +18,21 @@ jobs: run: | echo "timestamp=$(date -u "+%Y%m%d%H%M_%S")" >> "$GITHUB_OUTPUT" - - name: Create ~/.ccache + - name: Setup build environment run: | + # Install ccache for faster builds + brew install ccache mkdir -p ~/.ccache - - name: Cache TON test - id: cache-ton - uses: actions/cache@v4 + # Improved cache with better restore keys + - name: Restore ccache + uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-13-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: ${{ runner.os }}-${{ runner.arch }}-13-shared-ccache + key: ${{ runner.os }}-${{ runner.arch }}-macos-13-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-macos-13-shared-ccache- + ${{ runner.os }}-${{ runner.arch }}-shared-ccache- - name: Build TON run: | @@ -39,7 +43,15 @@ jobs: ./build-macos-shared.sh -t -c ccache -sp + - name: Save ccache + uses: actions/cache/save@v4 + if: always() # Save cache even if build fails + with: + path: ~/.ccache + key: ${{ runner.os }}-${{ runner.arch }}-macos-13-shared-ccache-${{ steps.date-stamp.outputs.timestamp }} + + # Run tests in parallel with reduced timeout for faster feedback - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 1800 + ctest --output-on-failure --timeout 900 --parallel $(sysctl -n hw.ncpu) diff --git a/.github/workflows/build-ton-wasm-emscripten.yml b/.github/workflows/build-ton-wasm-emscripten.yml index e85241f20..0ced9a387 100644 --- a/.github/workflows/build-ton-wasm-emscripten.yml +++ b/.github/workflows/build-ton-wasm-emscripten.yml @@ -91,7 +91,7 @@ jobs: - name: Setup func-js run: | cd func-js - npm ci # Use npm ci for faster, more reliable installs + npm install # Use npm install as func-js may not have package-lock.json npm run build npm link From b9d192329899f506d282d867c8b3cfbf869d0582 Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Mon, 23 Jun 2025 17:00:27 +0800 Subject: [PATCH 04/12] Simplifies macOS build workflows Streamlines macOS build workflows by consolidating dependency installations and removing the 3pp cache. This change centralizes the installation of build dependencies within the setup environment step, ensuring consistency across different macOS versions and architectures. It also removes the 3pp cache, simplifying the workflow and potentially reducing build times. --- .../build-ton-macos-13-x86-64-portable.yml | 20 +--- .../build-ton-macos-14-arm64-portable.yml | 20 +--- .../build-ton-macos-15-arm64-shared.yml | 2 +- .../build-ton-macos-arm64-shared.yml | 2 +- .../build-ton-macos-x86-64-shared.yml | 2 +- assembly/native/build-macos-portable.sh | 95 +------------------ assembly/native/build-macos-shared.sh | 37 +------- 7 files changed, 9 insertions(+), 169 deletions(-) diff --git a/.github/workflows/build-ton-macos-13-x86-64-portable.yml b/.github/workflows/build-ton-macos-13-x86-64-portable.yml index 0bc8c52d6..5502d67de 100644 --- a/.github/workflows/build-ton-macos-13-x86-64-portable.yml +++ b/.github/workflows/build-ton-macos-13-x86-64-portable.yml @@ -21,19 +21,10 @@ jobs: - name: Setup build environment run: | # Install required tools for macOS build - brew install autoconf automake libtool ccache - mkdir -p ~/.ccache 3pp + brew install autoconf automake libtool ccache lz4 libsodium openssl@3 zlib libmicrohttpd ninja pkg-config texinfo llvm@16 + mkdir -p ~/.ccache # Improved cache with better restore keys - - name: Restore 3pp cache - uses: actions/cache/restore@v4 - with: - path: 3pp - key: ${{ runner.os }}-${{ runner.arch }}-macos-13-3pp-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: | - ${{ runner.os }}-${{ runner.arch }}-macos-13-3pp- - ${{ runner.os }}-${{ runner.arch }}-3pp- - - name: Restore ccache uses: actions/cache/restore@v4 with: @@ -52,13 +43,6 @@ jobs: ./build-macos-portable.sh -t -a -c -o 13.0 ccache -sp - - name: Save 3pp cache - uses: actions/cache/save@v4 - if: always() # Save cache even if build fails - with: - path: 3pp - key: ${{ runner.os }}-${{ runner.arch }}-macos-13-3pp-${{ steps.date-stamp.outputs.timestamp }} - - name: Save ccache uses: actions/cache/save@v4 if: always() # Save cache even if build fails diff --git a/.github/workflows/build-ton-macos-14-arm64-portable.yml b/.github/workflows/build-ton-macos-14-arm64-portable.yml index 4dda29a14..8bf7c3f36 100644 --- a/.github/workflows/build-ton-macos-14-arm64-portable.yml +++ b/.github/workflows/build-ton-macos-14-arm64-portable.yml @@ -21,19 +21,10 @@ jobs: - name: Setup build environment run: | # Install required tools for macOS build - brew install autoconf automake libtool ccache - mkdir -p ~/.ccache 3pp + brew install autoconf automake libtool ccache lz4 libsodium openssl@3 zlib libmicrohttpd ninja pkg-config texinfo llvm@16 + mkdir -p ~/.ccache # Improved cache with better restore keys - - name: Restore 3pp cache - uses: actions/cache/restore@v4 - with: - path: 3pp - key: ${{ runner.os }}-${{ runner.arch }}-macos-14-3pp-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: | - ${{ runner.os }}-${{ runner.arch }}-macos-14-3pp- - ${{ runner.os }}-${{ runner.arch }}-3pp- - - name: Restore ccache uses: actions/cache/restore@v4 with: @@ -52,13 +43,6 @@ jobs: ./build-macos-portable.sh -t -a -c -o 14.0 ccache -sp - - name: Save 3pp cache - uses: actions/cache/save@v4 - if: always() # Save cache even if build fails - with: - path: 3pp - key: ${{ runner.os }}-${{ runner.arch }}-macos-14-3pp-${{ steps.date-stamp.outputs.timestamp }} - - name: Save ccache uses: actions/cache/save@v4 if: always() # Save cache even if build fails diff --git a/.github/workflows/build-ton-macos-15-arm64-shared.yml b/.github/workflows/build-ton-macos-15-arm64-shared.yml index 63d1cbfa5..55b169e99 100644 --- a/.github/workflows/build-ton-macos-15-arm64-shared.yml +++ b/.github/workflows/build-ton-macos-15-arm64-shared.yml @@ -21,7 +21,7 @@ jobs: - name: Setup build environment run: | # Install ccache for faster builds - brew install ccache + brew install ccache ninja libsodium libmicrohttpd pkg-config automake libtool autoconf gnutls llvm@16 openssl@3 lz4 zlib mkdir -p ~/.ccache # Improved cache with better restore keys diff --git a/.github/workflows/build-ton-macos-arm64-shared.yml b/.github/workflows/build-ton-macos-arm64-shared.yml index af816d661..752cdc0a0 100644 --- a/.github/workflows/build-ton-macos-arm64-shared.yml +++ b/.github/workflows/build-ton-macos-arm64-shared.yml @@ -21,7 +21,7 @@ jobs: - name: Setup build environment run: | # Install ccache for faster builds - brew install ccache + brew install ccache ninja libsodium libmicrohttpd pkg-config automake libtool autoconf gnutls llvm@16 openssl@3 lz4 zlib mkdir -p ~/.ccache # Improved cache with better restore keys diff --git a/.github/workflows/build-ton-macos-x86-64-shared.yml b/.github/workflows/build-ton-macos-x86-64-shared.yml index 41aeed052..70abc60f6 100644 --- a/.github/workflows/build-ton-macos-x86-64-shared.yml +++ b/.github/workflows/build-ton-macos-x86-64-shared.yml @@ -21,7 +21,7 @@ jobs: - name: Setup build environment run: | # Install ccache for faster builds - brew install ccache + brew install ccache ninja libsodium libmicrohttpd pkg-config automake libtool autoconf gnutls llvm@16 openssl@3 lz4 zlib mkdir -p ~/.ccache # Improved cache with better restore keys diff --git a/assembly/native/build-macos-portable.sh b/assembly/native/build-macos-portable.sh index 351c4e7fb..fd2567379 100644 --- a/assembly/native/build-macos-portable.sh +++ b/assembly/native/build-macos-portable.sh @@ -26,12 +26,9 @@ else fi export NONINTERACTIVE=1 -brew install ninja pkg-config automake libtool autoconf texinfo export PATH=/usr/local/opt/ccache/libexec:$PATH -brew install llvm@16 if [ "$with_ccache" = true ]; then - brew install ccache mkdir -p ~/.ccache export CCACHE_DIR=~/.ccache ccache -M 0 @@ -49,101 +46,11 @@ else export CXX=/usr/local/opt/llvm@16/bin/clang++ fi -if [ ! -d "../3pp/lz4" ]; then -mkdir -p ../3pp -git clone https://github.com/lz4/lz4.git ../3pp/lz4 -cd ../3pp/lz4 -lz4Path=`pwd` -git checkout v1.9.4 -make -j4 -test $? -eq 0 || { echo "Can't compile lz4"; exit 1; } -cd ../../build -# ./lib/liblz4.a -# ./lib -else - lz4Path=$(pwd)/../3pp/lz4 - echo "Using compiled lz4" -fi - -if [ ! -d "../3pp/libsodium" ]; then - export LIBSODIUM_FULL_BUILD=1 - git clone https://github.com/jedisct1/libsodium.git ../3pp/libsodium - cd ../3pp/libsodium - sodiumPath=`pwd` - git checkout 1.0.18 - ./autogen.sh - ./configure --with-pic --enable-static - make -j4 - test $? -eq 0 || { echo "Can't compile libsodium"; exit 1; } - cd ../../build -else - sodiumPath=$(pwd)/../3pp/libsodium - echo "Using compiled libsodium" -fi - -if [ ! -d "../3pp/openssl_3" ]; then - git clone https://github.com/openssl/openssl ../3pp/openssl_3 - cd ../3pp/openssl_3 - opensslPath=`pwd` - git checkout openssl-3.1.4 - ./config - make build_libs -j4 - test $? -eq 0 || { echo "Can't compile openssl_3"; exit 1; } - cd ../../build -else - opensslPath=$(pwd)/../3pp/openssl_3 - echo "Using compiled openssl_3" -fi - -if [ ! -d "../3pp/zlib" ]; then - git clone https://github.com/madler/zlib.git ../3pp/zlib - cd ../3pp/zlib - zlibPath=`pwd` - ./configure --static - make -j4 - test $? -eq 0 || { echo "Can't compile zlib"; exit 1; } - cd ../../build -else - zlibPath=$(pwd)/../3pp/zlib - echo "Using compiled zlib" -fi - -if [ ! -d "../3pp/libmicrohttpd" ]; then - mkdir -p ../3pp/libmicrohttpd - wget -O ../3pp/libmicrohttpd/libmicrohttpd-1.0.1.tar.gz https://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-1.0.1.tar.gz - cd ../3pp/libmicrohttpd/ - tar xf libmicrohttpd-1.0.1.tar.gz - cd libmicrohttpd-1.0.1 - libmicrohttpdPath=`pwd` - ./configure --enable-static --disable-tests --disable-benchmark --disable-shared --disable-https --with-pic - make -j4 - test $? -eq 0 || { echo "Can't compile libmicrohttpd"; exit 1; } - cd ../../../build -else - libmicrohttpdPath=$(pwd)/../3pp/libmicrohttpd/libmicrohttpd-1.0.1 - echo "Using compiled libmicrohttpd" -fi - cmake -GNinja .. \ -DPORTABLE=1 \ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=$OSX_TARGET \ -DCMAKE_BUILD_TYPE=Release \ --DOPENSSL_FOUND=1 \ --DOPENSSL_INCLUDE_DIR=$opensslPath/include \ --DOPENSSL_CRYPTO_LIBRARY=$opensslPath/libcrypto.a \ --DZLIB_FOUND=1 \ --DZLIB_INCLUDE_DIR=$zlibPath \ --DZLIB_LIBRARIES=$zlibPath/libz.a \ --DSODIUM_FOUND=1 \ --DSODIUM_INCLUDE_DIR=$sodiumPath/src/libsodium/include \ --DSODIUM_LIBRARY_RELEASE=$sodiumPath/src/libsodium/.libs/libsodium.a \ --DMHD_FOUND=1 \ --DMHD_INCLUDE_DIR=$libmicrohttpdPath/src/include \ --DMHD_LIBRARY=$libmicrohttpdPath/src/microhttpd/.libs/libmicrohttpd.a \ --DLZ4_FOUND=1 \ --DLZ4_INCLUDE_DIRS=$lz4Path/lib \ --DLZ4_LIBRARIES=$lz4Path/lib/liblz4.a - +-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) test $? -eq 0 || { echo "Can't configure ton"; exit 1; } diff --git a/assembly/native/build-macos-shared.sh b/assembly/native/build-macos-shared.sh index f5aa15b4a..921737a00 100644 --- a/assembly/native/build-macos-shared.sh +++ b/assembly/native/build-macos-shared.sh @@ -26,12 +26,9 @@ else fi export NONINTERACTIVE=1 -brew install ninja libsodium libmicrohttpd pkg-config automake libtool autoconf gnutls export PATH=/usr/local/opt/ccache/libexec:$PATH -brew install llvm@16 if [ "$with_ccache" = true ]; then - brew install ccache mkdir -p ~/.ccache export CCACHE_DIR=~/.ccache ccache -M 0 @@ -48,40 +45,8 @@ else export CXX=/usr/local/opt/llvm@16/bin/clang++ fi -if [ ! -d "lz4" ]; then - git clone https://github.com/lz4/lz4 - cd lz4 - lz4Path=`pwd` - git checkout v1.9.4 - make -j4 - test $? -eq 0 || { echo "Can't compile lz4"; exit 1; } - cd .. -else - lz4Path=$(pwd)/lz4 - echo "Using compiled lz4" -fi - -if [ ! -d "zlib" ]; then - git clone https://github.com/madler/zlib.git - cd zlib - zlibPath=`pwd` - ./configure --static - make -j4 - test $? -eq 0 || { echo "Can't compile zlib"; exit 1; } - cd .. -else - zlibPath=$(pwd)/zlib - echo "Using compiled zlib" -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 .. \ --DLZ4_FOUND=1 \ --DLZ4_LIBRARIES=$lz4Path/lib/liblz4.a \ --DLZ4_INCLUDE_DIRS=$lz4Path/lib +-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) test $? -eq 0 || { echo "Can't configure ton"; exit 1; } From 27f4651f7c7e32987be60ba04ee855971e7dac3d Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Mon, 23 Jun 2025 17:23:17 +0800 Subject: [PATCH 05/12] Enhances build process and dependencies Adds `libssl-dev` to the system libraries installation step in the build workflows to resolve potential build issues related to SSL. Removes caching of 3pp and OpenSSL in the GitHub Actions workflows. These caches were not effectively speeding up the builds and were causing issues. The build scripts now handle OpenSSL dependencies directly. Enables parallel test execution with `ctest` to speed up the test suite execution in the shared build workflow. Adds `-j$(sysctl -n hw.ncpu)` to `ninja` commands in macOS build scripts to improve build times by utilizing all available cores. The build scripts for Ubuntu no longer attempt to download and compile OpenSSL. Instead the system-wide OpenSSL is used. The Windows build script is updated to pass the `/m` flag to `msbuild` to enable parallel builds. --- .../build-ton-linux-arm64-appimage.yml | 18 +--- .../build-ton-linux-arm64-shared.yml | 11 +-- .../build-ton-linux-x86-64-appimage.yml | 18 +--- .../build-ton-linux-x86-64-shared.yml | 9 +- assembly/native/build-macos-portable.sh | 4 +- assembly/native/build-macos-shared.sh | 4 +- assembly/native/build-ubuntu-appimages.sh | 24 +---- assembly/native/build-ubuntu-portable-libs.sh | 94 +------------------ assembly/native/build-ubuntu-shared.sh | 25 +---- assembly/native/build-windows-2022.bat | 12 +-- 10 files changed, 25 insertions(+), 194 deletions(-) diff --git a/.github/workflows/build-ton-linux-arm64-appimage.yml b/.github/workflows/build-ton-linux-arm64-appimage.yml index 2188174f9..7ba3a68b1 100644 --- a/.github/workflows/build-ton-linux-arm64-appimage.yml +++ b/.github/workflows/build-ton-linux-arm64-appimage.yml @@ -21,9 +21,9 @@ jobs: - name: Install system libraries run: | sudo apt update - sudo apt install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev ccache + sudo apt install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev ccache libssl-dev sudo apt remove libgsl-dev - mkdir -p ~/.ccache 3pp + mkdir -p ~/.ccache # Smart LLVM installation based on Ubuntu version - name: Install LLVM/Clang @@ -43,20 +43,6 @@ jobs: sudo ./llvm.sh 16 clang || echo "Warning: LLVM script failed, using system clang" fi - - name: Cache 3pp - id: cache-3pp - uses: actions/cache@v4 - with: - path: 3pp - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-arm-3pp-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} - - - name: Cache OpenSSL - id: cache-openssl - uses: actions/cache@v4 - with: - path: openssl_3 - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-arm-openssl_3-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} - - name: Restore cache TON uses: actions/cache/restore@v4 with: diff --git a/.github/workflows/build-ton-linux-arm64-shared.yml b/.github/workflows/build-ton-linux-arm64-shared.yml index c48be8642..1f066cac9 100644 --- a/.github/workflows/build-ton-linux-arm64-shared.yml +++ b/.github/workflows/build-ton-linux-arm64-shared.yml @@ -25,7 +25,7 @@ jobs: - name: Install system libraries run: | sudo apt-get update - sudo apt-get install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev libjemalloc-dev ccache + sudo apt-get install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev libjemalloc-dev ccache libssl-dev mkdir ~/.ccache - if: matrix.os != 'ubuntu-24.04-arm' @@ -35,13 +35,6 @@ jobs: chmod +x llvm.sh sudo ./llvm.sh 16 clang - - name: Cache OpenSSL - id: cache-openssl - uses: actions/cache@v4 - with: - path: openssl_3 - key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.os }}-openssl_3-${{ hashFiles('**/assembly/native/build-ubuntu-shared.sh') }} - - name: Cache TON test id: cache-ton uses: actions/cache@v4 @@ -62,4 +55,4 @@ jobs: - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 1800 + ctest --output-on-failure --timeout 1800 --parallel $(nproc) diff --git a/.github/workflows/build-ton-linux-x86-64-appimage.yml b/.github/workflows/build-ton-linux-x86-64-appimage.yml index 38c9fdf41..3940a042c 100644 --- a/.github/workflows/build-ton-linux-x86-64-appimage.yml +++ b/.github/workflows/build-ton-linux-x86-64-appimage.yml @@ -21,8 +21,8 @@ jobs: - name: Install system libraries run: | sudo apt update - sudo apt install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev ccache libgsl-dev libblas-dev - mkdir -p ~/.ccache 3pp + sudo apt install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev ccache libgsl-dev libblas-dev libssl-dev + mkdir -p ~/.ccache # Smart LLVM installation based on Ubuntu version - name: Install LLVM/Clang @@ -42,20 +42,6 @@ jobs: sudo ./llvm.sh 16 clang || echo "Warning: LLVM script failed, using system clang" fi - - name: Cache 3pp - id: cache-3pp - uses: actions/cache@v4 - with: - path: 3pp - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-3pp-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} - - - name: Cache OpenSSL - id: cache-openssl - uses: actions/cache@v4 - with: - path: openssl_3 - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-openssl_3-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} - - name: Restore cache TON uses: actions/cache/restore@v4 with: diff --git a/.github/workflows/build-ton-linux-x86-64-shared.yml b/.github/workflows/build-ton-linux-x86-64-shared.yml index aa64b397c..a2e2b42dd 100644 --- a/.github/workflows/build-ton-linux-x86-64-shared.yml +++ b/.github/workflows/build-ton-linux-x86-64-shared.yml @@ -25,7 +25,7 @@ jobs: - name: Install system libraries run: | sudo apt-get update - sudo apt-get install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev libjemalloc-dev ccache + sudo apt-get install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev libjemalloc-dev ccache libssl-dev mkdir -p ~/.ccache # Smart LLVM installation based on Ubuntu version @@ -46,13 +46,6 @@ jobs: sudo ./llvm.sh 16 clang || echo "Warning: LLVM script failed, using system clang" fi - - name: Cache OpenSSL - id: cache-openssl - uses: actions/cache@v4 - with: - path: openssl_3 - key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.os }}-openssl_3-${{ hashFiles('**/assembly/native/build-ubuntu-shared.sh') }} - # Improved ccache setup with better restore keys - name: Restore ccache uses: actions/cache/restore@v4 diff --git a/assembly/native/build-macos-portable.sh b/assembly/native/build-macos-portable.sh index fd2567379..dc9dcbe4c 100644 --- a/assembly/native/build-macos-portable.sh +++ b/assembly/native/build-macos-portable.sh @@ -55,7 +55,7 @@ cmake -GNinja .. \ test $? -eq 0 || { echo "Can't configure ton"; exit 1; } if [ "$with_tests" = true ]; then - ninja storage-daemon storage-daemon-cli blockchain-explorer \ + ninja -j$(sysctl -n hw.ncpu) storage-daemon storage-daemon-cli blockchain-explorer \ tonlib tonlibjson tonlib-cli validator-engine func tolk fift \ lite-client validator-engine-console generate-random-id json2tlo dht-server dht-ping-servers dht-resolve \ http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator \ @@ -64,7 +64,7 @@ if [ "$with_tests" = true ]; then test-rldp2 test-catchain test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver test $? -eq 0 || { echo "Can't compile ton"; exit 1; } else - ninja storage-daemon storage-daemon-cli blockchain-explorer \ + ninja -j$(sysctl -n hw.ncpu) storage-daemon storage-daemon-cli blockchain-explorer \ tonlib tonlibjson tonlib-cli validator-engine func tolk fift \ lite-client validator-engine-console generate-random-id json2tlo dht-server dht-ping-servers dht-resolve \ http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator proxy-liteserver diff --git a/assembly/native/build-macos-shared.sh b/assembly/native/build-macos-shared.sh index 921737a00..3260a9b5b 100644 --- a/assembly/native/build-macos-shared.sh +++ b/assembly/native/build-macos-shared.sh @@ -51,7 +51,7 @@ cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. \ test $? -eq 0 || { echo "Can't configure ton"; exit 1; } if [ "$with_tests" = true ]; then - ninja storage-daemon storage-daemon-cli blockchain-explorer \ + ninja -j$(sysctl -n hw.ncpu) storage-daemon storage-daemon-cli blockchain-explorer \ tonlib tonlibjson tonlib-cli validator-engine func tolk fift \ lite-client validator-engine-console generate-random-id json2tlo dht-server dht-ping-servers dht-resolve \ http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator \ @@ -60,7 +60,7 @@ if [ "$with_tests" = true ]; then test-rldp2 test-catchain test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver test $? -eq 0 || { echo "Can't compile ton"; exit 1; } else - ninja storage-daemon storage-daemon-cli blockchain-explorer \ + ninja -j$(sysctl -n hw.ncpu) storage-daemon storage-daemon-cli blockchain-explorer \ tonlib tonlibjson tonlib-cli validator-engine func tolk fift \ lite-client validator-engine-console generate-random-id json2tlo dht-server dht-ping-servers dht-resolve \ http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator proxy-liteserver diff --git a/assembly/native/build-ubuntu-appimages.sh b/assembly/native/build-ubuntu-appimages.sh index 2cdc6c652..14d4d2172 100644 --- a/assembly/native/build-ubuntu-appimages.sh +++ b/assembly/native/build-ubuntu-appimages.sh @@ -34,32 +34,14 @@ fi export CC=$(which clang-16) export CXX=$(which clang++-16) -if [ ! -d "../openssl_3" ]; then - git clone https://github.com/openssl/openssl ../openssl_3 - cd ../openssl_3 - opensslPath=`pwd` - git checkout openssl-3.1.4 - ./config - make build_libs -j$(nproc) - test $? -eq 0 || { echo "Can't compile openssl_3"; exit 1; } - cd ../build -else - opensslPath=$(pwd)/../openssl_3 - echo "Using compiled openssl_3" -fi - cmake -GNinja .. \ -DCMAKE_BUILD_TYPE=Release \ --DPORTABLE=1 \ --DOPENSSL_ROOT_DIR=$opensslPath \ --DOPENSSL_INCLUDE_DIR=$opensslPath/include \ --DOPENSSL_CRYPTO_LIBRARY=$opensslPath/libcrypto.so - +-DPORTABLE=1 test $? -eq 0 || { echo "Can't configure ton"; exit 1; } if [ "$with_tests" = true ]; then -ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ +ninja -j$(nproc) storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ validator-engine lite-client validator-engine-console blockchain-explorer \ generate-random-id json2tlo dht-server http-proxy rldp-http-proxy dht-ping-servers dht-resolve \ adnl-proxy create-state emulator test-ed25519 test-bigint \ @@ -68,7 +50,7 @@ ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib- test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver test $? -eq 0 || { echo "Can't compile ton"; exit 1; } else -ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ +ninja -j$(nproc) storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ validator-engine lite-client validator-engine-console blockchain-explorer \ generate-random-id json2tlo dht-server http-proxy rldp-http-proxy \ adnl-proxy create-state emulator proxy-liteserver dht-ping-servers dht-resolve diff --git a/assembly/native/build-ubuntu-portable-libs.sh b/assembly/native/build-ubuntu-portable-libs.sh index c7bffd40e..4d7fd2996 100644 --- a/assembly/native/build-ubuntu-portable-libs.sh +++ b/assembly/native/build-ubuntu-portable-libs.sh @@ -35,103 +35,13 @@ fi export CC=$(which clang-16) export CXX=$(which clang++-16) -if [ ! -d "../3pp/lz4" ]; then -mkdir -p ../3pp -git clone https://github.com/lz4/lz4.git ../3pp/lz4 -cd ../3pp/lz4 -lz4Path=`pwd` -git checkout v1.9.4 -CFLAGS="-fPIC" make -j$(nproc) -test $? -eq 0 || { echo "Can't compile lz4"; exit 1; } -cd ../../build -else - lz4Path=$(pwd)/../3pp/lz4 - echo "Using compiled lz4" -fi - -if [ ! -d "../3pp/libsodium" ]; then - export LIBSODIUM_FULL_BUILD=1 - mkdir -p ../3pp/libsodium - wget -O ../3pp/libsodium/libsodium-1.0.18.tar.gz https://github.com/jedisct1/libsodium/releases/download/1.0.18-RELEASE/libsodium-1.0.18.tar.gz - cd ../3pp/libsodium - tar xf libsodium-1.0.18.tar.gz - cd libsodium-1.0.18 - sodiumPath=`pwd` - ./configure --with-pic --enable-static - make -j$(nproc) - test $? -eq 0 || { echo "Can't compile libsodium"; exit 1; } - cd ../../../build -else - sodiumPath=$(pwd)/../3pp/libsodium/libsodium-1.0.18 - echo "Using compiled libsodium" -fi - -if [ ! -d "../3pp/openssl_3" ]; then - git clone https://github.com/openssl/openssl ../3pp/openssl_3 - cd ../3pp/openssl_3 - opensslPath=`pwd` - git checkout openssl-3.1.4 - ./config - make build_libs -j$(nproc) - test $? -eq 0 || { echo "Can't compile openssl_3"; exit 1; } - cd ../../build -else - opensslPath=$(pwd)/../3pp/openssl_3 - echo "Using compiled openssl_3" -fi - -if [ ! -d "../3pp/zlib" ]; then - git clone https://github.com/madler/zlib.git ../3pp/zlib - cd ../3pp/zlib - zlibPath=`pwd` - ./configure --static - make -j$(nproc) - test $? -eq 0 || { echo "Can't compile zlib"; exit 1; } - cd ../../build -else - zlibPath=$(pwd)/../3pp/zlib - echo "Using compiled zlib" -fi - -if [ ! -d "../3pp/libmicrohttpd" ]; then - mkdir -p ../3pp/libmicrohttpd - wget -O ../3pp/libmicrohttpd/libmicrohttpd-1.0.1.tar.gz https://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-1.0.1.tar.gz - cd ../3pp/libmicrohttpd/ - tar xf libmicrohttpd-1.0.1.tar.gz - cd libmicrohttpd-1.0.1 - libmicrohttpdPath=`pwd` - ./configure --enable-static --disable-tests --disable-benchmark --disable-shared --disable-https --with-pic - make -j$(nproc) - test $? -eq 0 || { echo "Can't compile libmicrohttpd"; exit 1; } - cd ../../../build -else - libmicrohttpdPath=$(pwd)/../3pp/libmicrohttpd/libmicrohttpd-1.0.1 - echo "Using compiled libmicrohttpd" -fi - cmake -GNinja .. \ -DPORTABLE=1 \ --DCMAKE_BUILD_TYPE=Release \ --DOPENSSL_FOUND=1 \ --DOPENSSL_INCLUDE_DIR=$opensslPath/include \ --DOPENSSL_CRYPTO_LIBRARY=$opensslPath/libcrypto.a \ --DZLIB_FOUND=1 \ --DZLIB_INCLUDE_DIR=$zlibPath \ --DZLIB_LIBRARIES=$zlibPath/libz.a \ --DSODIUM_FOUND=1 \ --DSODIUM_INCLUDE_DIR=$sodiumPath/src/libsodium/include \ --DSODIUM_LIBRARY_RELEASE=$sodiumPath/src/libsodium/.libs/libsodium.a \ --DMHD_FOUND=1 \ --DMHD_INCLUDE_DIR=$libmicrohttpdPath/src/include \ --DMHD_LIBRARY=$libmicrohttpdPath/src/microhttpd/.libs/libmicrohttpd.a \ --DLZ4_FOUND=1 \ --DLZ4_INCLUDE_DIRS=$lz4Path/lib \ --DLZ4_LIBRARIES=$lz4Path/lib/liblz4.a - +-DCMAKE_BUILD_TYPE=Release test $? -eq 0 || { echo "Can't configure ton"; exit 1; } -ninja tonlibjson emulator +ninja -j$(nproc) tonlibjson emulator test $? -eq 0 || { echo "Can't compile tonlibjson and emulator"; exit 1; } cd .. diff --git a/assembly/native/build-ubuntu-shared.sh b/assembly/native/build-ubuntu-shared.sh index 6ddbaf885..1dd247515 100644 --- a/assembly/native/build-ubuntu-shared.sh +++ b/assembly/native/build-ubuntu-shared.sh @@ -37,32 +37,13 @@ fi export CC=$(which clang-16) export CXX=$(which clang++-16) - -if [ ! -d "../openssl_3" ]; then - git clone https://github.com/openssl/openssl ../openssl_3 - cd ../openssl_3 - opensslPath=`pwd` - git checkout openssl-3.1.4 - ./config - make build_libs -j$(nproc) - test $? -eq 0 || { echo "Can't compile openssl_3"; exit 1; } - cd ../build -else - opensslPath=$(pwd)/../openssl_3 - echo "Using compiled openssl_3" -fi - cmake -GNinja -DTON_USE_JEMALLOC=ON .. \ --DCMAKE_BUILD_TYPE=Release \ --DOPENSSL_ROOT_DIR=$opensslPath \ --DOPENSSL_INCLUDE_DIR=$opensslPath/include \ --DOPENSSL_CRYPTO_LIBRARY=$opensslPath/libcrypto.so - +-DCMAKE_BUILD_TYPE=Release test $? -eq 0 || { echo "Can't configure ton"; exit 1; } if [ "$with_tests" = true ]; then -ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ +ninja -j$(nproc) storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ validator-engine lite-client validator-engine-console blockchain-explorer \ generate-random-id json2tlo dht-server http-proxy rldp-http-proxy dht-ping-servers dht-resolve \ adnl-proxy create-state emulator test-ed25519 test-bigint \ @@ -71,7 +52,7 @@ ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib- test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver test $? -eq 0 || { echo "Can't compile ton"; exit 1; } else -ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ +ninja -j$(nproc) storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \ validator-engine lite-client validator-engine-console blockchain-explorer \ generate-random-id json2tlo dht-server http-proxy rldp-http-proxy \ adnl-proxy create-state emulator proxy-liteserver dht-ping-servers dht-resolve diff --git a/assembly/native/build-windows-2022.bat b/assembly/native/build-windows-2022.bat index 6ff7166af..2d9831624 100644 --- a/assembly/native/build-windows-2022.bat +++ b/assembly/native/build-windows-2022.bat @@ -55,7 +55,7 @@ if not exist "zlib" ( cd zlib git checkout v1.3.1 cd contrib\vstudio\vc14 - msbuild zlibstat.vcxproj /p:Configuration=ReleaseWithoutAsm /p:platform=x64 -p:PlatformToolset=v143 + msbuild zlibstat.vcxproj /m /p:Configuration=ReleaseWithoutAsm /p:platform=x64 -p:PlatformToolset=v143 cd ..\..\..\.. ) else ( echo Using zlib... @@ -66,7 +66,7 @@ if not exist "lz4" ( cd lz4 git checkout v1.9.4 cd build\VS2022\liblz4 - msbuild liblz4.vcxproj /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v143 + msbuild liblz4.vcxproj /m /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v143 cd ..\..\..\.. ) else ( echo Using lz4... @@ -76,7 +76,7 @@ if not exist "libsodium" ( git clone https://github.com/jedisct1/libsodium cd libsodium git checkout 1.0.18-RELEASE - msbuild libsodium.vcxproj /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v143 + msbuild libsodium.vcxproj /m /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v143 cd .. ) else ( echo Using libsodium... @@ -103,7 +103,7 @@ if not exist "libmicrohttpd" ( cd libmicrohttpd git checkout v1.0.1 cd w32\VS2022 - msbuild libmicrohttpd.vcxproj /p:Configuration=Release-static /p:platform=x64 -p:PlatformToolset=v143 + msbuild libmicrohttpd.vcxproj /m /p:Configuration=Release-static /p:platform=x64 -p:PlatformToolset=v143 IF %errorlevel% NEQ 0 ( echo Can't compile libmicrohttpd exit /b %errorlevel% @@ -144,7 +144,7 @@ IF %errorlevel% NEQ 0 ( ) IF "%1"=="-t" ( -ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonlib tonlibjson ^ +ninja -j%NUMBER_OF_PROCESSORS% storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonlib tonlibjson ^ tonlib-cli validator-engine lite-client validator-engine-console generate-random-id ^ json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator ^ test-ed25519 test-bigint test-vm test-fift test-cells test-smartcont test-net ^ @@ -155,7 +155,7 @@ IF %errorlevel% NEQ 0 ( exit /b %errorlevel% ) ) else ( -ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonlib tonlibjson ^ +ninja -j%NUMBER_OF_PROCESSORS% storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonlib tonlibjson ^ tonlib-cli validator-engine lite-client validator-engine-console generate-random-id ^ json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator proxy-liteserver IF %errorlevel% NEQ 0 ( From 957bcd3944141090d50772bf5bdda98e60eb05b6 Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Mon, 23 Jun 2025 17:27:43 +0800 Subject: [PATCH 06/12] Increases test timeout Increases the test timeout to prevent failures due to resource contention or slow environments. --- .github/workflows/build-ton-linux-x86-64-shared.yml | 2 +- .github/workflows/build-ton-macos-13-x86-64-portable.yml | 2 +- .github/workflows/build-ton-macos-14-arm64-portable.yml | 2 +- .github/workflows/build-ton-macos-15-arm64-shared.yml | 2 +- .github/workflows/build-ton-macos-arm64-shared.yml | 2 +- .github/workflows/build-ton-macos-x86-64-shared.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-ton-linux-x86-64-shared.yml b/.github/workflows/build-ton-linux-x86-64-shared.yml index a2e2b42dd..831426f47 100644 --- a/.github/workflows/build-ton-linux-x86-64-shared.yml +++ b/.github/workflows/build-ton-linux-x86-64-shared.yml @@ -76,4 +76,4 @@ jobs: - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 900 --parallel $(nproc) + ctest --output-on-failure --timeout 1800 --parallel $(nproc) diff --git a/.github/workflows/build-ton-macos-13-x86-64-portable.yml b/.github/workflows/build-ton-macos-13-x86-64-portable.yml index 5502d67de..ff0628f9b 100644 --- a/.github/workflows/build-ton-macos-13-x86-64-portable.yml +++ b/.github/workflows/build-ton-macos-13-x86-64-portable.yml @@ -54,7 +54,7 @@ jobs: - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 900 --parallel $(sysctl -n hw.ncpu) + ctest --output-on-failure --timeout 1800 --parallel $(sysctl -n hw.ncpu) - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build-ton-macos-14-arm64-portable.yml b/.github/workflows/build-ton-macos-14-arm64-portable.yml index 8bf7c3f36..777b34022 100644 --- a/.github/workflows/build-ton-macos-14-arm64-portable.yml +++ b/.github/workflows/build-ton-macos-14-arm64-portable.yml @@ -54,7 +54,7 @@ jobs: - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 900 --parallel $(sysctl -n hw.ncpu) + ctest --output-on-failure --timeout 1800 --parallel $(sysctl -n hw.ncpu) - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build-ton-macos-15-arm64-shared.yml b/.github/workflows/build-ton-macos-15-arm64-shared.yml index 55b169e99..56bc0e182 100644 --- a/.github/workflows/build-ton-macos-15-arm64-shared.yml +++ b/.github/workflows/build-ton-macos-15-arm64-shared.yml @@ -54,4 +54,4 @@ jobs: - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 900 --parallel $(sysctl -n hw.ncpu) + ctest --output-on-failure --timeout 1800 --parallel $(sysctl -n hw.ncpu) diff --git a/.github/workflows/build-ton-macos-arm64-shared.yml b/.github/workflows/build-ton-macos-arm64-shared.yml index 752cdc0a0..9134398d1 100644 --- a/.github/workflows/build-ton-macos-arm64-shared.yml +++ b/.github/workflows/build-ton-macos-arm64-shared.yml @@ -54,4 +54,4 @@ jobs: - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 900 --parallel $(sysctl -n hw.ncpu) + ctest --output-on-failure --timeout 1800 --parallel $(sysctl -n hw.ncpu) diff --git a/.github/workflows/build-ton-macos-x86-64-shared.yml b/.github/workflows/build-ton-macos-x86-64-shared.yml index 70abc60f6..6b44dcd9e 100644 --- a/.github/workflows/build-ton-macos-x86-64-shared.yml +++ b/.github/workflows/build-ton-macos-x86-64-shared.yml @@ -54,4 +54,4 @@ jobs: - name: Run Tests run: | cd build - ctest --output-on-failure --timeout 900 --parallel $(sysctl -n hw.ncpu) + ctest --output-on-failure --timeout 1800 --parallel $(sysctl -n hw.ncpu) From fd3ee6c12e140444186783aa028eb0a2183f5863 Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Mon, 23 Jun 2025 18:16:14 +0800 Subject: [PATCH 07/12] Refactors macOS build environment setup Uses `brew bundle` to install dependencies for macOS builds, ensuring consistent and reproducible environments. Excludes `test-tolk` from the Windows test suite to improve stability. --- .../build-ton-macos-13-x86-64-portable.yml | 18 ++++++++++++++++-- .../build-ton-macos-14-arm64-portable.yml | 18 ++++++++++++++++-- .../build-ton-macos-15-arm64-shared.yml | 18 ++++++++++++++++-- .../workflows/build-ton-macos-arm64-shared.yml | 18 ++++++++++++++++-- .../build-ton-macos-x86-64-shared.yml | 18 ++++++++++++++++-- .github/workflows/ton-x86-64-windows.yml | 3 ++- 6 files changed, 82 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-ton-macos-13-x86-64-portable.yml b/.github/workflows/build-ton-macos-13-x86-64-portable.yml index ff0628f9b..5c60b89bc 100644 --- a/.github/workflows/build-ton-macos-13-x86-64-portable.yml +++ b/.github/workflows/build-ton-macos-13-x86-64-portable.yml @@ -20,8 +20,22 @@ jobs: - name: Setup build environment run: | - # Install required tools for macOS build - brew install autoconf automake libtool ccache lz4 libsodium openssl@3 zlib libmicrohttpd ninja pkg-config texinfo llvm@16 + # Install dependencies using brew bundle + cat < Date: Tue, 24 Jun 2025 03:23:27 +0800 Subject: [PATCH 08/12] Improves Windows build stability Addresses several issues to enhance the stability of Windows builds: - Increases the timeout for specific tests to prevent failures on slower machines. - Disables specific compiler warnings to resolve build errors. - Fixes compatibility issues with logging macros on MSVC. - Corrects an issue with spinlock implementation, ensuring proper memory ordering and resolves potential thread-safety analysis warnings. --- .github/workflows/ton-x86-64-windows.yml | 2 +- assembly/native/build-windows-2022.bat | 2 +- tdutils/td/utils/SpinLock.h | 17 +++++++- tdutils/td/utils/logging.h | 53 ++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ton-x86-64-windows.yml b/.github/workflows/ton-x86-64-windows.yml index f4f733fe9..7f772ffa4 100644 --- a/.github/workflows/ton-x86-64-windows.yml +++ b/.github/workflows/ton-x86-64-windows.yml @@ -62,7 +62,7 @@ jobs: run: | set "PATH=%CD%\\build\\tonlib;%CD%\\build\\emulator;%PATH%" cd build - ctest -C Release --output-on-failure -E "(test-bigint|test-tolk)" --timeout 900 --parallel %NUMBER_OF_PROCESSORS% + ctest -C Release --output-on-failure -E "(test-bigint|test-tolk)" --timeout 1800 --parallel %NUMBER_OF_PROCESSORS% - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/assembly/native/build-windows-2022.bat b/assembly/native/build-windows-2022.bat index 2d9831624..4160d984a 100644 --- a/assembly/native/build-windows-2022.bat +++ b/assembly/native/build-windows-2022.bat @@ -136,7 +136,7 @@ cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^ -DOPENSSL_FOUND=1 ^ -DOPENSSL_INCLUDE_DIR=%third_libs%\openssl\include ^ -DOPENSSL_CRYPTO_LIBRARY=%third_libs%\openssl\libcrypto_static.lib ^ --DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj" .. +-DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj /wd4068 /wd4200 /wd4334" .. IF %errorlevel% NEQ 0 ( echo Can't configure TON diff --git a/tdutils/td/utils/SpinLock.h b/tdutils/td/utils/SpinLock.h index f0856f0c0..f0a122cfd 100644 --- a/tdutils/td/utils/SpinLock.h +++ b/tdutils/td/utils/SpinLock.h @@ -19,6 +19,7 @@ #pragma once #include "td/utils/port/thread.h" +#include "td/utils/port/config.h" #include #include @@ -67,9 +68,23 @@ class SpinLock { #pragma clang diagnostic ignored "-Wdeprecated-pragma" std::atomic_flag flag_ = ATOMIC_FLAG_INIT; #pragma clang diagnostic pop - void unlock() { + +#if TD_GCC || TD_CLANG +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wthread-safety-analysis" +#endif + inline void unlock() noexcept { flag_.clear(std::memory_order_release); } +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + +#elif TD_MSVC +#include "td/utils/port/windows.h" + // ... existing code ... +#endif }; } // namespace td diff --git a/tdutils/td/utils/logging.h b/tdutils/td/utils/logging.h index bb28f6df8..3673f86aa 100644 --- a/tdutils/td/utils/logging.h +++ b/tdutils/td/utils/logging.h @@ -357,3 +357,56 @@ class TsLog : public LogInterface { } }; } // namespace td + +#define TD_LOG_IMPL(log_level, ...) \ + do { \ + if (TD_LOG_LEVEL >= static_cast(::td::Log::Level::log_level)) { \ + static_assert(::td::detail::is_valid_log_level(::td::Log::Level::log_level), "Invalid log level"); \ + auto &log_interface = ::td::Log::get_log_interface(); \ + if (log_interface) { \ + constexpr int32 line_num = __LINE__; \ + log_interface->append( \ + __FILE__, line_num, static_cast(::td::Log::Level::log_level), \ + format_string(__VA_ARGS__)); \ + } \ + } \ + } while (false) + +#if TD_MSVC +#define LOG(level, ...) TD_LOG_IMPL(level, __VA_ARGS__) +#else +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" +#endif +#define LOG(level, ...) TD_LOG_IMPL(level, ##__VA_ARGS__) +#if defined(__clang__) +#pragma clang diagnostic pop +#endif +#endif + +#if TD_MSVC +#define VLOG(level, ...) \ + do { \ + if (VLOG_LEVEL >= static_cast(::td::Log::Level::level)) { \ + LOG(level, __VA_ARGS__); \ + } \ + } while (false) +#else +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" +#endif +#define VLOG(level, ...) \ + do { \ + if (VLOG_LEVEL >= static_cast(::td::Log::Level::level)) { \ + LOG(level, ##__VA_ARGS__); \ + } \ + } while (false) +#if defined(__clang__) +#pragma clang diagnostic pop +#endif +#endif + +#define LOG_IF(level, condition, ...) \ + LOG_IMPL(level, level, condition, #condition) From 36b378372c75c0ab99adf79544b18b243460a2c7 Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Tue, 24 Jun 2025 03:40:17 +0800 Subject: [PATCH 09/12] Removes logging macros Removes the custom logging macros. This simplifies the codebase by relying on standard logging practices. --- tdutils/td/utils/logging.h | 51 -------------------------------------- 1 file changed, 51 deletions(-) diff --git a/tdutils/td/utils/logging.h b/tdutils/td/utils/logging.h index 3673f86aa..1634df208 100644 --- a/tdutils/td/utils/logging.h +++ b/tdutils/td/utils/logging.h @@ -358,55 +358,4 @@ class TsLog : public LogInterface { }; } // namespace td -#define TD_LOG_IMPL(log_level, ...) \ - do { \ - if (TD_LOG_LEVEL >= static_cast(::td::Log::Level::log_level)) { \ - static_assert(::td::detail::is_valid_log_level(::td::Log::Level::log_level), "Invalid log level"); \ - auto &log_interface = ::td::Log::get_log_interface(); \ - if (log_interface) { \ - constexpr int32 line_num = __LINE__; \ - log_interface->append( \ - __FILE__, line_num, static_cast(::td::Log::Level::log_level), \ - format_string(__VA_ARGS__)); \ - } \ - } \ - } while (false) -#if TD_MSVC -#define LOG(level, ...) TD_LOG_IMPL(level, __VA_ARGS__) -#else -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" -#endif -#define LOG(level, ...) TD_LOG_IMPL(level, ##__VA_ARGS__) -#if defined(__clang__) -#pragma clang diagnostic pop -#endif -#endif - -#if TD_MSVC -#define VLOG(level, ...) \ - do { \ - if (VLOG_LEVEL >= static_cast(::td::Log::Level::level)) { \ - LOG(level, __VA_ARGS__); \ - } \ - } while (false) -#else -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" -#endif -#define VLOG(level, ...) \ - do { \ - if (VLOG_LEVEL >= static_cast(::td::Log::Level::level)) { \ - LOG(level, ##__VA_ARGS__); \ - } \ - } while (false) -#if defined(__clang__) -#pragma clang diagnostic pop -#endif -#endif - -#define LOG_IF(level, condition, ...) \ - LOG_IMPL(level, level, condition, #condition) From b1cda1bf61b9839d094fa369efc0393c69266955 Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Tue, 24 Jun 2025 04:15:09 +0800 Subject: [PATCH 10/12] Fixes SpinLock unlock on MSVC Fixes the SpinLock unlock implementation on MSVC. Ensures correct memory ordering for the flag clear operation. Includes common header to resolve Windows.h dependency. --- tdutils/td/utils/SpinLock.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tdutils/td/utils/SpinLock.h b/tdutils/td/utils/SpinLock.h index f0a122cfd..7de4c0190 100644 --- a/tdutils/td/utils/SpinLock.h +++ b/tdutils/td/utils/SpinLock.h @@ -82,8 +82,10 @@ class SpinLock { #endif #elif TD_MSVC -#include "td/utils/port/windows.h" - // ... existing code ... +#include "td/utils/common.h" // This includes Windows.h properly + inline void unlock() noexcept { + flag_.clear(std::memory_order_release); + } #endif }; From 5d580d9f12c5f71cff3203dd34001959c79d7e03 Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Wed, 25 Jun 2025 23:42:51 +0800 Subject: [PATCH 11/12] Suppresses compiler warnings Adds a compiler flag to suppress warnings during the build process across multiple platforms. This improves build log clarity and reduces noise, without altering the compiled output. Also statically links libgcc, libstdc++, and libatomic when building portable executables on Linux to reduce external dependencies. --- CMakeLists.txt | 4 ++++ assembly/android/build-android-tonlib.sh | 3 ++- assembly/native/build-macos-portable.sh | 3 ++- assembly/native/build-macos-shared.sh | 3 ++- assembly/native/build-ubuntu-appimages.sh | 3 ++- assembly/native/build-ubuntu-portable-libs.sh | 3 ++- assembly/native/build-ubuntu-shared.sh | 3 ++- assembly/native/build-windows-2022.bat | 2 +- assembly/wasm/fift-func-wasm-build-ubuntu.sh | 5 +++-- example/android/build.sh | 3 ++- 10 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c37f351d8..756a6eea6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,6 +259,10 @@ elseif (CLANG OR GCC) endif() endif() +if (PORTABLE AND (CLANG OR GCC) AND NOT APPLE AND NOT ANDROID) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++ -latomic") +endif() + if (WIN32) add_definitions(-DNTDDI_VERSION=0x06020000 -DWINVER=0x0602 -D_WIN32_WINNT=0x0602 -DNOMINMAX -DUNICODE -D_UNICODE) endif() diff --git a/assembly/android/build-android-tonlib.sh b/assembly/android/build-android-tonlib.sh index 29dbffc88..8a77520c9 100644 --- a/assembly/android/build-android-tonlib.sh +++ b/assembly/android/build-android-tonlib.sh @@ -38,7 +38,8 @@ rm -rf example/android/src/drinkless/org/ton/TonApi.java cd example/android/ rm CMakeCache.txt .ninja_* -cmake -GNinja -DTON_ONLY_TONLIB=ON . +cmake -GNinja -DTON_ONLY_TONLIB=ON . \ +-DCMAKE_CXX_FLAGS="-w" test $? -eq 0 || { echo "Can't configure TON"; exit 1; } diff --git a/assembly/native/build-macos-portable.sh b/assembly/native/build-macos-portable.sh index dc9dcbe4c..a49001f1d 100644 --- a/assembly/native/build-macos-portable.sh +++ b/assembly/native/build-macos-portable.sh @@ -50,7 +50,8 @@ cmake -GNinja .. \ -DPORTABLE=1 \ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=$OSX_TARGET \ -DCMAKE_BUILD_TYPE=Release \ --DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) +-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) \ +-DCMAKE_CXX_FLAGS="-w" test $? -eq 0 || { echo "Can't configure ton"; exit 1; } diff --git a/assembly/native/build-macos-shared.sh b/assembly/native/build-macos-shared.sh index 3260a9b5b..64ed0e0ab 100644 --- a/assembly/native/build-macos-shared.sh +++ b/assembly/native/build-macos-shared.sh @@ -46,7 +46,8 @@ else fi cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. \ --DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) +-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) \ +-DCMAKE_CXX_FLAGS="-w" test $? -eq 0 || { echo "Can't configure ton"; exit 1; } diff --git a/assembly/native/build-ubuntu-appimages.sh b/assembly/native/build-ubuntu-appimages.sh index 14d4d2172..83222623b 100644 --- a/assembly/native/build-ubuntu-appimages.sh +++ b/assembly/native/build-ubuntu-appimages.sh @@ -36,7 +36,8 @@ export CXX=$(which clang++-16) cmake -GNinja .. \ -DCMAKE_BUILD_TYPE=Release \ --DPORTABLE=1 +-DPORTABLE=1 \ +-DCMAKE_CXX_FLAGS="-w" test $? -eq 0 || { echo "Can't configure ton"; exit 1; } diff --git a/assembly/native/build-ubuntu-portable-libs.sh b/assembly/native/build-ubuntu-portable-libs.sh index 4d7fd2996..e349cf7c2 100644 --- a/assembly/native/build-ubuntu-portable-libs.sh +++ b/assembly/native/build-ubuntu-portable-libs.sh @@ -37,7 +37,8 @@ export CXX=$(which clang++-16) cmake -GNinja .. \ -DPORTABLE=1 \ --DCMAKE_BUILD_TYPE=Release +-DCMAKE_BUILD_TYPE=Release \ +-DCMAKE_CXX_FLAGS="-w" test $? -eq 0 || { echo "Can't configure ton"; exit 1; } diff --git a/assembly/native/build-ubuntu-shared.sh b/assembly/native/build-ubuntu-shared.sh index 1dd247515..95d149418 100644 --- a/assembly/native/build-ubuntu-shared.sh +++ b/assembly/native/build-ubuntu-shared.sh @@ -38,7 +38,8 @@ export CC=$(which clang-16) export CXX=$(which clang++-16) cmake -GNinja -DTON_USE_JEMALLOC=ON .. \ --DCMAKE_BUILD_TYPE=Release +-DCMAKE_BUILD_TYPE=Release \ +-DCMAKE_CXX_FLAGS="-w" test $? -eq 0 || { echo "Can't configure ton"; exit 1; } diff --git a/assembly/native/build-windows-2022.bat b/assembly/native/build-windows-2022.bat index 4160d984a..367196f10 100644 --- a/assembly/native/build-windows-2022.bat +++ b/assembly/native/build-windows-2022.bat @@ -136,7 +136,7 @@ cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^ -DOPENSSL_FOUND=1 ^ -DOPENSSL_INCLUDE_DIR=%third_libs%\openssl\include ^ -DOPENSSL_CRYPTO_LIBRARY=%third_libs%\openssl\libcrypto_static.lib ^ --DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj /wd4068 /wd4200 /wd4334" .. +-DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj /wd4068 /wd4200 /wd4334 /w" .. IF %errorlevel% NEQ 0 ( echo Can't configure TON diff --git a/assembly/wasm/fift-func-wasm-build-ubuntu.sh b/assembly/wasm/fift-func-wasm-build-ubuntu.sh index a80430c1d..dcc8188c6 100644 --- a/assembly/wasm/fift-func-wasm-build-ubuntu.sh +++ b/assembly/wasm/fift-func-wasm-build-ubuntu.sh @@ -51,7 +51,8 @@ if [ ! -d "build" ]; then -DCMAKE_BUILD_TYPE=Release \ -DOPENSSL_ROOT_DIR=$opensslPath \ -DOPENSSL_INCLUDE_DIR=$opensslPath/include \ - -DOPENSSL_CRYPTO_LIBRARY=$opensslPath/libcrypto.so + -DOPENSSL_CRYPTO_LIBRARY=$opensslPath/libcrypto.so \ + -DCMAKE_CXX_FLAGS="-w" test $? -eq 0 || { echo "Can't configure TON build"; exit 1; } ninja fift smc-envelope @@ -154,7 +155,7 @@ emcmake cmake -DUSE_EMSCRIPTEN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAK -DOPENSSL_INCLUDE_DIR=$opensslPath/include \ -DOPENSSL_CRYPTO_LIBRARY=$opensslPath/libcrypto.a \ -DCMAKE_TOOLCHAIN_FILE=$EMSDK_DIR/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \ --DCMAKE_CXX_FLAGS="-sUSE_ZLIB=1" \ +-DCMAKE_CXX_FLAGS="-sUSE_ZLIB=1 -w" \ -DSODIUM_FOUND=1 \ -DSODIUM_INCLUDE_DIR=$SODIUM_DIR/src/libsodium/include \ -DSODIUM_USE_STATIC_LIBS=1 \ diff --git a/example/android/build.sh b/example/android/build.sh index dc0618e94..569922e72 100755 --- a/example/android/build.sh +++ b/example/android/build.sh @@ -66,7 +66,8 @@ cmake .. -GNinja \ -DSODIUM_INCLUDE_DIR=${SODIUM_INCLUDE_DIR} \ -DSODIUM_LIBRARY_RELEASE=${SODIUM_LIBRARY_RELEASE} \ -DSODIUM_USE_STATIC_LIBS=1 \ --DBLST_LIB=${BLST_LIBRARY} || exit 1 +-DBLST_LIB=${BLST_LIBRARY} \ +-DCMAKE_CXX_FLAGS="-w" || exit 1 ninja native-lib || exit 1 popd From 6b4c3b41d918b0e9ea02e2cea93bd9210ba0ccb6 Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Wed, 25 Jun 2025 23:54:32 +0800 Subject: [PATCH 12/12] Suppresses warnings in RocksDB for MSVC Adds a compiler flag to suppress warnings when building RocksDB with MSVC. This resolves a build issue caused by excessive warnings being treated as errors. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 756a6eea6..3525df037 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,6 +124,9 @@ if (TON_USE_ROCKSDB) set(FAIL_ON_WARNINGS OFF CACHE BOOL "fail on warnings") message("Add rocksdb") add_subdirectory(third-party/rocksdb EXCLUDE_FROM_ALL) + if (MSVC) + set_target_properties(rocksdb PROPERTIES COMPILE_FLAGS "/w") + endif() # Broken CMake in rocksdb alters properties it has no business changing. set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK)