Reintroduce PYHELIOS_DEV_MODE in workflows for quick test runs
#8
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: Cross-Platform Test Matrix | |
| on: | |
| push: | |
| branches: [ "master", "main" ] | |
| pull_request: | |
| branches: [ "master", "main" ] | |
| jobs: | |
| test-matrix: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.8", "3.11", "3.12"] | |
| name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
| 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 dependencies using Helios script (Linux/macOS) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cd helios-core | |
| chmod +x utilities/dependencies.sh | |
| # Install BASE dependencies (GCC, G++, CMake) for matrix testing | |
| bash utilities/dependencies.sh BASE | |
| - name: Set up MSVC (Windows) | |
| if: matrix.os == 'windows-latest' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-cov pytest-xdist | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Verify PyHelios installation and platform detection | |
| run: | | |
| python -c "import pyhelios; print(f'PyHelios imported successfully on {pyhelios.__name__}')" | |
| python -c "from pyhelios.plugins import print_plugin_status; print_plugin_status()" | |
| - name: Run cross-platform tests (should work on all platforms) | |
| run: | | |
| pytest tests/ -v -m "cross_platform" --tb=short | |
| - name: Run unit tests | |
| run: | | |
| pytest tests/ -v -m "unit" --tb=short | |
| - name: Run DataTypes tests (critical for cross-platform compatibility) | |
| run: | | |
| pytest tests/test_datatypes.py -v --tb=short | |
| - name: Run full test suite (expect skips for native tests) | |
| run: | | |
| pytest tests/ -v --tb=short | |
| - name: Test PyHelios examples (if they exist) | |
| continue-on-error: true | |
| run: | | |
| if [ -f "docs/examples/context_sample.py" ]; then | |
| python docs/examples/context_sample.py | |
| fi | |
| shell: bash | |
| - name: Test platform-specific markers | |
| run: | | |
| # Test that platform-specific tests work correctly | |
| python -c " | |
| import platform | |
| import subprocess | |
| import sys | |
| system = platform.system() | |
| if system == 'Windows': | |
| result = subprocess.run([sys.executable, '-m', 'pytest', 'tests/', '-m', 'windows_only', '-v'], capture_output=True, text=True) | |
| elif system == 'Darwin': # macOS | |
| result = subprocess.run([sys.executable, '-m', 'pytest', 'tests/', '-m', 'macos_only', '-v'], capture_output=True, text=True) | |
| elif system == 'Linux': | |
| result = subprocess.run([sys.executable, '-m', 'pytest', 'tests/', '-m', 'linux_only', '-v'], capture_output=True, text=True) | |
| print(f'Platform-specific test result: {result.returncode}') | |
| print(result.stdout) | |
| if result.stderr: | |
| print('STDERR:', result.stderr) | |
| " | |
| test-documentation: | |
| runs-on: ubuntu-latest | |
| name: Test Documentation and Linting | |
| 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 | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest flake8 black isort mypy | |
| pip install -e . | |
| - name: Lint with flake8 | |
| continue-on-error: true | |
| run: | | |
| # stop the build if there are Python syntax errors or undefined names | |
| flake8 pyhelios/ --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| flake8 pyhelios/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Check code formatting with black | |
| continue-on-error: true | |
| run: | | |
| black --check --diff pyhelios/ | |
| - name: Check import sorting with isort | |
| continue-on-error: true | |
| run: | | |
| isort --check-only --diff pyhelios/ | |
| - name: Type checking with mypy | |
| continue-on-error: true | |
| run: | | |
| mypy pyhelios/ --ignore-missing-imports | |
| - name: Validate test configuration | |
| run: | | |
| # Check that pytest configuration is valid | |
| pytest --collect-only tests/ | |
| # Verify all test markers are registered | |
| python -c " | |
| import configparser | |
| config = configparser.ConfigParser() | |
| config.read('pytest.ini') | |
| markers = config.get('pytest', 'markers').strip().split('\n') | |
| print(f'Found {len(markers)} registered test markers:') | |
| for marker in markers: | |
| if marker.strip(): | |
| print(f' - {marker.strip()}') | |
| " | |
| - name: Check CLAUDE.md is up to date | |
| run: | | |
| # Verify that CLAUDE.md contains expected content | |
| python -c " | |
| with open('CLAUDE.md', 'r') as f: | |
| content = f.read() | |
| expected_sections = [ | |
| 'Cross-Platform Library Loading', | |
| 'test_cross_platform.py', | |
| '@pytest.mark.cross_platform', | |
| '@pytest.mark.mock_mode', | |
| 'Mock Mode Development' | |
| ] | |
| for section in expected_sections: | |
| if section not in content: | |
| print(f'ERROR: CLAUDE.md missing expected section: {section}') | |
| exit(1) | |
| else: | |
| print(f'✓ Found section: {section}') | |
| print('✓ CLAUDE.md appears to be up to date') | |
| " | |
| test-build-scripts: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| name: Test Build Scripts 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 BASE dependencies for build script testing | |
| bash utilities/dependencies.sh BASE | |
| - name: Set up MSVC (Windows) | |
| if: matrix.os == 'windows-latest' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| - name: Test build script syntax | |
| run: | | |
| python -c "import py_compile; py_compile.compile('build_scripts/build_helios.py', doraise=True)" | |
| python build_scripts/build_helios.py --help | |
| - name: Test build script (dry run) | |
| continue-on-error: true | |
| run: | | |
| # Test that the build script can at least start (it may fail due to missing dependencies) | |
| python build_scripts/build_helios.py --dry-run || echo "Build script dry run completed (expected to fail without full dependencies)" |