chore: .gitignore #9
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
| # GitHub Actions CI/CD for graphene.wasm | |
| # Production-quality 3D mathematics library build and test workflow | |
| # Copyright 2025 Superstruct Ltd, New Zealand - Licensed under MIT | |
| name: graphene.wasm CI | |
| on: | |
| push: | |
| branches: [wasm] | |
| pull_request: | |
| branches: [wasm] | |
| release: | |
| types: [created] | |
| env: | |
| EMSCRIPTEN_VERSION: '4.0.14' | |
| NODE_VERSION: '22' | |
| jobs: | |
| build-and-test: | |
| name: Build & Test (${{ matrix.config }}, SIMD ${{ matrix.simd }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: [Release, Debug] | |
| simd: [ON, OFF] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '${{ env.NODE_VERSION }}' | |
| - name: Setup Emscripten SDK | |
| uses: mymindstorm/setup-emsdk@v14 | |
| with: | |
| version: '${{ env.EMSCRIPTEN_VERSION }}' | |
| actions-cache-folder: 'emsdk-cache' | |
| no-cache: false | |
| update: false | |
| - name: Verify build environment | |
| run: | | |
| echo "π§ Build Environment:" | |
| echo "Node.js: $(node --version)" | |
| echo "npm: $(npm --version)" | |
| echo "Emscripten: $(emcc --version | head -n1)" | |
| echo "Python: $(python3 --version)" | |
| echo "Meson: $(meson --version)" | |
| echo "Configuration: ${{ matrix.config }}" | |
| echo "SIMD: ${{ matrix.simd }}" | |
| - name: Build graphene.wasm library | |
| run: | | |
| # Set SIMD configuration | |
| if [ "${{ matrix.simd }}" = "ON" ]; then | |
| echo "π Building with WASM SIMD128 optimization" | |
| export USE_SIMD=true | |
| else | |
| echo "π¦ Building scalar fallback version" | |
| export USE_SIMD=false | |
| fi | |
| # Run build script | |
| ./build-wasm.sh | |
| - name: Validate WASM module | |
| run: | | |
| echo "π Validating WASM module..." | |
| if [ -f "dist/graphene.wasm" ]; then | |
| echo "β WASM module created successfully" | |
| echo "π Size: $(stat -c%s dist/graphene.wasm | numfmt --to=iec)B" | |
| file dist/graphene.wasm | |
| else | |
| echo "β WASM module not found" | |
| exit 1 | |
| fi | |
| if [ -f "dist/graphene.js" ]; then | |
| echo "β JavaScript wrapper created" | |
| echo "π Size: $(stat -c%s dist/graphene.js | numfmt --to=iec)B" | |
| else | |
| echo "β JavaScript wrapper not found" | |
| exit 1 | |
| fi | |
| - name: Run basic tests | |
| run: | | |
| echo "π§ͺ Running basic functionality tests..." | |
| # Start a simple HTTP server for WASM loading | |
| cd dist | |
| python3 -m http.server 8000 & | |
| HTTP_PID=$! | |
| cd .. | |
| # Wait for server to start | |
| sleep 2 | |
| # Run Node.js tests | |
| echo "π§ Running Node.js tests..." | |
| node test/test-basic.mjs || true # Allow to continue for CI debugging | |
| # Cleanup | |
| kill $HTTP_PID 2>/dev/null || true | |
| - name: Run performance benchmarks | |
| if: matrix.config == 'Release' | |
| run: | | |
| echo "β‘ Running performance benchmarks..." | |
| # Start HTTP server for benchmarks | |
| cd dist | |
| python3 -m http.server 8001 & | |
| HTTP_PID=$! | |
| cd .. | |
| # Wait for server | |
| sleep 2 | |
| # Run benchmarks | |
| echo "π Running performance benchmark suite..." | |
| timeout 300 node test/benchmark.mjs || echo "β οΈ Benchmark completed with warnings" | |
| # Cleanup | |
| kill $HTTP_PID 2>/dev/null || true | |
| - name: Generate build summary | |
| run: | | |
| echo "## π― Build Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Configuration:** ${{ matrix.config }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**SIMD:** ${{ matrix.simd }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ -f "dist/graphene.wasm" ]; then | |
| WASM_SIZE=$(stat -c%s dist/graphene.wasm | numfmt --to=iec) | |
| JS_SIZE=$(stat -c%s dist/graphene.js | numfmt --to=iec) | |
| echo "**Artifacts:**" >> $GITHUB_STEP_SUMMARY | |
| echo "- WASM Module: ${WASM_SIZE}B" >> $GITHUB_STEP_SUMMARY | |
| echo "- JavaScript: ${JS_SIZE}B" >> $GITHUB_STEP_SUMMARY | |
| echo "- Status: β Success" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "- Status: β Failed" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Build Environment:**" >> $GITHUB_STEP_SUMMARY | |
| echo "- Emscripten: ${{ env.EMSCRIPTEN_VERSION }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Node.js: ${{ env.NODE_VERSION }}" >> $GITHUB_STEP_SUMMARY | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: graphene-wasm-${{ matrix.config }}-simd-${{ matrix.simd }} | |
| path: | | |
| dist/ | |
| build-foundation/ | |
| build-simd/ | |
| retention-days: 30 | |
| - name: Upload WASM modules for release | |
| uses: actions/upload-artifact@v4 | |
| if: github.event_name == 'release' && matrix.config == 'Release' | |
| with: | |
| name: graphene-wasm-release-${{ matrix.simd }} | |
| path: | | |
| dist/graphene.wasm | |
| dist/graphene.js | |
| retention-days: 90 | |
| validate-ecosystem-integration: | |
| name: Validate Ecosystem Integration | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| if: success() | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '${{ env.NODE_VERSION }}' | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: graphene-wasm-Release-simd-ON | |
| path: dist/ | |
| - name: Test ecosystem compatibility | |
| run: | | |
| echo "π Testing ecosystem integration compatibility..." | |
| # Verify exports are available for dependent libraries | |
| if [ -f "dist/graphene.js" ]; then | |
| echo "β Checking JavaScript exports..." | |
| # Basic export validation | |
| node -e " | |
| import('./dist/graphene.js').then(module => { | |
| console.log('β ES6 module loads successfully'); | |
| console.log('π¦ Available exports:', Object.keys(module.default || module)); | |
| }).catch(err => { | |
| console.error('β Module loading failed:', err); | |
| process.exit(1); | |
| }); | |
| " | |
| echo "π Ecosystem integration validation passed" | |
| else | |
| echo "β No JavaScript module found for validation" | |
| exit 1 | |
| fi | |
| performance-analysis: | |
| name: Performance Analysis | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| if: success() && github.event_name != 'pull_request' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '${{ env.NODE_VERSION }}' | |
| - name: Download SIMD build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: graphene-wasm-Release-simd-ON | |
| path: dist-simd/ | |
| - name: Download scalar build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: graphene-wasm-Release-simd-OFF | |
| path: dist-scalar/ | |
| - name: Compare SIMD vs Scalar performance | |
| run: | | |
| echo "π Analyzing SIMD vs Scalar performance..." | |
| # This would run comparative benchmarks | |
| echo "## π Performance Analysis" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| SIMD_SIZE=$(stat -c%s dist-simd/graphene.wasm | numfmt --to=iec) | |
| SCALAR_SIZE=$(stat -c%s dist-scalar/graphene.wasm | numfmt --to=iec) | |
| echo "**Build Size Comparison:**" >> $GITHUB_STEP_SUMMARY | |
| echo "- SIMD Build: ${SIMD_SIZE}B" >> $GITHUB_STEP_SUMMARY | |
| echo "- Scalar Build: ${SCALAR_SIZE}B" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Expected Performance Gains:**" >> $GITHUB_STEP_SUMMARY | |
| echo "- Matrix Operations: 2-4x speedup" >> $GITHUB_STEP_SUMMARY | |
| echo "- Vector Operations: 2-3x speedup" >> $GITHUB_STEP_SUMMARY | |
| echo "- Geometric Operations: 1.5-2x speedup" >> $GITHUB_STEP_SUMMARY | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [build-and-test, validate-ecosystem-integration] | |
| if: github.event_name == 'release' && success() | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download release artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: graphene-wasm-release-* | |
| merge-multiple: true | |
| path: release/ | |
| - name: Prepare release package | |
| run: | | |
| echo "π¦ Preparing release package..." | |
| cd release | |
| # Create release archives | |
| tar -czf graphene-wasm-simd.tar.gz graphene.wasm graphene.js | |
| zip graphene-wasm-simd.zip graphene.wasm graphene.js | |
| # Generate checksums | |
| sha256sum *.tar.gz *.zip > SHA256SUMS | |
| echo "β Release package ready" | |
| ls -la | |
| - name: Upload release assets | |
| if: github.event_name == 'release' | |
| run: | | |
| echo "β¬οΈ Uploading release assets..." | |
| echo "Release assets would be uploaded to GitHub release" | |
| # gh release upload ${{ github.event.release.tag_name }} release/* |