Skip to content

Commit 71a877e

Browse files
GitHub actions
1 parent fc13db6 commit 71a877e

8 files changed

Lines changed: 427 additions & 17 deletions

File tree

.github/workflows/build-macos.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Building for macOS
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
EMBREE_VERSION: 4.4.0
8+
OIDN_VERSION: 2.3.3
9+
BUILD_DIR: build
10+
RUNTIME_DIR: bin
11+
12+
jobs:
13+
build-for-macos:
14+
runs-on: macos-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Install CMake and Ninja
21+
run: |
22+
brew install cmake ninja
23+
24+
- name: Download Embree from RenderKit
25+
run: |
26+
zip="embree-$EMBREE_VERSION.arm64.macosx.zip"
27+
url="https://github.com/RenderKit/embree/releases/download/v$EMBREE_VERSION/$zip"
28+
echo "Downloading Embree from: $url"
29+
wget -O "$zip" "$url"
30+
unzip "$zip"
31+
rm "$zip"
32+
33+
- name: Create bin/ directory and copy Embree dylibs
34+
run: |
35+
mkdir -p "$RUNTIME_DIR"
36+
cp "embree-$EMBREE_VERSION.arm64.macosx/lib/"*.dylib "$RUNTIME_DIR/"
37+
38+
- name: Download and extract OIDN (RenderKit)
39+
run: |
40+
zip="oidn-$OIDN_VERSION.arm64.macos.tar.gz"
41+
url="https://github.com/RenderKit/oidn/releases/download/v$OIDN_VERSION/$zip"
42+
echo "Downloading OIDN from: $url"
43+
wget -O "$zip" "$url"
44+
mkdir -p oidn_temp && tar -xzf "$zip" -C oidn_temp
45+
rm "$zip"
46+
mkdir -p "thirdparty/oidn"
47+
cp -r oidn_temp/oidn-$OIDN_VERSION.arm64.macos/* "thirdparty/oidn/"
48+
49+
- name: Build
50+
run: |
51+
cmake -B "$BUILD_DIR" -G Ninja \
52+
-DCMAKE_BUILD_TYPE=Release \
53+
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY="$PWD/$RUNTIME_DIR" \
54+
-DCMAKE_OSX_ARCHITECTURES=arm64 \
55+
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \
56+
-DEMBREE_LOCATION="$PWD/embree-$EMBREE_VERSION.arm64.macosx"
57+
cmake --build "$BUILD_DIR" --config Release --parallel
58+
59+
- name: Upload build artifacts
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: etx-tracer-macos
63+
path: bin/

.github/workflows/build-windows.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,4 @@ jobs:
6767
uses: actions/upload-artifact@v4
6868
with:
6969
name: etx-tracer-windows
70-
path: |
71-
bin/
72-
bin/*.exe
70+
path: bin/

.github/workflows/main.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
matrix:
1414
include:
1515
- os: windows-latest
16-
embree_url: https://github.com/embree/embree/releases/download/v4.3.3/embree-4.3.3.x64.windows.zip
17-
embree_dir: embree-4.3.3.x64.windows
16+
embree_url: https://github.com/RenderKit/embree/releases/download/v4.4.0/embree-4.4.0.x64.windows.zip
17+
embree_dir: embree-4.4.0.x64.windows
1818
- os: macos-latest
19-
embree_url: https://github.com/embree/embree/releases/download/v4.3.3/embree-4.3.3.x86_64.macosx.zip
20-
embree_dir: embree-4.3.3.x86_64.macosx
19+
embree_url: https://github.com/RenderKit/embree/releases/download/v4.4.0/embree-4.4.0.arm64.macosx.zip
20+
embree_dir: embree-4.4.0.arm64.macosx
2121

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

@@ -31,7 +31,18 @@ jobs:
3131
- name: Install dependencies (macOS)
3232
if: runner.os == 'macOS'
3333
run: |
34-
brew install embree
34+
# Download and extract Embree for macOS (v4.4.0 from RenderKit)
35+
echo "Downloading Embree for ARM64..."
36+
wget -O embree.tar.gz ${{ matrix.embree_url }}
37+
echo "Extracting Embree..."
38+
mkdir -p embree_temp && tar -xzf embree.tar.gz -C embree_temp
39+
echo "Moving Embree files..."
40+
# Try different extraction structures
41+
if [ -d "embree_temp/${{ matrix.embree_dir }}" ]; then
42+
cp -r embree_temp/${{ matrix.embree_dir }}/* thirdparty/embree/ 2>/dev/null || mkdir -p thirdparty/embree && cp -r embree_temp/${{ matrix.embree_dir }}/* thirdparty/embree/
43+
else
44+
cp -r embree_temp/* thirdparty/embree/ 2>/dev/null || mkdir -p thirdparty/embree && cp -r embree_temp/* thirdparty/embree/
45+
fi
3546
3647
- name: Install OIDN (macOS)
3748
if: runner.os == 'macOS'
@@ -72,9 +83,13 @@ jobs:
7283
Invoke-WebRequest -Uri "https://github.com/RenderKit/oidn/releases/download/v2.3.3/oidn-2.3.3.x64.windows.zip" -OutFile "oidn.zip"
7384
Expand-Archive -Path "oidn.zip" -DestinationPath "."
7485
Get-ChildItem -Path "." -Name
86+
# Clean existing OIDN installation
87+
if (Test-Path "thirdparty/oidn") {
88+
Remove-Item -Path "thirdparty/oidn" -Recurse -Force
89+
}
7590
# Try different extraction structures
7691
if (Test-Path "oidn-2.3.3.x64.windows") {
77-
Move-Item -Path "oidn-2.3.3.x64.windows/*" -Destination "thirdparty/oidn/" -Force
92+
Copy-Item -Path "oidn-2.3.3.x64.windows/*" -Destination "thirdparty/oidn/" -Recurse -Force
7893
} else {
7994
# Copy whatever was extracted
8095
Get-ChildItem -Path "." | Where-Object { $_.Name -notlike "*.zip" -and $_.Name -notlike "embree*" } | ForEach-Object {
@@ -131,11 +146,6 @@ jobs:
131146
cd build
132147
cmake --build . --config Release --target raytracer --verbose
133148
134-
- name: Build raytracer executable
135-
run: |
136-
cd build
137-
cmake --build . --config Release --target raytracer
138-
139149
- name: Verify build artifacts (macOS)
140150
if: runner.os == 'macOS'
141151
run: |

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
/bin/assets_testing/
1414
/bin/lib
1515
/blender/etx_tracer_exporter/__pycache__/
16-
/thirdparty/oidn/
16+
/thirdparty/oidn/
17+
papers/

scripts/check_all_boolean_style.py

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Batch boolean comparison style checker for all C++ source files.
4+
Scans the entire sources/ directory (excluding thirdparty) and reports all style violations.
5+
Console shows progress with pass/fail indicators.
6+
Log file 'boolean_style_check_results.txt' contains ONLY files with violations (no clean files).
7+
"""
8+
9+
import os
10+
import sys
11+
import subprocess
12+
from pathlib import Path
13+
14+
15+
def find_cpp_files():
16+
"""Find all C++ source files in sources/ directory, excluding thirdparty"""
17+
sources_dir = Path("sources")
18+
cpp_files = []
19+
20+
if not sources_dir.exists():
21+
print("Error: sources/ directory not found")
22+
return []
23+
24+
# Extensions to check
25+
extensions = [".cxx", ".cpp", ".cc", ".hxx", ".hpp", ".h"]
26+
27+
for ext in extensions:
28+
# Find all files with this extension
29+
for file_path in sources_dir.rglob(f"*{ext}"):
30+
# Skip thirdparty directory
31+
if "thirdparty" not in str(file_path):
32+
cpp_files.append(file_path)
33+
34+
return sorted(cpp_files)
35+
36+
37+
def run_boolean_check(file_path):
38+
"""Run the boolean style checker on a single file and return violations"""
39+
try:
40+
result = subprocess.run(
41+
[sys.executable, "scripts/custom_boolean_check.py", str(file_path)],
42+
capture_output=True,
43+
text=True,
44+
cwd=".",
45+
)
46+
47+
violations = []
48+
for line in result.stdout.strip().split("\n"):
49+
if line.strip() and "No boolean style violations found" not in line:
50+
violations.append(line)
51+
52+
return violations
53+
54+
except Exception as e:
55+
return [f"Error checking {file_path}: {e}"]
56+
57+
58+
def log_and_print(message, log_file=None):
59+
"""Print to console and optionally write to log file"""
60+
print(message)
61+
if log_file:
62+
with open(log_file, "a") as f:
63+
f.write(message + "\n")
64+
65+
66+
def main():
67+
# Log file will be created only if violations are found
68+
log_file = None # Will be set when first violation is found
69+
70+
log_and_print("Checking boolean comparison style across all source files...", None)
71+
log_and_print("=" * 70, None)
72+
73+
cpp_files = find_cpp_files()
74+
75+
if not cpp_files:
76+
log_and_print("No C++ source files found in sources/ directory", log_file)
77+
return
78+
79+
log_and_print(f"Found {len(cpp_files)} C++ source files to check", log_file)
80+
log_and_print("", log_file)
81+
82+
total_violations = 0
83+
files_with_violations = 0
84+
files_checked = 0
85+
86+
for file_path in cpp_files:
87+
files_checked += 1
88+
print(f"[{files_checked:2d}/{len(cpp_files):2d}] Checking {file_path}")
89+
90+
violations = run_boolean_check(file_path)
91+
92+
if violations:
93+
# Initialize log file on first violation
94+
if log_file is None:
95+
log_file = "boolean_style_check_results.txt"
96+
with open(log_file, "w") as f:
97+
f.write("Boolean Comparison Style Check Results\n")
98+
f.write("=" * 70 + "\n")
99+
f.write(f"Generated: {Path.cwd()}\n\n")
100+
101+
files_with_violations += 1
102+
total_violations += len(violations)
103+
104+
# Log detailed info to file
105+
log_and_print(
106+
f"[{files_checked:2d}/{len(cpp_files):2d}] Checking {file_path}",
107+
log_file,
108+
)
109+
log_and_print(f" [FAIL] {len(violations)} violations found:", log_file)
110+
for violation in violations:
111+
log_and_print(f" {violation}", log_file)
112+
log_and_print("", log_file)
113+
114+
# Console summary only
115+
print(f" [FAIL] {len(violations)} violations found:")
116+
else:
117+
print(" [PASS] No violations")
118+
119+
# Summary
120+
if total_violations == 0:
121+
print()
122+
print("SUCCESS: All files pass boolean comparison style checks!")
123+
return 0
124+
else:
125+
# Only show summary when there are violations
126+
print()
127+
log_and_print("=" * 70, log_file)
128+
log_and_print("SUMMARY", log_file)
129+
log_and_print(f" Files checked: {files_checked}", log_file)
130+
log_and_print(f" Files with violations: {files_with_violations}", log_file)
131+
log_and_print(f" Total violations: {total_violations}", log_file)
132+
log_and_print("", log_file)
133+
log_and_print(f"Results saved to: {log_file}", log_file)
134+
warning_msg = "WARNING: Style violations found. Consider fixing them for better code consistency."
135+
log_and_print(warning_msg, log_file)
136+
return 1
137+
138+
139+
if __name__ == "__main__":
140+
sys.exit(main())

scripts/create-release-archive.bat

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
@echo off
2+
REM Script to create release archive for etx-tracer
3+
REM Creates a zip containing bin/ contents (except assets_testing, lib, and tmp) plus blender plugin in blender/ folder
4+
5+
setlocal enabledelayedexpansion
6+
7+
REM Get the directory where this script is located
8+
set "SCRIPT_DIR=%~dp0"
9+
set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
10+
for %%i in ("%SCRIPT_DIR%") do set "PROJECT_ROOT=%%~dpi"
11+
set "PROJECT_ROOT=%PROJECT_ROOT:~0,-1%"
12+
13+
echo Creating release archive for etx-tracer...
14+
echo Project root: %PROJECT_ROOT%
15+
echo Excluding: assets_testing/, lib/, tmp/
16+
17+
REM Create temporary directory for packaging
18+
for /f "tokens=*" %%i in ('powershell -Command "[System.IO.Path]::GetTempPath() + [System.IO.Path]::GetRandomFileName()"') do set "TEMP_DIR=%%i"
19+
set "RELEASE_DIR=%TEMP_DIR%\etx-tracer-release"
20+
21+
echo Using temporary directory: %TEMP_DIR%
22+
23+
REM Create release directory
24+
mkdir "%RELEASE_DIR%" 2>nul
25+
26+
REM Copy everything from bin/ except assets_testing, lib, and tmp
27+
echo Copying bin/ contents (excluding assets_testing, lib, and tmp)...
28+
pushd "%PROJECT_ROOT%\bin"
29+
for /d %%i in (*) do (
30+
if "%%i" neq "assets_testing" (
31+
if "%%i" neq "lib" (
32+
if "%%i" neq "tmp" (
33+
echo Copying: %%i
34+
xcopy "%%i" "%RELEASE_DIR%\%%i\" /E /I /H /Y >nul
35+
)
36+
)
37+
)
38+
)
39+
for %%i in (*) do (
40+
if "%%i" neq "assets_testing" (
41+
if "%%i" neq "lib" (
42+
if "%%i" neq "tmp" (
43+
echo Copying: %%i
44+
copy "%%i" "%RELEASE_DIR%\" >nul
45+
)
46+
)
47+
)
48+
)
49+
popd
50+
51+
REM Create zip of blender plugin
52+
echo Creating blender plugin archive...
53+
mkdir "%RELEASE_DIR%\blender" 2>nul
54+
set "BLENDER_ZIP=%RELEASE_DIR%\blender\etx_tracer_exporter.zip"
55+
pushd "%PROJECT_ROOT%\blender"
56+
if exist "etx_tracer_exporter" (
57+
echo Creating: blender/etx_tracer_exporter.zip
58+
powershell -Command "Compress-Archive -Path 'etx_tracer_exporter\*' -DestinationPath '%BLENDER_ZIP%' -Force"
59+
echo Created: blender/etx_tracer_exporter.zip
60+
) else (
61+
echo Warning: Blender plugin directory not found
62+
)
63+
popd
64+
65+
REM Create final release archive
66+
pushd "%TEMP_DIR%"
67+
for /f "tokens=*" %%i in ('powershell -Command "Get-Date -Format 'yyyyMMdd-HHmmss'"') do set "TIMESTAMP=%%i"
68+
set "ARCHIVE_NAME=etx-tracer-windows-%TIMESTAMP%.zip"
69+
70+
echo Creating final archive: %ARCHIVE_NAME%
71+
powershell -Command "Compress-Archive -Path 'etx-tracer-release\*' -DestinationPath '%ARCHIVE_NAME%' -Force"
72+
73+
REM Move archive to project root
74+
move "%ARCHIVE_NAME%" "%PROJECT_ROOT%\" >nul
75+
set "FINAL_ARCHIVE=%PROJECT_ROOT%\%ARCHIVE_NAME%"
76+
77+
echo Archive created: %FINAL_ARCHIVE%
78+
79+
REM Cleanup
80+
popd
81+
rmdir /s /q "%TEMP_DIR%" 2>nul
82+
83+
echo.
84+
echo Release archive creation complete!
85+
echo Archive: %FINAL_ARCHIVE%
86+
echo.
87+
echo Contents:
88+
powershell -Command "try { $zip = [System.IO.Compression.ZipFile]::OpenRead('%FINAL_ARCHIVE%'); $zip.Entries | Select-Object -First 20 | ForEach-Object { '{0,-10} {1}' -f $_.Length, $_.FullName }; $zip.Dispose() } catch { Write-Host 'Could not list archive contents' }"
89+
90+
echo.
91+
echo To extract: powershell -Command "Expand-Archive -Path '%FINAL_ARCHIVE%' -DestinationPath '.\extracted'"
92+
93+
goto :eof

0 commit comments

Comments
 (0)