Workflow and pack script #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| embree_url: https://github.com/embree/embree/releases/download/v4.3.3/embree-4.3.3.x64.windows.zip | |
| embree_dir: embree-4.3.3.x64.windows | |
| - os: macos-latest | |
| embree_url: https://github.com/embree/embree/releases/download/v4.3.3/embree-4.3.3.x86_64.macosx.zip | |
| embree_dir: embree-4.3.3.x86_64.macosx | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install embree | |
| - name: Install OIDN (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| # Download and extract OIDN for macOS (v2.3.3 from RenderKit) | |
| # GitHub macOS runners are Intel-based (x86_64), so we need x86_64 version | |
| echo "Downloading OIDN..." | |
| wget -O oidn.tar.gz https://github.com/RenderKit/oidn/releases/download/v2.3.3/oidn-2.3.3.x86_64.macos.tar.gz || wget -O oidn.tar.gz https://github.com/RenderKit/oidn/releases/download/v2.3.3/oidn-2.3.3.arm64.macos.tar.gz | |
| echo "Extracting OIDN..." | |
| mkdir -p oidn_temp && tar -xzf oidn.tar.gz -C oidn_temp | |
| echo "OIDN extraction contents:" | |
| find oidn_temp -type f -name "*.dylib" | head -10 | |
| echo "Moving OIDN files..." | |
| # Try different extraction structures | |
| if [ -d "oidn_temp/lib" ]; then | |
| cp -r oidn_temp/* thirdparty/oidn/ | |
| elif [ -d "oidn_temp/oidn-2.3.3.x86_64.macos" ]; then | |
| cp -r oidn_temp/oidn-2.3.3.x86_64.macos/* thirdparty/oidn/ | |
| elif [ -d "oidn_temp/oidn-2.3.3.arm64.macos" ]; then | |
| cp -r oidn_temp/oidn-2.3.3.arm64.macos/* thirdparty/oidn/ | |
| else | |
| echo "Unknown OIDN extraction structure, copying everything" | |
| cp -r oidn_temp/* thirdparty/oidn/ 2>/dev/null || true | |
| fi | |
| - name: Install dependencies (Windows) | |
| if: runner.os == 'Windows' | |
| shell: powershell | |
| run: | | |
| # Download and extract Embree | |
| Invoke-WebRequest -Uri "${{ matrix.embree_url }}" -OutFile "embree.zip" | |
| Expand-Archive -Path "embree.zip" -DestinationPath "." | |
| $embreePath = "${{ matrix.embree_dir }}" | |
| # Add to PATH for CMake to find it | |
| echo "$PWD/$embreePath/bin" | Out-File -FilePath $env:GITHUB_PATH -Append | |
| echo "EMBREE_LOCATION=$PWD/$embreePath" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| # Download and extract OIDN for Windows (v2.3.3 from RenderKit) | |
| Invoke-WebRequest -Uri "https://github.com/RenderKit/oidn/releases/download/v2.3.3/oidn-2.3.3.x64.windows.zip" -OutFile "oidn.zip" | |
| Expand-Archive -Path "oidn.zip" -DestinationPath "." | |
| Get-ChildItem -Path "." -Name | |
| # Try different extraction structures | |
| if (Test-Path "oidn-2.3.3.x64.windows") { | |
| Move-Item -Path "oidn-2.3.3.x64.windows/*" -Destination "thirdparty/oidn/" -Force | |
| } else { | |
| # Copy whatever was extracted | |
| Get-ChildItem -Path "." | Where-Object { $_.Name -notlike "*.zip" -and $_.Name -notlike "embree*" } | ForEach-Object { | |
| Copy-Item -Path $_.FullName -Destination "thirdparty/oidn/" -Recurse -Force | |
| } | |
| } | |
| - name: Verify OIDN installation | |
| run: | | |
| echo "Checking OIDN installation..." | |
| ls -la thirdparty/oidn/ | |
| if [ -d "thirdparty/oidn/lib" ]; then | |
| echo "OIDN lib directory found" | |
| ls -la thirdparty/oidn/lib/ | |
| else | |
| echo "OIDN lib directory NOT found!" | |
| exit 1 | |
| fi | |
| if [ -d "thirdparty/oidn/include" ]; then | |
| echo "OIDN include directory found" | |
| else | |
| echo "OIDN include directory NOT found!" | |
| exit 1 | |
| fi | |
| - name: Configure CMake | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: | | |
| cd build | |
| cmake --build . --config Release --parallel | |
| - name: Build raytracer executable | |
| run: | | |
| cd build | |
| cmake --build . --config Release --target raytracer | |
| - name: Verify build artifacts (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| cd build | |
| if [ ! -f "bin/raytracer" ]; then | |
| echo "raytracer executable not found" | |
| exit 1 | |
| fi | |
| # Verify the executable is not corrupted | |
| file bin/raytracer | |
| - name: Verify build artifacts (Windows) | |
| if: runner.os == 'Windows' | |
| shell: powershell | |
| run: | | |
| cd build | |
| if (!(Test-Path "bin/raytracer.exe")) { | |
| throw "raytracer.exe not found" | |
| } |