Skip to content

Up to date with testnet #186

Up to date with testnet

Up to date with testnet #186

name: Windows Server 2019 x64 Compile
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
python: [ 39, 310, 311 ]
runs-on: windows-2019
env:
RELEASE_NAME: ton-cpython-${{ matrix.python }}-x86_64-windows
steps:
- name: Get Current OS version
run: Get-ComputerInfo | Select-Object WindowsProductName, WindowsVersion
- name: Check out current repository
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Check out zlib repository
uses: actions/checkout@v3
with:
repository: desktop-app/zlib
path: zlib
- name: Setup msbuild.exe
uses: microsoft/[email protected]
- name: Install Pkg-config Lite
run: choco install pkgconfiglite
- name: Compile zlib Win64
run: |
cd zlib\contrib\vstudio\vc14
msbuild zlibstat.vcxproj /p:Configuration=ReleaseWithoutAsm /p:platform=x64 -p:PlatformToolset=v142
- name: Compile secp256k1 Win64
run: |
git clone https://github.com/libbitcoin/secp256k1.git
cd secp256k1\builds\msvc\vs2017
msbuild /p:Configuration=StaticRelease -p:PlatformToolset=v142 -p:Platform=x64
- name: Install pre-compiled libsodium Win64
run: |
curl -Lo libsodium-1.0.18-stable-msvc.zip https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-msvc.zip
unzip libsodium-1.0.18-stable-msvc.zip
- name: Install pre-compiled OpenSSL Win64
run: |
curl -Lo openssl-1.1.1j.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/openssl-1.1.1j.zip
unzip openssl-1.1.1j.zip
- name: Install pre-compiled libmicrohttpd Win64
run: |
curl -Lo libmicrohttpd-0.9.77-w32-bin.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/libmicrohttpd-0.9.77-w32-bin.zip
unzip libmicrohttpd-0.9.77-w32-bin.zip
- name: Install pre-compiled Readline Win64
run: |
curl -Lo readline-5.0-1-lib.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/readline-5.0-1-lib.zip
unzip readline-5.0-1-lib.zip
- run: |
echo "pythonver=$(${{ matrix.python }} -replace '(\d)(\d+)$', '$1.$2')" >> $env:GITHUB_ENV
- uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonver }}
- name: Compile
run: |
Set-PSDebug -Trace 2 -Strict
$root = Get-Location
$env:SODIUM_DIR = Join-Path $root "libsodium"
$cmakeArgs = @(
"-DTON_USE_PYTHON=1",
"-DTON_USE_ABSEIL=0",
"-DSODIUM_USE_STATIC_LIBS=1",
"-DSECP256K1_INCLUDE_DIR=$root\secp256k1\include",
"-DSECP256K1_LIBRARY=$root\secp256k1\bin\x64\Release\v142\static\secp256k1.lib",
"-DREADLINE_INCLUDE_DIR=$root\readline-5.0-1-lib\include\readline",
"-DREADLINE_LIBRARY=$root\readline-5.0-1-lib\lib\readline.lib",
"-DPORTABLE=1",
"-DZLIB_FOUND=1",
"-DMHD_FOUND=1",
"-DMHD_LIBRARY=$root\libmicrohttpd-0.9.77-w32-bin\x86_64\VS2019\Release-static\libmicrohttpd.lib",
"-DMHD_INCLUDE_DIR=$root\libmicrohttpd-0.9.77-w32-bin\x86_64\VS2019\Release-static",
"-DZLIB_INCLUDE_DIR=$root\zlib",
"-DZLIB_LIBRARY=$root\zlib\contrib\vstudio\vc14\x64\ZlibStatReleaseWithoutAsm\zlibstat.lib",
"-DOPENSSL_FOUND=1",
"-DOPENSSL_INCLUDE_DIR=$root/openssl-1.1.1j/include",
"-DOPENSSL_ROOT_DIR=$root/openssl-1.1.1j/",
"-DOPENSSL_CRYPTO_LIBRARY=$root/openssl-1.1.1j/lib/libcrypto_static.lib",
"-DCMAKE_CXX_FLAGS=`"/DTD_WINDOWS=1 /EHsc /bigobj /W0`""
)
cmake -S . -B build $cmakeArgs
cmake --build build --config Release -j $env:NUMBER_OF_PROCESSORS --target python_ton
- name: Find & copy binaries
run: |
mkdir artifacts
xcopy /i "build\tvm-python\Release\*.pyd" "artifacts\"
- name: Simple binary test
run: |
cd artifacts
python -c 'import python_ton'
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: ${{ env.RELEASE_NAME }}
path: artifacts
- name: Upload artifacts
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} ||
${{ github.event_name == 'workflow_dispatch' }}
run: |
try {
gh release delete -y ${{ env.RELEASE_NAME }}
} catch {}
gh release create ${{ env.RELEASE_NAME }} --notes " " (Get-ChildItem -Path artifacts).FullName
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}