Add GitHub Action workflow to build pydevd_attach_to_process binaries.

This commit is contained in:
Pavel Minaev 2023-08-21 12:47:19 -07:00 committed by Pavel Minaev
parent 39ad5f47c5
commit 6e08ce2050
5 changed files with 96 additions and 13 deletions

76
.github/workflows/attach_to_process.yml vendored Normal file
View file

@ -0,0 +1,76 @@
# Used to build binaries under src/debugpy/_vendored/pydevd/pydevd_attach_to_process
name: attach_to_process
on:
workflow_dispatch:
push:
env:
PYDEVD_ATTACH_TO_PROCESS: src/debugpy/_vendored/pydevd/pydevd_attach_to_process
jobs:
windows-binaries:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Clean up old binaries
run: rm ${{ env.PYDEVD_ATTACH_TO_PROCESS }}\* -include *.exe,*.dll,*.pdb
- name: Compile binaries
shell: cmd
working-directory: ${{ env.PYDEVD_ATTACH_TO_PROCESS }}\windows
run: compile_windows.bat
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: pydevd_attach_to_process-windows
path: |
${{ env.PYDEVD_ATTACH_TO_PROCESS }}\*.exe
${{ env.PYDEVD_ATTACH_TO_PROCESS }}\*.dll
${{ env.PYDEVD_ATTACH_TO_PROCESS }}\*.pdb
mac-binaries:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Clean up old binaries
run: rm ${{ env.PYDEVD_ATTACH_TO_PROCESS }}/*.so
- name: Compile binaries
run: bash ${{ env.PYDEVD_ATTACH_TO_PROCESS }}/linux_and_mac/compile_mac.sh
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: pydevd_attach_to_process-macos
path: ${{ env.PYDEVD_ATTACH_TO_PROCESS }}/*.dylib
linux-binaries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Clean up old binaries
run: rm ${{ env.PYDEVD_ATTACH_TO_PROCESS }}/*.so
- name: Compile 32-bit binaries
uses: docker://quay.io/pypa/manylinux2014_i686
with:
args: bash ${{ env.PYDEVD_ATTACH_TO_PROCESS }}/linux_and_mac/compile_linux.sh
- name: Compile 64-bit binaries
uses: docker://quay.io/pypa/manylinux2014_x86_64
with:
args: bash ${{ env.PYDEVD_ATTACH_TO_PROCESS }}/linux_and_mac/compile_linux.sh
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: pydevd_attach_to_process-linux
path: ${{ env.PYDEVD_ATTACH_TO_PROCESS }}/*.so

View file

@ -19,6 +19,9 @@
"src/debugpy/_vendored",
"src/debugpy/_vendored/pydevd"
],
"editor.defaultFormatter": "ms-python.black-formatter"
"editor.defaultFormatter": "ms-python.black-formatter",
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
}

View file

@ -1,9 +1,11 @@
g++ -m64 -shared -o attach_linux_amd64.so -fPIC -nostartfiles attach.cpp
mv attach_linux_amd64.so ../attach_linux_amd64.so
echo Compiled amd64
set -e
echo Note: may need "sudo apt-get install libx32gcc-4.8-dev" and "sudo apt-get install libc6-dev-i386" and "sudo apt-get install g++-multilib" to compile 32 bits
ARCH="$(uname -m)"
case $ARCH in
i*86) SUFFIX=x86;;
x86_64*) SUFFIX=amd64;;
*) echo >&2 "unsupported: $ARCH"; exit 1;;
esac
g++ -m32 -shared -o attach_linux_x86.so -fPIC -nostartfiles attach.cpp
mv attach_linux_x86.so ../attach_linux_x86.so
echo Compiled x86
SRC="$(dirname "$0")/.."
g++ -std=c++11 -shared -fPIC -nostartfiles $SRC/linux_and_mac/attach.cpp -o $SRC/attach_linux_$SUFFIX.so

View file

@ -1,5 +1,4 @@
g++ -fPIC -D_REENTRANT -std=c++11 -arch x86_64 -c -o attach_x86_64.o attach.cpp
g++ -dynamiclib -nostartfiles -arch x86_64 -o attach_x86_64.dylib attach_x86_64.o -lc
rm attach_x86_64.o
mv attach_x86_64.dylib ../attach_x86_64.dylib
set -e
SRC="$(dirname "$0")/.."
g++ -fPIC -D_REENTRANT -std=c++11 -arch x86_64 -c $SRC/linux_and_mac/attach.cpp -o $SRC/attach_x86_64.o
g++ -dynamiclib -nostartfiles -arch x86_64 -lc $SRC/attach_x86_64.o -o $SRC/attach_x86_64.dylib

View file

@ -1,3 +1,6 @@
setlocal
@cd /d %~dp0
@set VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
@echo Using vswhere at %VSWHERE%
@for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set VSDIR=%%i