Skip to content

Build and Package Python Project with Python 3.11 #29

Build and Package Python Project with Python 3.11

Build and Package Python Project with Python 3.11 #29

Workflow file for this run

name: Build and Package Python Project with Python 3.11
on:
workflow_dispatch:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
jobs:
build-on-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Check out repository code
with:
submodules: true
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: "3.11"
activate-environment: fpdb311
- name: Install Python development headers
shell: bash -l {0}
run: |
conda install -y python=3.11
sudo apt-get update
sudo apt-get install -y python3-dev
- name: Build poker-eval (Linux)
shell: bash -l {0}
run: |
cd poker-eval
mkdir -p build
cd build
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
make
cd ../..
- name: Build pypoker-eval (Linux)
shell: bash -l {0}
run: |
mkdir -p build
cd build
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ..
cmake --build . --verbose
cd ..
find . -name "*pokereval*.so"
cp build/*pokereval*.so _pokereval_3_11.so || true
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: pokereval-linux
path: _pokereval_3_11.so
build-on-linux-arm:
runs-on: [self-hosted, linux, ARM64]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt-get update
sudo apt-get install -y python3.11 python3.11-dev cmake make
- name: Build poker-eval
run: |
cd poker-eval
mkdir -p build
cd build
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
make
cd ../..
- name: Build pypoker-eval
run: |
mkdir -p build
cd build
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ..
cmake --build . --verbose
cd ..
find . -name '*pokereval*.so' -exec cp {} _pokereval_3_11.so \; || true
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: pokereval-linux-arm
path: _pokereval_3_11.so
build-on-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cmake
- name: Debug - Print Python Info
run: |
Write-Host "Python Executable: $env:PYTHON"
Write-Host "Python Root: $env:PYTHON_ROOT"
Get-ChildItem -Path $env:PYTHON_ROOT -Recurse | Select-Object FullName
- name: Build poker-eval (Windows)
run: |
cd poker-eval
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64
cmake --build . --config Release
cd ../..
- name: Build pypoker-eval (Windows)
run: |
mkdir build
cd build
$pythonRoot = $env:PYTHON_ROOT
$pythonExe = Join-Path $pythonRoot "python.exe"
$pythonLib = Join-Path $pythonRoot "libs\python311.lib"
$pythonInclude = Join-Path $pythonRoot "include"
cmake .. -G "Visual Studio 17 2022" -A x64 -DPYTHON_EXECUTABLE="$pythonExe" -DPYTHON_LIBRARY="$pythonLib" -DPYTHON_INCLUDE_DIR="$pythonInclude"
cmake --build . --config Release --verbose
cd ..
Get-ChildItem -Recurse -Filter "*pokereval*.pyd" | Copy-Item -Destination _pokereval_3_11.pyd -Force
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: pokereval-windows
path: _pokereval_3_11.pyd
build-on-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cmake
- name: Build poker-eval (macOS)
run: |
cd poker-eval
mkdir build
cd build
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
make
cd ../..
- name: Build pypoker-eval (macOS)
run: |
mkdir build
cd build
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ..
cmake --build . --verbose
cd ..
find . -name "*pokereval*.so" -exec cp {} _pokereval_3_11.so \; || true
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: pokereval-macos
path: _pokereval_3_11.so
build-on-macos-arm:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cmake
- name: Build poker-eval (macOS ARM)
run: |
cd poker-eval
mkdir build
cd build
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_OSX_ARCHITECTURES=arm64
make
cd ../..
- name: Build pypoker-eval (macOS ARM)
run: |
mkdir build
cd build
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_OSX_ARCHITECTURES=arm64 ..
cmake --build . --verbose
cd ..
find . -name "*pokereval*.so" -exec cp {} _pokereval_3_11.so \; || true
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: pokereval-macos-arm
path: _pokereval_3_11.so