forked from ChazDazzle/pypoker-eval
-
Notifications
You must be signed in to change notification settings - Fork 0
207 lines (183 loc) · 5.76 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Build and Package Python Project with Python 3.11
on:
workflow_dispatch:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
jobs:
build-linux-arm:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker image
run: |
docker buildx create --use
docker buildx build --platform linux/arm64 -t my-arm-build .
- name: Run Docker container
run: |
docker run --rm my-arm-build /bin/sh -c "
mkdir build &&
cd build &&
cmake .. &&
cmake --build . &&
ctest --output-on-failure"
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3.11 python3.11-dev cmake make
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Build project
run: |
set -e
# Initialize submodules
git submodule update --init --recursive
# Build poker-eval
cd poker-eval
mkdir -p build
cd build
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
make
cd ../..
# Build pypoker-eval
mkdir -p build
cd build
cmake -DPython3_EXECUTABLE=$(which python3.11) \
-DPython3_INCLUDE_DIR=$(python3.11 -c "from sysconfig import get_paths as gp; print(gp()['include'])") \
-DPython3_LIBRARY=$(python3.11 -c "from sysconfig import get_config_var as gcv; print(gcv('LIBDIR') + '/libpython3.11.so')") \
..
make
cd ..
# Copy and rename the output
cp ./build/pypokereval.so ./_pokereval_3_11.so
build-windows:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install dependencies
run: |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
git submodule update --init --recursive
- name: Build project
shell: pwsh
run: |
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
# Initialize submodules
git submodule update --init --recursive
# Build poker-eval in Debug mode
cd ./poker-eval
if (!(Test-Path -Path "build")) {
New-Item -ItemType Directory -Force -Path "build"
}
cd build
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Debug
cmake --build . --config Debug
cd ../..
# Build pypoker-eval in Debug mode
if (!(Test-Path -Path "build")) {
New-Item -ItemType Directory -Force -Path "build"
}
cd build
$pythonExe = "${{ env.pythonLocation }}\python.exe"
$pythonInclude = "${{ env.pythonLocation }}\include"
$pythonLib = "${{ env.pythonLocation }}\libs\python311.lib"
cmake .. -G "Visual Studio 17 2022" -A x64 -DPython3_EXECUTABLE=$pythonExe -DPython3_INCLUDE_DIR=$pythonInclude -DPython3_LIBRARY=$pythonLib -DCMAKE_BUILD_TYPE=Debug
cmake --build . --config Debug
cd ..
# Copy and rename the output
Copy-Item "./build/Debug/pypokereval.pyd" "./_pokereval_3_11.pyd" -Force
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