Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
d206e0f
Fix major compilation errors and warnings.
TheBlackPlague Mar 19, 2025
3b39043
Clean up code in Terminal module.
TheBlackPlague Mar 19, 2025
cd23302
Clean up code in Engine module.
TheBlackPlague Mar 19, 2025
c9de8b3
Clean up code in Backend module.
TheBlackPlague Mar 19, 2025
1c4df92
More general cleanup.
TheBlackPlague Mar 19, 2025
b9c4897
Correct compiler requirement since C++23 features are being used.
TheBlackPlague Mar 19, 2025
3d799ec
Project code design changes & include sorting.
TheBlackPlague Mar 22, 2025
7126550
Fix empty char compilation issue.
TheBlackPlague Mar 22, 2025
1bc890b
Configure texting on Linux through remote VM.
TheBlackPlague Mar 22, 2025
a066b1c
Remote changes and code style changes.
TheBlackPlague Mar 23, 2025
24cec3b
Update MantaRay version.
TheBlackPlague Mar 23, 2025
a27f3c8
IDE changes.
TheBlackPlague Mar 23, 2025
10d3261
Certain code & code style changes to improve QOL.
TheBlackPlague Mar 24, 2025
48e4a80
Begin work on Python API Bindings.
TheBlackPlague Mar 24, 2025
8cc8352
Code reformatting.
TheBlackPlague Mar 26, 2025
c7774bc
Use CPM for Thread Pool.
TheBlackPlague Mar 26, 2025
4a4f454
Code style changes.
TheBlackPlague Mar 27, 2025
37644b6
Use BS::thread_pool with priority for PERFT.
TheBlackPlague Mar 27, 2025
67ddf98
Remove misleading concurrency setting method.
TheBlackPlague Mar 27, 2025
dfcaec0
More aggressive parallelization.
TheBlackPlague Mar 28, 2025
48c2904
Remove dependency on BS::thread_pool.
TheBlackPlague Mar 28, 2025
892e47c
Use default block size.
TheBlackPlague Mar 28, 2025
9a4a7d7
Configure thread pool resizing.
TheBlackPlague Mar 28, 2025
5515868
Style constraints matching.
TheBlackPlague Mar 28, 2025
812ce2a
Change ThreadPool::Size -> ThreadPool::Count in Python Bindings.
TheBlackPlague Mar 28, 2025
44a68f4
Add Transposition Table and API Spec support.
TheBlackPlague Mar 28, 2025
892c520
Add string representation for movelist in Python Bindings.
TheBlackPlague Mar 29, 2025
a5e99b3
Code formatting change.
TheBlackPlague Mar 29, 2025
f0068c5
Use custom fork for nanothread to accomodate cross-platform builds.
TheBlackPlague Mar 29, 2025
14db1b9
Begin work on pyproject.toml.
TheBlackPlague Mar 29, 2025
d1a0794
Configure GitHub actions and use more CMAKE options.
TheBlackPlague Mar 29, 2025
19c8255
Fix actions.
TheBlackPlague Mar 29, 2025
6f9d84d
Use v4 of upload-artifact.
TheBlackPlague Mar 29, 2025
ee9720b
Try without libncurses5 on Linux.
TheBlackPlague Mar 29, 2025
d9103ff
Don't build natively on CI either.
TheBlackPlague Mar 29, 2025
2e86732
Try new LLVM path for MacOS.
TheBlackPlague Mar 29, 2025
7ef523a
MacOS clang no longer supports x86-64-v2/v3/v4 as targets.
TheBlackPlague Mar 29, 2025
677b35c
Disable x86-x64 for macOS in general. Fallback to m1/m2 architecture.
TheBlackPlague Mar 29, 2025
ca3d27e
Oops. Wrong architecture name.
TheBlackPlague Mar 29, 2025
1bb944e
Don't specify target anymore for macOS. Defaults to arm64.
TheBlackPlague Mar 29, 2025
42f4e82
Import mutex too (might be necessary for macOS targets).
TheBlackPlague Mar 29, 2025
1e6fd28
Extend base native flags to nanothread.
TheBlackPlague Mar 29, 2025
0d1963d
Try support apple-m3.
TheBlackPlague Mar 29, 2025
e08eda3
Try support apple-m4.
TheBlackPlague Mar 29, 2025
0318f86
Ignore Python Wheel distribution building.
TheBlackPlague Mar 29, 2025
cb42767
Also ignore .venv (for virtual environments).
TheBlackPlague Mar 29, 2025
832651e
Change workflow name to executable for future py_bindings.yml workflow.
TheBlackPlague Mar 29, 2025
99a6e13
Implement a Python Binding Wheel Building workflow.
TheBlackPlague Mar 30, 2025
db425fb
Allow usage of scikit-build-score v0.10.
TheBlackPlague Mar 30, 2025
ca535bc
Use license file instead.
TheBlackPlague Mar 30, 2025
094d775
Use manual building.
TheBlackPlague Mar 30, 2025
2df504c
Enable Position Independent Code for Linux.
TheBlackPlague Mar 30, 2025
7a3af2d
Change name of artifact for wheels.
TheBlackPlague Mar 30, 2025
ad6676f
Fix typo.
TheBlackPlague Mar 30, 2025
3ce053a
Add architecture to wheels building too.
TheBlackPlague Mar 30, 2025
f98552e
Fix CMAKE_CXX_FLAGS not being set properly.
TheBlackPlague Mar 30, 2025
ea81f9d
If none are provided, only then use the environment variables.
TheBlackPlague Mar 30, 2025
3515eb7
Try having better artifact names for python wheels.
TheBlackPlague Mar 30, 2025
8820c80
Oops. Forgot the .whl extension.
TheBlackPlague Mar 30, 2025
fddac21
Correct duty of search handler.
TheBlackPlague Mar 30, 2025
03f6508
Implement the TimeData, TimeControl, and TimeManager classes.
TheBlackPlague Mar 30, 2025
5571a5c
Implement RepetitionHistory and PrincipleVariationTable.
TheBlackPlague Mar 30, 2025
a9b57fe
Implement SearchHandler.
TheBlackPlague Mar 30, 2025
12ea58c
Implement base Search API.
TheBlackPlague Mar 30, 2025
1f150d9
Add documentation for Search & SearchHandler.
TheBlackPlague Mar 30, 2025
dd70eaf
Fix binding API inconsistencies.
TheBlackPlague Mar 30, 2025
c3edadd
Add a wait method to search to allow waiting for completion.
TheBlackPlague Mar 30, 2025
9930012
Unfortunately, waiting for the search to finish causes Python to neve…
TheBlackPlague Mar 30, 2025
2d6cf00
Publish via actions to PyPi.
TheBlackPlague Mar 31, 2025
c0ba0ba
Merge into PyBinding.
TheBlackPlague Mar 31, 2025
4e3d774
Try renaming the wheels before upload as well.
TheBlackPlague Mar 31, 2025
cab25af
Try adding architecture information while staying PEP compliant.
TheBlackPlague Mar 31, 2025
f118a34
Fix versioning script.
TheBlackPlague Mar 31, 2025
cfb0590
Fix some unfortunate syntax errors.
TheBlackPlague Mar 31, 2025
9c9519a
Fix environment variables not being set properly on Windows.
TheBlackPlague Mar 31, 2025
c398e7e
Oops. Forgot to change != -> ==.
TheBlackPlague Mar 31, 2025
6368f93
Change version to use the post flag since the other one breaks for PyPi.
TheBlackPlague Mar 31, 2025
d9ddc4d
Switch to - instead of post.
TheBlackPlague Mar 31, 2025
64d8b69
Use dev version for wheel architecture.
TheBlackPlague Mar 31, 2025
3e85d63
Repair the wheel and get manylinux tag.
TheBlackPlague Mar 31, 2025
9943c27
Also show the wheel for ManyLinux.
TheBlackPlague Mar 31, 2025
5c1fb44
Opt for Gemfury registry instead.
TheBlackPlague Mar 31, 2025
760090c
Use better versioning now that we aren't held back by PyPI.
TheBlackPlague Mar 31, 2025
180c333
Update the Python Package Repository URL.
TheBlackPlague Mar 31, 2025
48842e3
Try adding C++ STL version to the wheel names.
TheBlackPlague Mar 31, 2025
8c7831e
Fix missing string ending.
TheBlackPlague Mar 31, 2025
b32696c
Bash can't tell difference between variable and commands it seems.
TheBlackPlague Mar 31, 2025
6c3378d
Am I really forgetting bash syntax? :O
TheBlackPlague Mar 31, 2025
52db9d9
I'm an idiot.
TheBlackPlague Mar 31, 2025
4d1193c
Fix clang not defining STL headers by default.
TheBlackPlague Mar 31, 2025
e7102ce
Try another approach.
TheBlackPlague Mar 31, 2025
6b1b1c5
Fix escaping.
TheBlackPlague Mar 31, 2025
d8831cd
Simplify logic for CXX version extraction on unix-like systems.
TheBlackPlague Mar 31, 2025
2735971
Fix file parsing.
TheBlackPlague Mar 31, 2025
9271c00
Use getconf on Linux and clang++ version on macos.
TheBlackPlague Mar 31, 2025
c3791b2
Try enabling wheel publishing to test.
TheBlackPlague Mar 31, 2025
89db8aa
Workflow run conditions:
TheBlackPlague Mar 31, 2025
d8ce529
Homebrew being inconsistent with LLVM installs is annoying.
TheBlackPlague Apr 1, 2025
0662a4d
Use LLVM 20 for macOS.
TheBlackPlague Apr 1, 2025
6ad0f26
Homebrew being retarded.
TheBlackPlague Apr 1, 2025
99cef31
My god, stop Homebrew.
TheBlackPlague Apr 1, 2025
b38e677
Try resetting repository state on workers.
TheBlackPlague Apr 1, 2025
a751288
Add a code-review workflow.
TheBlackPlague Apr 1, 2025
e9afc5f
Give it permission to read issues and pull-requests.
TheBlackPlague Apr 1, 2025
bc10ed1
Use workflow dispatch instead.
TheBlackPlague Apr 1, 2025
45dc348
Try to make the workflow at least show up.
TheBlackPlague Apr 1, 2025
83f643d
Allow 0 fetch depth.
TheBlackPlague Apr 1, 2025
489a263
Give write permissions.
TheBlackPlague Apr 1, 2025
03edfd5
Use pull-requests: write.
TheBlackPlague Apr 1, 2025
9843c8b
AI Code Review sucks.
TheBlackPlague Apr 1, 2025
b9cc18e
An API-spec / engine version change should be required for rebuilding.
TheBlackPlague Apr 1, 2025
280a083
Make the API spec more pythonic.
TheBlackPlague Apr 1, 2025
78c5c39
Make constants immutable by using constant holder static readonly pro…
TheBlackPlague Apr 1, 2025
1da638b
It should be "the StockDory Authors".
TheBlackPlague Apr 2, 2025
3f616e8
Rearrange placement of constant variables.
TheBlackPlague Apr 3, 2025
5b9bafd
Simplify castling logic.
TheBlackPlague Apr 6, 2025
dc6d982
The RookCastleSquareStart & RookCastleSquareEnd arrays are only used …
TheBlackPlague Apr 7, 2025
174865b
Fix formatting issue.
TheBlackPlague Apr 7, 2025
05d1720
Remove unused util class.
TheBlackPlague Apr 7, 2025
d64921f
Remove unnecessary include.
TheBlackPlague Apr 7, 2025
2640429
Fix python bindings.
TheBlackPlague Apr 7, 2025
05288e4
Enable compile launch property when not building a Python Module.
TheBlackPlague Apr 7, 2025
19f7e93
Correct order.
TheBlackPlague Apr 7, 2025
77430ee
Fix ordering for other types too.
TheBlackPlague Apr 7, 2025
6ddc48c
Clear the transposition table between searches since we're doing rand…
TheBlackPlague Apr 7, 2025
34f980c
Make bench more accurate by warming up first for 4 iterations.
TheBlackPlague Apr 7, 2025
8d3df12
IDE Files.
TheBlackPlague Apr 7, 2025
cb17c32
No longer use exception as logic flow.
TheBlackPlague Apr 8, 2025
80fe322
Refactor TranspositionTable (Backend -> Engine). This better matches …
TheBlackPlague Apr 8, 2025
3315c44
Fix possible Out-of-Bounds UB.
TheBlackPlague Apr 8, 2025
88763b8
Formatting change.
TheBlackPlague Apr 8, 2025
7db4d8d
Cleanup bench hash function:
TheBlackPlague Apr 9, 2025
5a7fb5a
Update Makefile.
TheBlackPlague Apr 9, 2025
e0d8307
Missed a change.
TheBlackPlague Apr 9, 2025
07b7ed7
This change may potentially be elo-losing.
TheBlackPlague Apr 9, 2025
4254575
Fix TC bug introduced in search stop logic being refactored to not us…
TheBlackPlague Apr 9, 2025
61460ec
Force linker to be LLD.
TheBlackPlague Apr 10, 2025
d89e03f
This change is still somehow elo-losing. More work needs to be done t…
TheBlackPlague Apr 10, 2025
0397818
Nevermind. Linux isn't retarded. This works.
TheBlackPlague Apr 10, 2025
756416a
One more time...
TheBlackPlague Apr 10, 2025
b9fde63
Fuck this, exception as logic is fine!
TheBlackPlague Apr 10, 2025
3ce6015
Try to replace exceptions with std::setjmp and std::longjmp.
TheBlackPlague Apr 10, 2025
16a2ff0
Formatting change.
TheBlackPlague Apr 10, 2025
11d3bed
These do not need to be std calls.
TheBlackPlague Apr 10, 2025
cd8bb58
Update thread pool to RAII standards.
TheBlackPlague Apr 10, 2025
a0e9ba0
Rearrange UCI Output and remove TT Nodes from being logged to UCI Out…
TheBlackPlague Apr 13, 2025
7e7e7e3
"from" is reserved in Python.
TheBlackPlague Apr 15, 2025
e9b3796
Ignore build directory.
TheBlackPlague Apr 15, 2025
f556508
Fix some IDE files.
TheBlackPlague Apr 15, 2025
11a2f7e
New Makefile.
TheBlackPlague Apr 15, 2025
153ca92
Jump into QSearch after necessary stop/draw checks. Mate pruning shou…
TheBlackPlague Apr 16, 2025
58aa992
Maybe PV Table is causing some issues with this.
TheBlackPlague Apr 16, 2025
9b0a52d
Code style changes.
TheBlackPlague Apr 17, 2025
0db88b8
Try another attempt at no exceptions.
TheBlackPlague Apr 17, 2025
61d0c9c
Quite possible TT and History get corrupted without sudden stops.
TheBlackPlague Apr 17, 2025
f8d14e0
Code style changes.
TheBlackPlague Apr 17, 2025
b228bba
Code style changes.
TheBlackPlague Apr 17, 2025
b670f22
Fix possible thread pool leak.
TheBlackPlague Apr 22, 2025
251d436
Slight refactoring of how TT Entries (now called states) are handled.
TheBlackPlague Apr 22, 2025
e5241b9
Use MantaRay v2.
TheBlackPlague Apr 24, 2025
24fd557
Correct argument is OPTIONS.
TheBlackPlague Apr 24, 2025
8ed2fa8
Fix some compile issues.
TheBlackPlague Apr 24, 2025
510b5b3
Network conversion should happen in the trainer.
TheBlackPlague May 4, 2025
64f7576
Avoid default initialization of OrderedMoveList.
TheBlackPlague May 4, 2025
4313dd2
Compiler is better than us for most inlining handling.
TheBlackPlague May 7, 2025
208cf01
Fix illegal leaf PV when PV is overwritten by another branch.
TheBlackPlague May 8, 2025
44e75c3
Rename NoHandle -> DefaultHandler
TheBlackPlague May 8, 2025
b49b4d3
Python Module directories.
TheBlackPlague May 8, 2025
239d152
Fix python binding related issues.
TheBlackPlague May 8, 2025
268e2dd
Upgrade to actions/checkout v4.
TheBlackPlague May 9, 2025
ef9bb49
Slight changes in what gets embedded in binary.
TheBlackPlague May 10, 2025
2010bb9
Should use v4 here too.
TheBlackPlague May 10, 2025
1a8aa85
Prevent use of internal thread pool. Everything should use C++ encaps…
TheBlackPlague May 10, 2025
5c51d58
There is no "this" to capture.
TheBlackPlague May 10, 2025
947faf6
Update CMake Minimum to 3.21.
TheBlackPlague May 10, 2025
d288ba6
Merge remote-tracking branch 'origin/cpp23-clang20' into cpp23-clang20
TheBlackPlague May 10, 2025
9ce1142
Update Makefile for macOS.
TheBlackPlague May 10, 2025
526c56a
Pin to MantaRay Commit for Testing Purposes.
TheBlackPlague May 10, 2025
1eb3694
Try a newer ver. of MantaRay.
TheBlackPlague May 10, 2025
e095c1b
Revert to older version logic as newer caused performance regression.
TheBlackPlague May 11, 2025
d41961c
Try MantaRay with better inlining support.
TheBlackPlague May 11, 2025
5fd71c3
Update MantaRay.
TheBlackPlague May 12, 2025
fb54688
Update MantaRay.
TheBlackPlague May 13, 2025
10672e2
Update README.
TheBlackPlague May 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 45 additions & 25 deletions .github/workflows/cmake.yml → .github/workflows/executable.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: CMake
name: Executable

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
paths-ignore:
- .github/workflows/py_binding.yml
- src/Python/**
- pyproject.toml

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand All @@ -12,7 +18,7 @@ jobs:
build:
strategy:
matrix:
arch: [ x86-64, x86-64-v2, x86-64-v3, x86-64-v4 ]
arch: [ x86-64, x86-64-v2, x86-64-v3, x86-64-v4, apple-m1, apple-m2, apple-m3, apple-m4 ]
os: [ ubuntu-latest , windows-latest, macos-latest ]
include:
- os: windows-latest
Expand All @@ -22,51 +28,65 @@ jobs:
arch: apple-m1
- os: windows-latest
arch: apple-m2
- os: windows-latest
arch: apple-m3
- os: windows-latest
arch: apple-m4
- os: ubuntu-latest
arch: apple-m1
- os: ubuntu-latest
arch: apple-m2
- os: ubuntu-latest
arch: apple-m3
- os: ubuntu-latest
arch: apple-m4
- os: macos-latest
arch: x86-64
- os: macos-latest
arch: x86-64-v2
- os: macos-latest
arch: x86-64-v3
- os: macos-latest
arch: x86-64-v4

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- if: matrix.os == 'ubuntu-latest'
name: Install Linux Dependencies
run: |
sudo apt install libncurses5 ninja-build
sudo apt install ninja-build
sudo apt remove python3-lldb-14
- if: matrix.os == 'windows-latest'
name: Install Windows Dependencies
run: |
choco install ninja
- if: matrix.os == 'macos-latest'
name: Install MacOS Dependencies
run: |
brew install ninja

- if: matrix.os == 'ubuntu-latest'
name: Install Clang 16 (Ubuntu)
name: Install Clang 20 (Ubuntu)
run: |
wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh 16
sudo ./llvm.sh 20
sudo rm -rf llvm.sh
- if: matrix.os == 'windows-latest'
name: Install Clang 16 (Windows)
name: Install Clang 20 (Windows)
run: |
choco install llvm --version 16.0.6 -y
choco install llvm --version 20.1.0 -y
- if: matrix.os == 'macos-latest'
name: Install Clang 16 (MacOS)
name: Install Clang 20 (MacOS)
run: |
brew install llvm@16
brew update-reset
brew update
brew install llvm@20

- if: matrix.os == 'ubuntu-latest'
name: Set CC and CXX for Linux
run: |
echo "CC=clang-16" >> $GITHUB_ENV
echo "CXX=clang++-16" >> $GITHUB_ENV
echo "CC=clang-20" >> $GITHUB_ENV
echo "CXX=clang++-20" >> $GITHUB_ENV
- if: matrix.os == 'windows-latest'
name: Set CC and CXX for Windows
shell: powershell
Expand All @@ -76,17 +96,17 @@ jobs:
- if: matrix.os == 'macos-latest'
name: Set CC and CXX for MacOS
run: |
echo "CC=/usr/local/opt/llvm@16/bin/clang" >> $GITHUB_ENV
echo "CXX=/usr/local/opt/llvm@16/bin/clang++" >> $GITHUB_ENV
echo "PATH=/usr/local/opt/llvm@16/bin:$PATH" >> $GITHUB_ENV
echo "CC=/opt/homebrew/opt/llvm@20/bin/clang" >> $GITHUB_ENV
echo "CXX=/opt/homebrew/opt/llvm@20/bin/clang++" >> $GITHUB_ENV
echo "PATH=/opt/homebrew/opt/llvm@20/bin:$PATH" >> $GITHUB_ENV

- if: matrix.arch == 'apple-m1' || matrix.arch == 'apple-m2'
name: Configure CMake for Apple M1/M2 (ARM64)
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_FLAGS="--target=arm64 -mcpu=${{ matrix.arch }}" -G Ninja
- if: matrix.os == 'macos-latest'
name: Configure CMake for Apple (ARM64)
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCI=ON -DCMAKE_CXX_FLAGS="-mcpu=${{ matrix.arch }}" -G Ninja

- if: matrix.arch != 'apple-m1' && matrix.arch != 'apple-m2'
- if: matrix.os != 'macos-latest'
name: Configure CMake
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_FLAGS="-march=${{ matrix.arch }}" -G Ninja
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCI=ON -DCMAKE_CXX_FLAGS="-march=${{ matrix.arch }}" -G Ninja

- name: Build
run: cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }}
Expand All @@ -109,7 +129,7 @@ jobs:
mv ${{ github.workspace }}/build/StockDory${{ matrix.extension }} ${{ github.workspace }}/StockDory-${{ env.VERSION }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}

- name: Upload Binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: StockDory-${{ env.VERSION }}-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ github.workspace }}/StockDory-${{ env.VERSION }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}
Expand Down
236 changes: 236 additions & 0 deletions .github/workflows/py_binding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
name: PyBinding

on:
push:
branches: [ "master" ]
paths:
- pyproject.toml
- CMakeLists.txt
pull_request:
branches: [ "master" ]
paths:
- pyproject.toml
- CMakeLists.txt

jobs:
build:
strategy:
matrix:
arch: [ x86-64, x86-64-v2, x86-64-v3, x86-64-v4, apple-m1, apple-m2, apple-m3, apple-m4 ]
os: [ ubuntu-latest , windows-latest, macos-latest ]
python: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
exclude:
- os: windows-latest
arch: apple-m1
- os: windows-latest
arch: apple-m2
- os: windows-latest
arch: apple-m3
- os: windows-latest
arch: apple-m4
- os: ubuntu-latest
arch: apple-m1
- os: ubuntu-latest
arch: apple-m2
- os: ubuntu-latest
arch: apple-m3
- os: ubuntu-latest
arch: apple-m4
- os: macos-latest
arch: x86-64
- os: macos-latest
arch: x86-64-v2
- os: macos-latest
arch: x86-64-v3
- os: macos-latest
arch: x86-64-v4

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- if: matrix.os == 'ubuntu-latest'
name: Install Linux Dependencies
run: |
sudo apt install ninja-build
sudo apt remove python3-lldb-14
- if: matrix.os == 'windows-latest'
name: Install Windows Dependencies
run: |
choco install ninja

- if: matrix.os == 'ubuntu-latest'
name: Install Clang 20 (Ubuntu)
run: |
wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh 20
sudo rm -rf llvm.sh
- if: matrix.os == 'windows-latest'
name: Install Clang 20 (Windows)
run: |
choco install llvm --version 20.1.0 -y
- if: matrix.os == 'macos-latest'
name: Install Clang 20 (MacOS)
run: |
brew update-reset
brew update
brew install llvm@20

- if: matrix.os == 'ubuntu-latest'
name: Set CC and CXX for Linux
run: |
echo "CC=clang-20" >> $GITHUB_ENV
echo "CXX=clang++-20" >> $GITHUB_ENV
- if: matrix.os == 'windows-latest'
name: Set CC and CXX for Windows
shell: powershell
run: |
echo "CC=clang" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CXX=clang++" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- if: matrix.os == 'macos-latest'
name: Set CC and CXX for MacOS
run: |
echo "CC=/opt/homebrew/opt/llvm@20/bin/clang" >> $GITHUB_ENV
echo "CXX=/opt/homebrew/opt/llvm@20/bin/clang++" >> $GITHUB_ENV
echo "PATH=/opt/homebrew/opt/llvm@20/bin:$PATH" >> $GITHUB_ENV


- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Python Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install scikit-build-core build twine pybind11 setuptools build tomlkit

- name: CMake Arguments (MacOS)
if: matrix.os == 'macos-latest'
run: |
echo "CMAKE_CXX_FLAGS=-mcpu=${{ matrix.arch }}" >> $GITHUB_ENV

- name: CMake Arguments (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
echo "CMAKE_CXX_FLAGS=-march=${{ matrix.arch }}" >> $GITHUB_ENV

- name: CMake Arguments (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: |
echo "CMAKE_CXX_FLAGS=-march=${{ matrix.arch }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Set architecture environment variable (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "ARCHITECTURE=${{ matrix.arch }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Set architecture environment variable (Linux & MacOS)
if: matrix.os != 'windows-latest'
run: |
echo "ARCHITECTURE=${{ matrix.arch }}" >> $GITHUB_ENV

- name: Extract C++ Standard Library Version (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: |
echo "Detecting STL version using $env:CXX"

$cxx_version = & $env:CXX -dM -E -x c++ NUL 2>$null | Select-String '_MSC_VER' | ForEach-Object {
if ($_ -match '_MSC_VER\s+(\d+)') {
"msvc$($matches[1])"
}
}

echo "CXX_VERSION=$cxx_version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Extract C++ Standard Library Version (Linux & MacOS)
if: matrix.os != 'windows-latest'
shell: bash
run: |
echo "Detecting STL version on ${{ matrix.os }}"

if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
glibc_version=$(getconf GNU_LIBC_VERSION | awk '{print $2}')
STL_VERSION="libstdcxx${glibc_version}"
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
clang_version=$(clang++ --version | grep -i 'clang version' | awk '{print $4}')
STL_VERSION="libcxx${clang_version}"
else
STL_VERSION="unknown"
fi

echo "Detected STL version: $STL_VERSION"
echo "CXX_VERSION=$STL_VERSION" >> $GITHUB_ENV

- name: Define version
shell: python
run: |
import os
import tomlkit

architecture = os.environ.get("ARCHITECTURE", "").replace("-", "_")
cxx_version = os.environ.get("CXX_VERSION", "")

with open("pyproject.toml", "r", encoding="utf-8") as f:
doc = tomlkit.parse(f.read())

doc["project"]["version"] = f"{doc['project']['version']}.arch.{architecture}.{cxx_version}"

with open("pyproject.toml", "w", encoding="utf-8") as f:
f.write(tomlkit.dumps(doc))

print(f"Set project version to {doc['project']['version']}")

- name: Build Wheel
run: |
python -m build

- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: StockDory-python.${{ matrix.python }}-${{ matrix.os }}-${{ matrix.arch }}.whl
path: ./dist/*.whl

publish:
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest

environment:
name: Python Packages Repository
url: https://pypi.fury.io/theblackplague/stockdory

steps:
- name: Download Wheels
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Python Dependencies
run: |
python -m pip install --upgrade twine

- name: Show downloaded Wheels
run: ls -R dist

- name: Publish Wheels (Gemfury)
env:
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
run: |
python -m twine upload \
--repository-url https://pypi.fury.io/theblackplague/ \
-u theblackplague \
-p "${FURY_TOKEN}" \
--non-interactive \
--skip-existing \
dist/*
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,11 @@ fabric.properties
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
.idea/caches/build_file_checksums.ser

# Python Bindings Wheel
dist/
.venv/

# Makefile
Build/
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading