Add PYHELIOS_DEV_MODE environment variable to all GitHub Actions work… #5
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: Required Tests for Main Branch | |
| on: | |
| pull_request: | |
| branches: [ "master", "main" ] | |
| push: | |
| branches: [ "master", "main" ] | |
| jobs: | |
| # Cross-platform compatibility is always required | |
| cross-platform-tests: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true # Fail fast for required tests | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.11"] | |
| name: Required Cross-Platform Tests on ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest | |
| pip install -e . | |
| - name: Verify PyHelios installation | |
| env: | |
| PYHELIOS_DEV_MODE: 1 | |
| run: | | |
| python -c "import pyhelios; print(f'✓ PyHelios imported successfully')" | |
| python -c "from pyhelios.plugins import print_plugin_status; print_plugin_status()" | |
| - name: Run essential cross-platform tests | |
| env: | |
| PYHELIOS_DEV_MODE: 1 | |
| run: | | |
| pytest tests/test_datatypes.py -v --tb=short | |
| pytest tests/test_cross_platform.py -v -m "cross_platform" --tb=short | |
| - name: Test core functionality in mock mode | |
| env: | |
| PYHELIOS_DEV_MODE: 1 | |
| run: | | |
| python -c " | |
| from pyhelios import Context, DataTypes | |
| from pyhelios.plugins import get_plugin_info | |
| # Verify we start in mock mode (expected) | |
| info = get_plugin_info() | |
| print(f'Platform: {info[\"platform\"]}') | |
| print(f'Mock mode: {info[\"is_mock\"]}') | |
| # Test basic Context creation | |
| try: | |
| ctx = Context() | |
| print('✓ Context created successfully') | |
| # Test DataTypes | |
| v = DataTypes.vec3(1.0, 2.0, 3.0) | |
| print(f'✓ Vec3 created: ({v.x}, {v.y}, {v.z})') | |
| c = DataTypes.RGBcolor(0.5, 0.7, 0.2) | |
| print(f'✓ RGBcolor created: ({c.r}, {c.g}, {c.b})') | |
| print('✓ All essential functionality verified') | |
| except Exception as e: | |
| print(f'ERROR: Essential functionality failed: {e}') | |
| exit(1) | |
| " | |
| # Native library capability is required for main branch | |
| native-library-capability: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false # Allow some platforms to fail, but require at least one success | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| name: Native Library Capability Check on ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies using Helios script (Linux/macOS) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cd helios-core | |
| chmod +x utilities/dependencies.sh | |
| # Install VIS dependencies (includes base + OpenGL/X11 for visualization) | |
| bash utilities/dependencies.sh VIS | |
| - name: Set up MSVC (Windows) | |
| if: matrix.os == 'windows-latest' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Install basic dependencies (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| echo "Windows dependencies: Visual Studio (MSVC) is already configured" | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest | |
| pip install -e . | |
| - name: Build native Helios libraries | |
| id: build | |
| run: | | |
| echo "Building native libraries for ${{ matrix.os }}..." | |
| python build_scripts/build_helios.py --verbose | |
| echo "build_success=true" >> $GITHUB_OUTPUT | |
| - name: Test native library functionality | |
| run: | | |
| python -c " | |
| from pyhelios.plugins import get_plugin_info | |
| info = get_plugin_info() | |
| print(f'Platform: {info[\"platform\"]}') | |
| print(f'Mock mode: {info[\"is_mock\"]}') | |
| print(f'Native available: {info[\"native_available\"]}') | |
| if info['is_mock']: | |
| print('ERROR: Native libraries should be available after build') | |
| exit(1) | |
| else: | |
| print('✓ Native libraries loaded successfully') | |
| " | |
| - name: Upload build artifacts on success | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: native-libraries-${{ matrix.os }}-required | |
| path: | | |
| pyhelios/plugins/*.dll | |
| pyhelios/plugins/*.so | |
| pyhelios/plugins/*.dylib | |
| retention-days: 7 | |
| # Require at least one platform to successfully build native libraries | |
| native-capability-summary: | |
| needs: native-library-capability | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Check native capability results | |
| run: | | |
| echo "Checking native library capability results..." | |
| # Check if at least one platform succeeded | |
| if [[ "${{ needs.native-library-capability.result }}" == "success" ]]; then | |
| echo "✅ Native library capability verified on at least one platform" | |
| echo "PyHelios maintains the ability to build and use native libraries" | |
| else | |
| echo "❌ Native library capability check failed on all platforms" | |
| echo "This indicates a regression in native library integration" | |
| exit 1 | |
| fi | |
| # Final summary | |
| required-tests-summary: | |
| needs: [cross-platform-tests, native-capability-summary] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Final status check | |
| run: | | |
| echo "## Required Tests Summary" >> $GITHUB_STEP_SUMMARY | |
| if [[ "${{ needs.cross-platform-tests.result }}" == "success" && "${{ needs.native-capability-summary.result }}" == "success" ]]; then | |
| echo "✅ All required tests passed" >> $GITHUB_STEP_SUMMARY | |
| echo "- Cross-platform compatibility verified" >> $GITHUB_STEP_SUMMARY | |
| echo "- Native library capability maintained" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Safe to merge to main branch." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "❌ Required tests failed" >> $GITHUB_STEP_SUMMARY | |
| echo "- Cross-platform tests: ${{ needs.cross-platform-tests.result }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Native capability: ${{ needs.native-capability-summary.result }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Cannot merge until all required tests pass." >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi |