kopia lustrzana https://github.com/cirospaciari/socketify.py
new workflow, new setup.py
rodzic
a38a180af6
commit
bf5325d0f2
|
@ -2,13 +2,44 @@ name: Build
|
|||
|
||||
on: workflow_dispatch
|
||||
jobs:
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
name: Build on windows-amd64
|
||||
steps:
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
- uses: ilammy/setup-nasm@v1.2.1
|
||||
- name: Update binaries
|
||||
run: |
|
||||
$ErrorActionPreference = 'SilentlyContinue'
|
||||
$Env:CC='clang'
|
||||
$Env:CXX='clang++'
|
||||
|
||||
git clone --recursive https://github.com/cirospaciari/socketify.py.git
|
||||
cd socketify.py\src\socketify\native
|
||||
vcpkg install libuv:x64-windows-static-md
|
||||
vcpkg integrate install
|
||||
|
||||
cd ..\uWebSockets\uSockets\boringssl
|
||||
mkdir amd64
|
||||
cd amd64
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -GNinja .. && ninja crypto ssl
|
||||
|
||||
cd ..\..\..\..\
|
||||
cl /MD /W3 /D /EHsc /O3 /DLL /D_WINDLL /LD /D "WIN32_LEAN_AND_MEAN" /D "UWS_NO_ZLIB" /D "UWS_WITH_PROXY" /D "LIBUS_USE_LIBUV" /I native/src/ /I uWebSockets/src /I uWebSockets/capi /I uWebSockets/uSockets/boringssl/include /D "LIBUS_USE_OPENSSL" /std:c++20 /I C:\vcpkg\packages\libuv_x64-windows-static-md\include /I uWebSockets/uSockets/src /Felibsocketify_windows_amd64.dll ./native/src/libsocketify.cpp uWebSockets/uSockets/src/*.c uWebSockets/uSockets/src/crypto/*.cpp uWebSockets/uSockets/src/eventing/*.c uWebSockets/uSockets/src/crypto/*.c advapi32.lib uWebSockets/uSockets/boringssl/amd64/ssl/ssl.lib uWebSockets/uSockets/boringssl/amd64/crypto/crypto.lib C:\vcpkg\installed\x64-windows-static-md\lib\uv_a.lib iphlpapi.lib userenv.lib psapi.lib user32.lib
|
||||
|
||||
git add libsocketify_windows_amd64.dll
|
||||
git config --global user.email "ciro.spaciari@gmail.com"
|
||||
git config --global user.name "Ciro Spaciari"
|
||||
git commit -a -m "[GitHub Actions] Updated windows-amd64 binaries"
|
||||
git push "https://cirospaciari:${{ secrets.BUILDTOKEN }}@github.com/cirospaciari/socketify.py.git"
|
||||
|
||||
build-macos:
|
||||
runs-on: macos-11.0
|
||||
name: Build on darwin-amd64
|
||||
name: Build on darwin-amd64 + darwin-arm64
|
||||
steps:
|
||||
- name: Update binaries
|
||||
run: |
|
||||
git clone -b workflows-test --recursive https://github.com/cirospaciari/socketify.py.git
|
||||
git clone --recursive https://github.com/cirospaciari/socketify.py.git
|
||||
cd socketify.py/src/socketify/native
|
||||
make macos
|
||||
cd ../
|
||||
|
@ -16,8 +47,8 @@ jobs:
|
|||
git add libsocketify_darwin_arm64.so
|
||||
git config --global user.email "ciro.spaciari@gmail.com"
|
||||
git config --global user.name "Ciro Spaciari"
|
||||
git commit -a -m "[GitHub Actions] Updated darwin-amd64 binaries" || true
|
||||
git push "https://cirospaciari:${{ secrets.BUILDTOKEN }}@github.com/cirospaciari/socketify.py.git" workflows-test
|
||||
git commit -a -m "[GitHub Actions] Updated darwin-amd64 + darwin-arm64 binaries" || true
|
||||
git push "https://cirospaciari:${{ secrets.BUILDTOKEN }}@github.com/cirospaciari/socketify.py.git"
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build on linux-amd64
|
||||
|
@ -27,7 +58,7 @@ jobs:
|
|||
sudo apt update || true
|
||||
sudo apt install -y libuv1-dev
|
||||
sudo apt install -y g++-aarch64-linux-gnu || true
|
||||
git clone -b workflows-test --recursive https://github.com/cirospaciari/socketify.py.git
|
||||
git clone --recursive https://github.com/cirospaciari/socketify.py.git
|
||||
cd socketify.py/src/socketify/native
|
||||
make linux
|
||||
cd ../
|
||||
|
@ -35,4 +66,4 @@ jobs:
|
|||
git config --global user.email "ciro.spaciari@gmail.com"
|
||||
git config --global user.name "Ciro Spaciari"
|
||||
git commit -a -m "[GitHub Actions] Updated linux-amd64 binaries" || true
|
||||
git push "https://cirospaciari:${{ secrets.BUILDTOKEN }}@github.com/cirospaciari/socketify.py.git" workflows-test
|
||||
git push "https://cirospaciari:${{ secrets.BUILDTOKEN }}@github.com/cirospaciari/socketify.py.git"
|
64
setup.py
64
setup.py
|
@ -4,53 +4,53 @@ vi = sys.version_info
|
|||
if vi < (3, 7):
|
||||
raise RuntimeError('socketify requires Python 3.7 or greater')
|
||||
|
||||
if sys.platform in ('win32', 'cygwin', 'cli'):
|
||||
raise RuntimeError('socketify does not support Windows at the moment')
|
||||
# if sys.platform in ('win32', 'cygwin', 'cli'):
|
||||
# raise RuntimeError('socketify does not support Windows at the moment')
|
||||
|
||||
import setuptools
|
||||
from setuptools.command.sdist import sdist
|
||||
from setuptools.command.build_ext import build_ext
|
||||
# from setuptools.command.sdist import sdist
|
||||
# from setuptools.command.build_ext import build_ext
|
||||
|
||||
import pathlib
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
# import pathlib
|
||||
# import os
|
||||
# import shutil
|
||||
# import subprocess
|
||||
|
||||
_ROOT = pathlib.Path(__file__).parent
|
||||
# _ROOT = pathlib.Path(__file__).parent
|
||||
|
||||
UWS_DIR = str(_ROOT / "src" / "socketify" /"uWebSockets")
|
||||
UWS_BUILD_DIR = str(_ROOT / "build" /"uWebSockets")
|
||||
# UWS_DIR = str(_ROOT / "src" / "socketify" /"uWebSockets")
|
||||
# UWS_BUILD_DIR = str(_ROOT / "build" /"uWebSockets")
|
||||
|
||||
NATIVE_CAPI_DIR = str(_ROOT / "build" / "native")
|
||||
NATIVE_LIB_PATH = str(_ROOT / "build" / "libsocketify.so")
|
||||
NATIVE_DIR = str(_ROOT / "src" / "socketify" /"native")
|
||||
NATIVE_BUILD_DIR = str(_ROOT / "build" /"native")
|
||||
NATIVE_LIB_OUTPUT = str(_ROOT / "src" / "socketify" / "libsocketify.so")
|
||||
# NATIVE_CAPI_DIR = str(_ROOT / "build" / "native")
|
||||
# NATIVE_LIB_PATH = str(_ROOT / "build" / "libsocketify.so")
|
||||
# NATIVE_DIR = str(_ROOT / "src" / "socketify" /"native")
|
||||
# NATIVE_BUILD_DIR = str(_ROOT / "build" /"native")
|
||||
# NATIVE_LIB_OUTPUT = str(_ROOT / "src" / "socketify" / "libsocketify.so")
|
||||
|
||||
|
||||
|
||||
|
||||
class Prepare(sdist):
|
||||
def run(self):
|
||||
super().run()
|
||||
# class Prepare(sdist):
|
||||
# def run(self):
|
||||
# super().run()
|
||||
|
||||
|
||||
class Makefile(build_ext):
|
||||
def run(self):
|
||||
env = os.environ.copy()
|
||||
# class Makefile(build_ext):
|
||||
# def run(self):
|
||||
# env = os.environ.copy()
|
||||
|
||||
if os.path.exists(UWS_BUILD_DIR):
|
||||
shutil.rmtree(UWS_BUILD_DIR)
|
||||
shutil.copytree(UWS_DIR, UWS_BUILD_DIR)
|
||||
# if os.path.exists(UWS_BUILD_DIR):
|
||||
# shutil.rmtree(UWS_BUILD_DIR)
|
||||
# shutil.copytree(UWS_DIR, UWS_BUILD_DIR)
|
||||
|
||||
if os.path.exists(NATIVE_CAPI_DIR):
|
||||
shutil.rmtree(NATIVE_CAPI_DIR)
|
||||
shutil.copytree(NATIVE_DIR, NATIVE_CAPI_DIR)
|
||||
# if os.path.exists(NATIVE_CAPI_DIR):
|
||||
# shutil.rmtree(NATIVE_CAPI_DIR)
|
||||
# shutil.copytree(NATIVE_DIR, NATIVE_CAPI_DIR)
|
||||
|
||||
subprocess.run(["make", "shared"], cwd=NATIVE_CAPI_DIR, env=env, check=True)
|
||||
shutil.move(NATIVE_LIB_PATH, NATIVE_LIB_OUTPUT)
|
||||
# subprocess.run(["make", "shared"], cwd=NATIVE_CAPI_DIR, env=env, check=True)
|
||||
# shutil.move(NATIVE_LIB_PATH, NATIVE_LIB_OUTPUT)
|
||||
|
||||
super().run()
|
||||
# super().run()
|
||||
|
||||
|
||||
with open("README.md", "r", encoding="utf-8") as fh:
|
||||
|
@ -81,7 +81,7 @@ setuptools.setup(
|
|||
python_requires=">=3.7",
|
||||
install_requires=["cffi>=1.0.0", "setuptools>=60.0.0"],
|
||||
has_ext_modules=lambda: True,
|
||||
cmdclass={'sdist': Prepare}, #cmdclass={'sdist': Prepare, 'build_ext': Makefile},
|
||||
cmdclass={}, #cmdclass={'sdist': Prepare, 'build_ext': Makefile},
|
||||
|
||||
include_package_data=True
|
||||
)
|
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Ładowanie…
Reference in New Issue