Skip to content

Commit

Permalink
Dev stage for documentation actions (#85)
Browse files Browse the repository at this point in the history
* Update CMakeLists.txt

add conftest to cmake list

* Add github action for staging test doc build

* Update documentation_test.yml

Set for pull requests

* Update documentation_test.yml

* Update documentation_test.yml

* Update documentation_test.yml

* Update documentation_test.yml

* Remove deployments from staging, add pytest

* Update documentation_test.yml

* install locally instead of pypi

* remove doxygen requirement for sphinx

* fix yaml format

* fix python format

* change python version

* try action with 3.8

* use older visual studio

* Update documentation_test.yml

* add python check

* Update documentation_test.yml

* split sphinx and doxygen tests

* Update documentation_test.yml

* Update CMakeLists.txt

* Update cmakelists to 3.10

* Update documentation_test.yml

* Update documentation_test.yml

* Update documentation_test.yml

* add dll error exception

* try in-place pip install

* Update documentation_test.yml

* Update documentation_test.yml

* Update documentation_test.yml

* increment version

* Update documentation_test.yml

* Update documentation_test.yml

* switch to testpypi for pip install

* Update documentation_test.yml

* Create publish_testpypi.yml

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* Show wheel build

* try to run docs from the pypi build

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* try different version nummber

* add bump for versioning

* mvoe to docs directory for sphinx

* Update setup.py

* Update setup.py

* Update documentation_test.yml

* update dhart

* Update documentation_test.yml

* Update publish_testpypi.yml

* Update setup.py

* query cmake

* bump

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* Update publish_testpypi.yml

* Update publish_testpypi.yml
  • Loading branch information
cadop authored Jan 14, 2025
1 parent e607ec3 commit d1d5132
Show file tree
Hide file tree
Showing 15 changed files with 317 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
- name: Install windows documentation requirements
run: |
$url = "https://www.doxygen.nl/files/doxygen-1.9.5.windows.x64.bin.zip"
Start-DownloadWit`hRetry -Url $url -Name "doxygen.zip" -DownloadPath "C:\"
Invoke-WebRequest -Uri $url -OutFile "C:\doxygen.zip"
Extract-7Zip -Path "C:\doxygen.zip" -DestinationPath "C:\windows\system32"
doxygen --version`
Expand Down
113 changes: 113 additions & 0 deletions .github/workflows/documentation_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Documentation Tests

on:
push:
branches:
- dev_stage


jobs:

sphinx:
runs-on: windows-latest
strategy:
max-parallel: 0
matrix:
python-version: ['3.10']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
with: # for github push action
#persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

- name: Configure cmake
run: |
cmake -S src -B build -G "Visual Studio 17 2022" -A x64 `
-DDHARTAPI_Config=All `
-DDHARTAPI_EnableTests=False `
-DCMAKE_CONFIGURATION_TYPES=Release `
-DDHARTAPI_EnablePython=True `
-DDHARTAPI_EnableCSharp=False `
-DINSTALL_GTEST=False `
-DCMAKE_INSTALL_PREFIX="D:/a/dhart/dhart/build/Python"
- name: Build
run: cmake --build build --config Release

- name: Install
run: cmake --install build --config Release

- name: Add build directory to PATH
run: |
$env:PATH += ";D:/a/dhart/dhart/build/Python/bin"
- name: Check Install Location
run: |
cd "D:/a/dhart/dhart/build/Python"
ls
cd bin
ls
cd ..
cd dhart
ls
cd bin
ls
- name: Build and Install Wheel
run: |
cd "D:/a/dhart/dhart/build/Python"
python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
python -m pip install numpy matplotlib scipy
python -m pip install -i https://test.pypi.org/simple/ dhart
- name: Check Python Install
run: |
python -c "from dhart.spatialstructures import Graph"
python -c "import platform; print(platform.architecture())"
python -c "import dhart; print(dhart.__file__)"
- name: Install dependencies
run: |
python -m pip install flake8 pytest
- name: Install documentation dependencies
run: |
python -m pip install sphinx numpydoc matplotlib
- name: Check installed package
run: |
pip show dhart
python -c "import platform; print(platform.architecture())"
python -c "import dhart; print(dhart.__file__)"
- name: Build documentation with sphinx
run: |
cd "docs/Python Docs"
ls
./make.bat clean
./make.bat html
# make latexpdf
cd build
ls
cd html
ls
- name: Run sphinx doctests
run: |
cd "docs/Python Docs"
ls
./make.bat clean
./make.bat doctest
- name: Run pytest
run: |
cd "build/Python"
ls
pytest --doctest-modules --ignore-glob="*/Rhino*.py"
56 changes: 56 additions & 0 deletions .github/workflows/doxygen_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Documentation Tests for Doxygen

on:
push:
branches:
- main
# pull_request:
# branches:
# - dev_stage
# - main

jobs:

doxygen:
runs-on: windows-2019
strategy:
max-parallel: 0
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
with: # for github push action
#persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

- name: Install windows documentation requirements
run: |
$url = "https://www.doxygen.nl/files/doxygen-1.9.5.windows.x64.bin.zip"
Invoke-WebRequest -Uri $url -OutFile "C:\doxygen.zip"
7z x "C:\doxygen.zip" -o"C:\windows\system32" -y
doxygen --version`
choco install graphviz -y
#sudo apt-get install -y doxygen
#sudo apt-get install -y graphviz
- name: Build c++ documentation with doxygen
run: |
cd src
doxygen Doxyfile
ls
- name: Build c# documentation with doxygen
run: |
doxygen Doxyfile_Csharp
doxygen Doxyfile_Public_CSharp
133 changes: 133 additions & 0 deletions .github/workflows/publish_testpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Publish to Test PyPI

on:
pull_request:
branches:
- dev_stage
- main

jobs:

testpypi:
runs-on: windows-2019
strategy:
max-parallel: 0
matrix:
python-version: ['3.10']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
with: # for github push action
#persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Configure CMake
run: |
cmake -S src -B build `
-G "Visual Studio 16 2019" `
-A x64 `
-DCMAKE_INSTALL_PREFIX="D:/a/dhart/dhart/build/Python" `
-DDHARTAPI_Config="All" `
-DDHARTAPI_EnableTests="False" `
-DCMAKE_CONFIGURATION_TYPES="Release" `
-DDHARTAPI_EnablePython="True" `
-DDHARTAPI_EnableCSharp="False" `
-DEmbree_DIR="D:/a/dhart/dhart/src/external/Embree"
- name: Build
run: |
cmake --build build --config Release --verbose
# - name: Configure cmake
# run: |
# cd src
# cmake ./src/ -G"Visual Studio 16 2019" -DCMAKE_GENERATOR_PLATFORM="x64" -DCMAKE_INSTALL_PREFIX=".\..\build\Python" -DDHARTAPI_Config="All" -DDHARTAPI_EnableTests="False" -DCMAKE_CONFIGURATION_TYPES="Release" -DDHARTAPI_EnablePython="True" -DDHARTAPI_EnableCSharp="False" -DINSTALL_GTEST="False" ".\" 2>&1

# - name: cmake build
# run: |
# ls
# cd src
# cmake --build . --config Release

- name: cmake Install
run: |
ls
cmake --install build --config Release
- name: Add build directory to PATH
run: |
$env:PATH += ";D:/a/dhart/dhart/build/Python/bin"
- name: Check Install Location
run: |
cd "D:/a/dhart/dhart/build/Python"
ls
cd bin
ls
cd ..
cd dhart
ls
cd bin
ls
- name: Build and Install Wheel
run: |
cd "D:/a/dhart/dhart/build/Python"
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine build
python -m pip install numpy matplotlib scipy
- name: Increment Package Version
run: |
cd "D:/a/dhart/dhart/build/Python"
python -m pip install bump
python -m bump
# Step 4: Build the package
- name: Build the package
run: |
cd "D:/a/dhart/dhart/build/Python"
python -m build
ls
# python setup.py sdist bdist_wheel
python -m pip install -e .
- name: Try to import dhart
run: |
python -c "from dhart.spatialstructures import Graph"
python -c "import platform; print(platform.architecture())"
python -c "import dhart; print(dhart.__file__)"
- name: Run Sphinx from testpypi
run: |
cd "D:/a/dhart/dhart/build/Python"
python -m pip install flake8 pytest
python -m pip install sphinx numpydoc matplotlib
ls
cd "D:/a/dhart/dhart/docs/Python Docs"
ls
./make.bat clean
./make.bat html
./make.bat doctest
# Step 5: Publish to Test PyPI
- name: Publish to Test PyPI
env:
TWINE_USERNAME: "__token__" # Required for Test PyPI token
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
cd "D:/a/dhart/dhart/build/Python"
ls
twine upload --repository testpypi dist/* --verbose
- name: Check Python Install
run: |
pip install -i https://test.pypi.org/simple/ dhart
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 3.10)

# Paths
set(PYTHON_PACKAGE_DIR "Python")
Expand Down Expand Up @@ -601,6 +601,7 @@ if(DHARTAPI_EnablePython)
install (FILES ${DEBUG_DEPENDENCY_BINARIES} CONFIGURATIONS Debug DESTINATION dhart/bin)

LIST(APPEND ROOT_FILES ${PYTHON_PACKAGE_DIR}/setup.py)
LIST(APPEND ROOT_FILES ${PYTHON_PACKAGE_DIR}/conftest.py)
endif()


Expand Down
2 changes: 1 addition & 1 deletion src/Cpp/analysismethods/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 3.10)

add_library(GraphGenerator STATIC)
target_sources(
Expand Down
2 changes: 1 addition & 1 deletion src/Cpp/database/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CMakeList.txt : CMake project for DHART_API, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 3.10)

project ("DHART_API")

Expand Down
2 changes: 1 addition & 1 deletion src/Cpp/objloader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 3.10)

# Break this into two libraries?
add_library(OBJLoader STATIC)
Expand Down
2 changes: 1 addition & 1 deletion src/Cpp/pathfinding/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 3.10)

# Break this into two libraries?
add_library(Pathfinder STATIC)
Expand Down
2 changes: 1 addition & 1 deletion src/Cpp/raytracer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 3.10)
set(ROBIN_HOOD_DIR ${PROJECT_SOURCE_DIR}/external/robin_hood/)

include(FetchContent)
Expand Down
2 changes: 1 addition & 1 deletion src/Cpp/spatialstructures/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 3.10)

add_library(SpatialStructures STATIC)

Expand Down
2 changes: 1 addition & 1 deletion src/Cpp/spatialstructuresdb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CMakeList.txt : CMake project for DHART_API, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 3.10)

project ("DHART_API")

Expand Down
2 changes: 1 addition & 1 deletion src/Csharp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.10)
project("DHARTAPICSharp" CSharp)

### NOTE:
Expand Down
4 changes: 2 additions & 2 deletions src/Python/dhart/common_native_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def getDLLHandle() -> CDLL:
cdll_dir = os.path.join(directory, dllname)
HFPython = CDLL(cdll_dir, use_last_error=False)

except FileNotFoundError as e:
print("CDLL Failed to load!")
except (FileNotFoundError, OSError) as e:
print(f"CDLL failed to load! Attempted path: {cdll_dir}")
print(e)
raise e

Expand Down
Loading

0 comments on commit d1d5132

Please sign in to comment.