Fix #100
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: cross-platform-build | |
| on: | |
| push: | |
| branches: [ dev ] | |
| pull_request: | |
| branches: [ dev ] | |
| workflow_dispatch: | |
| workflow_call: | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: linux-x86_64 | |
| runner: arc-runner-set | |
| python: "3.12" | |
| py: "312" | |
| - os: linux-x86_64 | |
| runner: arc-runner-set | |
| python: "3.10" | |
| py: "310" | |
| - os: linux-x86_64 | |
| runner: arc-runner-set | |
| python: "3.13" | |
| py: "313" | |
| - os: macos-aarch64 | |
| runner: macos-14 | |
| python: "3.12" | |
| py: "312" | |
| - os: macos-aarch64 | |
| runner: macos-14 | |
| python: "3.10" | |
| py: "310" | |
| - os: macos-aarch64 | |
| runner: macos-14 | |
| python: "3.13" | |
| py: "313" | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: 'recursive' | |
| - name: Install Linux packages | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update -y | |
| sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq \ | |
| build-essential git cmake ninja-build automake libtool texinfo autoconf \ | |
| libc++-dev libc++abi-dev ccache libboost-all-dev pkg-config wget \ | |
| libatomic1 libjemalloc-dev | |
| sudo find / -type f -name "libatomic.so*" -print -delete 2>/dev/null || echo 'ok' | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 18 clang | |
| - name: Install macOS packages | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install ninja pkg-config automake coreutils libtool autoconf \ | |
| texinfo wget ccache boost jemalloc cmake | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Date Stamp | |
| id: date-stamp | |
| run: | | |
| echo "timestamp=$(date -u "+%Y%m%d%H%M_%S")" >> "$GITHUB_OUTPUT" | |
| - name: Restore ccache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.ccache | |
| key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.py }}-static-ccache | |
| - name: Build TON | |
| run: | | |
| git submodule sync --recursive | |
| git submodule update | |
| ./assembly/native/build-universal-static.sh | |
| ccache -sp | |
| - name: Set environment for release | |
| run: | | |
| KERNEL=$(uname -s | tr '[:upper:]' '[:lower:]') | |
| ARCH=$(uname -m) | |
| # Map architecture if needed | |
| if [ "$ARCH" = "x86_64" ]; then | |
| ARCH="x86_64" | |
| elif [ "$ARCH" = "arm64" ]; then | |
| ARCH="aarch64" | |
| fi | |
| echo "TARGET_SYSTEM=${ARCH}-${KERNEL}" >> $GITHUB_ENV | |
| echo "RELEASE_NAME=ton-cpython-${{ matrix.py }}-${ARCH}-${KERNEL}-dev" >> $GITHUB_ENV | |
| - name: Save ccache | |
| if: github.event_name != 'pull_request' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ~/.ccache | |
| key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.py }}-static-ccache | |
| - name: Linked libraries (pre-test) | |
| run: | | |
| set -euxo pipefail | |
| shopt -s nullglob | |
| cd artifacts | |
| files=( python_ton*.so python_ton*.dylib ton_python*.so ton_python*.dylib *.so *.dylib ) | |
| if [ ${#files[@]} -eq 0 ]; then | |
| echo "No shared libraries found in artifacts directory to inspect. Contents:"; | |
| ls -la | |
| exit 0 | |
| fi | |
| echo "Found the following candidate shared libraries:" "${files[@]}" | |
| if [ "${{ runner.os }}" = "macOS" ]; then | |
| for f in "${files[@]}"; do | |
| echo "==== otool -L $f ====" | |
| otool -L "$f" || true | |
| done | |
| else | |
| for f in "${files[@]}"; do | |
| echo "==== ldd $f ====" | |
| ldd "$f" || true | |
| done | |
| fi | |
| - name: Simple binary test | |
| run: cd artifacts; python3 -c 'import python_ton' | |
| - name: Upload artifacts | |
| if: github.event_name != 'pull_request' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.RELEASE_NAME }} | |
| path: artifacts | |
| - name: Create release | |
| if: github.event_name != 'pull_request' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| allowUpdates: true | |
| artifactErrorsFailBuild: true | |
| artifacts: artifacts/* | |
| body: Your binary sir | |
| name: ${{ env.RELEASE_NAME }} | |
| replacesArtifacts: true | |
| tag: ${{ env.RELEASE_NAME }} |