Skip to content

Commit 7b661a4

Browse files
Merge pull request #335 from Distributive-Network/caleb/fix/publish
fix(CI): fix building docs in CI by adding a 'None' BUILD_TYPE
2 parents ccf210b + aadda43 commit 7b661a4

File tree

6 files changed

+131
-120
lines changed

6 files changed

+131
-120
lines changed

.github/workflows/test-and-publish.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ on:
4141
- 'Profile'
4242
- 'DRelease'
4343
- 'Release'
44+
- 'None'
4445
pull_request:
4546

4647
env:
@@ -154,15 +155,9 @@ jobs:
154155
if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux
155156
sudo apt-get update -y
156157
sudo apt-get install -y cmake graphviz llvm
157-
# Install Doxygen
158-
# the newest version in Ubuntu 20.04 repository is 1.8.17, but we need Doxygen 1.9 series
159-
wget -c -q https://www.doxygen.nl/files/doxygen-1.9.7.linux.bin.tar.gz
160-
tar xf doxygen-1.9.7.linux.bin.tar.gz
161-
cd doxygen-1.9.7 && sudo make install && cd -
162-
rm -rf doxygen-1.9.7 doxygen-1.9.7.linux.bin.tar.gz
163158
elif [[ "$OSTYPE" == "darwin"* ]]; then # macOS
164159
brew update || true # allow failure
165-
brew install cmake doxygen pkg-config wget coreutils # `coreutils` installs the `realpath` command
160+
brew install cmake pkg-config wget coreutils # `coreutils` installs the `realpath` command
166161
fi
167162
echo "Installing python deps"
168163
poetry self add "poetry-dynamic-versioning[plugin]"
@@ -250,8 +245,15 @@ jobs:
250245
version: 1.5.1
251246
- name: Build source distribution (sdist) file
252247
run: |
248+
# Install Doxygen
249+
# the newest version in Ubuntu 20.04 repository is 1.8.17, but we need Doxygen 1.9 series
250+
wget -c -q https://www.doxygen.nl/files/doxygen-1.9.7.linux.bin.tar.gz
251+
tar xf doxygen-1.9.7.linux.bin.tar.gz
252+
cd doxygen-1.9.7 && sudo make install && cd -
253+
rm -rf doxygen-1.9.7 doxygen-1.9.7.linux.bin.tar.gz
253254
poetry self add "poetry-dynamic-versioning[plugin]"
254-
BUILD_DOCS=1 BUILD_TYPE=Release poetry build --format=sdist
255+
BUILD_DOCS=1 BUILD_TYPE=None poetry install
256+
poetry build --format=sdist
255257
ls -lah ./dist/
256258
- name: Upload sdist as CI artifacts
257259
uses: actions/upload-artifact@v3

CMakeLists.txt

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,19 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
5252
SET(RELEASE_FLAGS "${OPTIMIZED} ${STRIP_SYMBOLS}")
5353

5454
if(GENERATOR_IS_MULTI_CONFIG)
55-
set(CMAKE_CONFIGURATION_TYPES "Profile;Debug;DRelease;Release" CACHE STRING "" FORCE)
55+
set(CMAKE_CONFIGURATION_TYPES "Profile;Debug;DRelease;Release;None" CACHE STRING "" FORCE)
5656
string(APPEND COMPILE_FLAGS "$<$<CONFIG:Profile>:${PROFILE_FLAGS}> $<$<CONFIG:Debug>:${DEBUG_FLAGS}> $<$<CONFIG:DRelease>:${DRELEASE_FLAGS}> $<$<CONFIG:Release>:${RELEASE_FLAGS}>")
5757
else()
5858
set_property(CACHE PM_BUILD_TYPE PROPERTY HELPSTRING "Choose the type of build")
59-
set_property(CACHE PM_BUILD_TYPE PROPERTY STRINGS "Profile;Debug;DRelease;Release")
59+
set_property(CACHE PM_BUILD_TYPE PROPERTY STRINGS "Profile;Debug;DRelease;Release;None")
6060
if(PM_BUILD_TYPE STREQUAL "Profile")
6161
list(APPEND COMPILE_FLAGS "${PROFILE_FLAGS}")
6262
elseif(PM_BUILD_TYPE STREQUAL "Debug")
6363
list(APPEND COMPILE_FLAGS "${DEBUG_FLAGS}")
6464
elseif(PM_BUILD_TYPE STREQUAL "DRelease")
6565
list(APPEND COMPILE_FLAGS "${DRELEASE_FLAGS}")
66+
elseif(PM_BUILD_TYPE STREQUAL "None")
67+
message("PM_BUILD_TYPE is None. Not compiling.")
6668
else() #Release build
6769
message("PM_BUILD_TYPE not detected or invalid value, defaulting to Release build.")
6870
set(PM_BUILD_TYPE Release CACHE STRING "" FORCE)
@@ -72,33 +74,37 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
7274
list(JOIN COMPILE_FLAGS " " COMPILE_FLAGS)
7375
endif()
7476

75-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}")
76-
77-
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
78-
if(APPLE)
79-
find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
80-
find_package(SpiderMonkey REQUIRED)
81-
set(PYTHON_MAJOR $ENV{Python_VERSION_MAJOR})
82-
set(PYTHON_MINOR $ENV{Python_VERSION_MINOR})
83-
set(PYTHONLIBS_VERSION_STRING ${Python_VERSION})
84-
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
85-
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
86-
elseif(UNIX)
87-
find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
88-
set(Python_FIND_VIRTUALENV FIRST) # (require cmake >= v3.15 and this is the default) use the Python version configured by pyenv if available
89-
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
90-
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
91-
find_package(SpiderMonkey REQUIRED)
92-
elseif(WIN32)
93-
find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
94-
set(Python_FIND_VIRTUALENV FIRST) # (require cmake >= v3.15 and this is the default) use the Python version configured by pyenv if available
95-
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
96-
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
97-
find_package(SpiderMonkey REQUIRED)
98-
endif()
99-
message("${CMAKE_SYSTEM_NAME} - Using Python:${Python_VERSION} - Libraries:${Python_LIBRARIES} - IncludeDirs: ${Python_INCLUDE_DIRS}")
100-
include_directories(${Python_INCLUDE_DIRS})
101-
include_directories(${SPIDERMONKEY_INCLUDE_DIR})
77+
if(NOT PM_BUILD_TYPE STREQUAL "None")
78+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}")
79+
80+
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
81+
if(APPLE)
82+
find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
83+
find_package(SpiderMonkey REQUIRED)
84+
set(PYTHON_MAJOR $ENV{Python_VERSION_MAJOR})
85+
set(PYTHON_MINOR $ENV{Python_VERSION_MINOR})
86+
set(PYTHONLIBS_VERSION_STRING ${Python_VERSION})
87+
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
88+
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
89+
elseif(UNIX)
90+
find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
91+
set(Python_FIND_VIRTUALENV FIRST) # (require cmake >= v3.15 and this is the default) use the Python version configured by pyenv if available
92+
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
93+
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
94+
find_package(SpiderMonkey REQUIRED)
95+
elseif(WIN32)
96+
find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
97+
set(Python_FIND_VIRTUALENV FIRST) # (require cmake >= v3.15 and this is the default) use the Python version configured by pyenv if available
98+
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
99+
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
100+
find_package(SpiderMonkey REQUIRED)
101+
endif()
102+
message("${CMAKE_SYSTEM_NAME} - Using Python:${Python_VERSION} - Libraries:${Python_LIBRARIES} - IncludeDirs: ${Python_INCLUDE_DIRS}")
103+
include_directories(${Python_INCLUDE_DIRS})
104+
include_directories(${SPIDERMONKEY_INCLUDE_DIR})
105+
# Add compiled folder directories
106+
add_subdirectory(src)
107+
endif(NOT PM_BUILD_TYPE STREQUAL "None")
102108

103109
# Add doxygen if this is the main app
104110
option(BUILD_DOCS "Build documentation" OFF)
@@ -112,6 +118,3 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
112118
endif()
113119

114120
endif()
115-
116-
# Add compiled folder directories
117-
add_subdirectory(src)

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# @date March 2024
55
#
66

7-
BUILD = Debug # (case-insensitive) Release, DRelease, Debug, or Profile
7+
BUILD = Debug # (case-insensitive) Release, DRelease, Debug, Profile, or None
88
DOCS = false
99
VERBOSE = true
1010
PYTHON = python3
@@ -25,6 +25,8 @@ else ifeq ($(BUILD),Debug)
2525
PYTHON_BUILD_ENV += BUILD_TYPE=Debug
2626
else ifeq ($(BUILD),DRelease)
2727
PYTHON_BUILD_ENV += BUILD_TYPE=DRelease
28+
else ifeq($(BUILD), None)
29+
PYTHON_BUILD_ENV += BUILD_TYPE=None
2830
else # Release build
2931
PYTHON_BUILD_ENV += BUILD_TYPE=Release
3032
endif

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ PythonMonkey supports multiple build types, which you can build by setting the `
8484
- `DRelease`: same as `Release`, except symbols are not stripped
8585
- `Debug`: minimal optimizations
8686
- `Profile`: same as `Debug`, except profiling is enabled
87+
- `None`: don't compile (useful if you only want to build the docs)
8788

8889
If you are using VSCode, you can just press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>B</kbd> to [run build task](https://code.visualstudio.com/docs/editor/tasks#_custom-tasks) - We have [the `tasks.json` file configured for you](.vscode/tasks.json).
8990

build.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ def run_cmake_build():
5959

6060

6161
def copy_artifacts():
62+
if "BUILD_TYPE" in os.environ and os.environ["BUILD_TYPE"].title() == "None":
63+
return # do not copy artifacts if we did not build them
64+
6265
if platform.system() == "Windows":
6366
execute("cp ./build/src/*/pythonmonkey.pyd ./python/pythonmonkey/", cwd=TOP_DIR) # Release or Debug build
6467
execute("cp ./_spidermonkey_install/lib/mozjs-*.dll ./python/pythonmonkey/", cwd=TOP_DIR)

0 commit comments

Comments
 (0)