bump #20
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: Test Python Bindings | |
| on: | |
| pull_request: | |
| paths: | |
| - 'crates/**' | |
| - 'Cargo.toml' | |
| - 'pyproject.toml' | |
| - '.github/workflows/test-python-bindings.yml' | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'crates/**' | |
| - 'Cargo.toml' | |
| - 'pyproject.toml' | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ['3.10', '3.14'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| allow-prereleases: true | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: py${{ matrix.python-version }} | |
| - name: Create virtual environment | |
| shell: bash | |
| run: python -m venv .venv | |
| - name: Install maturin and build (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| source .venv/bin/activate | |
| pip install maturin | |
| maturin develop --release | |
| - name: Install maturin and build (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| source .venv/Scripts/activate | |
| pip install maturin | |
| maturin develop --release | |
| - name: Test import and functionality (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| source .venv/bin/activate | |
| python -c " | |
| import ofd_validator | |
| # Test types | |
| r = ofd_validator.ValidationResult() | |
| assert r.is_valid == True | |
| assert r.error_count == 0 | |
| assert r.warning_count == 0 | |
| # Test error creation | |
| e = ofd_validator.ValidationError(ofd_validator.ValidationLevel.Error, 'Test', 'test msg', '/path') | |
| r.add_error(e) | |
| assert r.error_count == 1 | |
| assert r.is_valid == False | |
| # Test to_dict | |
| d = r.to_dict() | |
| assert d['error_count'] == 1 | |
| assert d['is_valid'] == False | |
| # Test all functions exist | |
| assert callable(ofd_validator.validate_all) | |
| assert callable(ofd_validator.validate_json_files) | |
| assert callable(ofd_validator.validate_logo_files) | |
| assert callable(ofd_validator.validate_folder_names) | |
| assert callable(ofd_validator.validate_store_ids) | |
| assert callable(ofd_validator.validate_gtin_ean) | |
| assert callable(ofd_validator.validate_required_files) | |
| assert callable(ofd_validator.validate_logo_file) | |
| assert callable(ofd_validator.validate_folder_name) | |
| print('All tests passed') | |
| " | |
| - name: Test import and functionality (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| source .venv/Scripts/activate | |
| python -c " | |
| import ofd_validator | |
| # Test types | |
| r = ofd_validator.ValidationResult() | |
| assert r.is_valid == True | |
| assert r.error_count == 0 | |
| assert r.warning_count == 0 | |
| # Test error creation | |
| e = ofd_validator.ValidationError(ofd_validator.ValidationLevel.Error, 'Test', 'test msg', '/path') | |
| r.add_error(e) | |
| assert r.error_count == 1 | |
| assert r.is_valid == False | |
| # Test to_dict | |
| d = r.to_dict() | |
| assert d['error_count'] == 1 | |
| assert d['is_valid'] == False | |
| # Test all functions exist | |
| assert callable(ofd_validator.validate_all) | |
| assert callable(ofd_validator.validate_json_files) | |
| assert callable(ofd_validator.validate_logo_files) | |
| assert callable(ofd_validator.validate_folder_names) | |
| assert callable(ofd_validator.validate_store_ids) | |
| assert callable(ofd_validator.validate_gtin_ean) | |
| assert callable(ofd_validator.validate_required_files) | |
| assert callable(ofd_validator.validate_logo_file) | |
| assert callable(ofd_validator.validate_folder_name) | |
| print('All tests passed') | |
| " |