Skip to content

Commit

Permalink
Implemented CI for automatic update deployment and documentation (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
emd4600 authored Nov 8, 2023
1 parent 86cdb8c commit f18fd62
Show file tree
Hide file tree
Showing 16 changed files with 204 additions and 71 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Deploy ModAPI Dlls & Update Documentation
on:
push:
branches:
- master
jobs:
compile:
name: Compile ModAPI core DLLS
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed to count all the commits

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1

- name: Set up MSVC cmd
uses: ilammy/msvc-dev-cmd@v1.12.1
with:
arch: x86

- name: Compile DLLs
run: |
$count = git log --oneline | wc -l
echo "Building version $count"
msbuild "Spore ModAPI" -t:BuildDlls -p:BuildVer=$count -p:Config=Release
- name: Upload compiled files
uses: actions/upload-artifact@v3.1.3
with:
name: compiled-modapi-dlls
path: |
dll\Release\SporeModAPI.march2017.dll
dll\Release\SporeModAPI.disk.dll
dll\Release\SporeModAPI.lib
deploy:
name: Deploy ModAPI DLLs update
needs: compile
runs-on: ubuntu-latest
steps:
- name: Download compiled files
uses: actions/download-artifact@v2.1.1
with:
name: compiled-modapi-dlls

- name: Create update bundle
run: zip SporeModAPIdlls.zip SporeModAPI.march2017.dll SporeModAPI.disk.dll SporeModAPI.lib

# - name: Upload dlls bundle
# uses: actions/upload-artifact@v3.1.3
# with:
# name: compiled-modapi-dlls-bundle
# path: SporeModAPIdlls.zip

- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed to count all the commits
path: Spore-ModAPI

- name: Get version number
id: version_number
run: |
cd Spore-ModAPI
count=$(git log --oneline | wc -l)
echo "version=$count" >> $GITHUB_OUTPUT
- name: Get commit message
id: commit_message
run: |
cd Spore-ModAPI
message=$(git log -1 --pretty=%B)
echo "message=$message" >> $env:GITHUB_OUTPUT
- name: Release to GitHub
uses: softprops/action-gh-release@v1
with:
# prerelease: true
name: ModAPI SDK v2.5.${{ steps.version_number.outputs.version }}
tag_name: v2.5.${{ steps.version_number.outputs.version }}
body: ${{ steps.commit_message.outputs.message }}
files: SporeModAPIdlls.zip

documentation:
name: Generate documentation
runs-on: ubuntu-latest
steps:
- name: Install Doxygen
uses: ssciwr/doxygen-install@v1.2.0

- name: Setup Python
uses: actions/setup-python@v4.7.1

- name: Install Python dependencies
run: pip3 install jinja2 Pygments

- name: Checkout m.css repository
uses: actions/checkout@v4
with:
repository: emd4600/m.css
path: m.css

- name: Checkout ModAPI repository
uses: actions/checkout@v4
with:
path: Spore-ModAPI
fetch-depth: 0 # Needed to count all the commits

- name: Run m.css
run: |
cd Spore-ModAPI
python3 ../m.css/documentation/doxygen.py "Documentation/Doxygen-mcss.txt" --debug
- name: Commit documentation pages
run: |
cd Spore-ModAPI
count=$(git log --oneline | wc -l)
cd modapi-generated-docs/html
# Needed to ensure Jekyll is not run, as it omits certain files
touch .nojekyll
git init
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote add origin https://github.com/emd4600/Spore-ModAPI.git
git fetch
git symbolic-ref HEAD refs/remotes/origin/gh-pages
git reset
git add .
git commit -m "Documentation update $count"
- name: Upload changes to GitHub
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
directory: Spore-ModAPI/modapi-generated-docs/html


2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/dll
/EASTL-3.02.01/out/build/x64-Debug
/lib
/Documentation
.vs
.vscode
__pycache__
Expand All @@ -14,3 +13,4 @@ Release
Projects/*
!Projects/Example Projects/
/SDKtoGhidra/temp.cpp
modapi-generated-docs
10 changes: 5 additions & 5 deletions Documentation/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PROJECT_LOGO = Spore_ModAPI_Icon.png
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.

OUTPUT_DIRECTORY = "E:\Eric\Spore ModAPI\Documentation"
OUTPUT_DIRECTORY = "../modapi-generated-docs"

# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
Expand Down Expand Up @@ -162,7 +162,7 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.

STRIP_FROM_PATH = "E:\Eric\Spore ModAPI SDK\Spore ModAPI"
STRIP_FROM_PATH = /home/runner/work/Spore-ModAPI/Spore-ModAPI/Spore-ModAPI/

# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
Expand Down Expand Up @@ -790,7 +790,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = "E:\Eric\Spore ModAPI SDK\Spore ModAPI" "E:\Eric\Spore ModAPI SDK\Documentation"
INPUT = "../Spore ModAPI" "."

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -873,7 +873,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.

EXCLUDE = "E:\Eric\Spore ModAPI SDK\Spore ModAPI\SourceCode"
EXCLUDE = "./Spore ModAPI/SourceCode"

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down Expand Up @@ -2100,7 +2100,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = DOXUGEN

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
50 changes: 25 additions & 25 deletions Documentation/Doxygen-mcss.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@ XML_PROGRAMLISTING = NO

M_SHOW_UNDOCUMENTED = YES

M_FAVICON = "Documentation/Spore_ModAPI_Icon.png"
M_FAVICON = "../../Spore-ModAPI/Documentation/Spore_ModAPI_Icon.png"

HTML_EXTRA_STYLESHEET = \
https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600 \
../m.css/css/m-dark.css \
../m.css/css/m-documentation.css
../css/m-dark.css \
../css/m-documentation.css
HTML_EXTRA_FILES = \
../m.css/css/m-theme-dark.css \
../m.css/css/m-grid.css \
../m.css/css/m-components.css \
../m.css/css/m-layout.css \
../m.css/css/pygments-dark.css \
../m.css/css/pygments-console.css \
"Documentation/extras/0R8WiYE.png" \
"Documentation/extras/effects_example_1.png" \
"Documentation/extras/effects_example_1.cpp" \
"Documentation/extras/PB1deAP.png" \
"Documentation/extras/breakpoint.png" \
"Documentation/extras/debug_view.png" \
"Documentation/extras/installer.png" \
"Documentation/extras/project_template.png" \
"Documentation/extras/new_project.png" \
"Documentation/extras/extension.png" \
"Documentation/extras/solution_explorer.png" \
"Documentation/extras/item_templates.png" \
"Documentation/extras/sync.png" \
"Documentation/extras/fetch.png" \
"Documentation/extras/messaging_example_1.cpp"
M_THEME_COLOR = #22272e
../css/m-theme-dark.css \
../css/m-grid.css \
../css/m-components.css \
../css/m-layout.css \
../css/pygments-dark.css \
../css/pygments-console.css \
"../../Spore-ModAPI/Documentation/extras/0R8WiYE.png" \
"../../Spore-ModAPI/Documentation/extras/effects_example_1.png" \
"../../Spore-ModAPI/Documentation/extras/effects_example_1.cpp" \
"../../Spore-ModAPI/Documentation/extras/PB1deAP.png" \
"../../Spore-ModAPI/Documentation/extras/breakpoint.png" \
"../../Spore-ModAPI/Documentation/extras/debug_view.png" \
"../../Spore-ModAPI/Documentation/extras/installer.png" \
"../../Spore-ModAPI/Documentation/extras/project_template.png" \
"../../Spore-ModAPI/Documentation/extras/new_project.png" \
"../../Spore-ModAPI/Documentation/extras/extension.png" \
"../../Spore-ModAPI/Documentation/extras/solution_explorer.png" \
"../../Spore-ModAPI/Documentation/extras/item_templates.png" \
"../../Spore-ModAPI/Documentation/extras/sync.png" \
"../../Spore-ModAPI/Documentation/extras/fetch.png" \
"../../Spore-ModAPI/Documentation/extras/messaging_example_1.cpp"
M_THEME_COLOR = #22272e
20 changes: 10 additions & 10 deletions Spore ModAPI/Spore/App/Property.h
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ namespace App
void Clear(bool arg_0);

protected:
union
union UNNAMED(PropertyValues)
{

bool mValueBool;
Expand All @@ -849,17 +849,17 @@ namespace App
//uint64_t mValue;
//double mValue;
float mValueFloat;
struct { ResourceKey mValueKey; };
struct { Vector2 mValueVector2; };
struct { Vector3 mValueVector3; };
struct { Vector4 mValueVector4; };
struct { ColorRGB mValueColorRGB; };
struct { ColorRGBA mValueColorRGBA; };
struct UNNAMED(PropertyResourceKey) { ResourceKey mValueKey; };
struct UNNAMED(PropertyVector2) { Vector2 mValueVector2; };
struct UNNAMED(PropertyVector3){ Vector3 mValueVector3; };
struct UNNAMED(PropertyVector4) { Vector4 mValueVector4; };
struct UNNAMED(PropertyColorRGB) { ColorRGB mValueColorRGB; };
struct UNNAMED(PropertyColorRGBA) { ColorRGBA mValueColorRGBA; };

struct { eastl::string8 mValueString8; };
struct { eastl::string16 mValueString16; };
struct UNNAMED(PropertyString8) { eastl::string8 mValueString8; };
struct UNNAMED(PropertyString16) { eastl::string16 mValueString16; };

struct
struct UNNAMED(PropertyArray)
{
void* mpData;
size_t mnItemSize;
Expand Down
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/GameCiv/Messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
namespace GameCiv
{
#ifndef SDK_TO_GHIDRA
enum
enum GameCivMessageIDs
{
0x1A0219E,
0x164B4EB,
Expand Down
4 changes: 1 addition & 3 deletions Spore ModAPI/Spore/Graphics/cMaterialManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Graphics
{
class UnkMatManager
{
protected:
public:
/* 00h */ int field_00;
/* 04h */ int field_04;
/* 08h */ eastl::hash_map<int, int> field_08;
Expand All @@ -53,8 +53,6 @@ namespace Graphics
/* 110h */ eastl::string field_110;
/* 120h */ char field_120[0x1C]; // not initialized
/* 13Ch */ eastl::hash_map<int, int> field_13C;

friend class cMaterialManager;
};


Expand Down
4 changes: 2 additions & 2 deletions Spore ModAPI/Spore/Input.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum KeyModifierFlags
union KeyModifiers
{
uint32_t value;
struct {
struct UNNAMED(KeyModifiersBits) {
int IsShiftDown : 1;
int IsCtrlDown : 1;
int IsAltDown : 1;
Expand All @@ -54,7 +54,7 @@ enum MouseStateFlags
union MouseState
{
uint32_t value;
struct {
struct UNNAMED(MouseStateBits) {
int IsShiftDown : 1;
int IsCtrlDown : 1;
int IsAltDown : 1;
Expand Down
5 changes: 5 additions & 0 deletions Spore ModAPI/Spore/Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#include <Windows.h>
#include <Spore\CppRevEng.h>

#ifdef DOXYGEN
#define UNNAMED(altName) altName
#else
#define UNNAMED(altName)
#endif

#ifdef MODAPI_DLL_EXPORT
/*Enabled as "export" while compiling the dll project*/
Expand Down
10 changes: 5 additions & 5 deletions Spore ModAPI/Spore/MathUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ namespace Math
struct Color
{
#ifndef SDK_TO_GHIDRA
union {
union UNNAMED(ColorUnion) {
uint32_t value;
struct
struct UNNAMED(ColorRGBAValues)
{
uint8_t b;
uint8_t g;
Expand Down Expand Up @@ -277,16 +277,16 @@ namespace Math
/// where each border is at.
struct Rectangle {
#ifndef SDK_TO_GHIDRA
union
union UNNAMED(RectangleUnion)
{
struct
struct UNNAMED(RectangleXY)
{
float x1;
float y1;
float x2;
float y2;
};
struct
struct UNNAMED(RectangleSides)
{
float left;
float top;
Expand Down
Loading

0 comments on commit f18fd62

Please sign in to comment.