donot_know #50
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 & Django Packages | |
| on: | |
| push: | |
| branches: [main, master, develop] | |
| pull_request: | |
| branches: [main, master, develop] | |
| env: | |
| PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1 | |
| jobs: | |
| # Test Python package | |
| test-python: | |
| name: 🐍 Test Python (${{ matrix.python-version }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install maturin | |
| run: pip install maturin pytest | |
| - name: Build and install Python package | |
| shell: bash | |
| run: | | |
| cd bindings/python | |
| maturin build --out dist | |
| pip install dist/*.whl | |
| - name: Run tests | |
| run: | | |
| cd bindings/python | |
| pytest test_npdatetime.py -v | |
| continue-on-error: true | |
| # Test Django package | |
| test-django: | |
| name: 🎯 Django (Py${{ matrix.python-version }}, Django${{ matrix.django-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| django-version: ["3.2", "4.2", "5.0", "5.1", "5.2", "6.0", "6.0.2"] | |
| exclude: | |
| # Django 5.x requires Python 3.10+ | |
| - python-version: "3.8" | |
| django-version: "5.0" | |
| - python-version: "3.8" | |
| django-version: "5.1" | |
| - python-version: "3.8" | |
| django-version: "5.2" | |
| - python-version: "3.9" | |
| django-version: "5.0" | |
| - python-version: "3.9" | |
| django-version: "5.1" | |
| - python-version: "3.9" | |
| django-version: "5.2" | |
| # Django 6.x requires Python 3.12+ | |
| - python-version: "3.8" | |
| django-version: "6.0" | |
| - python-version: "3.8" | |
| django-version: "6.0.2" | |
| - python-version: "3.9" | |
| django-version: "6.0" | |
| - python-version: "3.9" | |
| django-version: "6.0.2" | |
| - python-version: "3.10" | |
| django-version: "6.0" | |
| - python-version: "3.10" | |
| django-version: "6.0.2" | |
| - python-version: "3.11" | |
| django-version: "6.0" | |
| - python-version: "3.11" | |
| django-version: "6.0.2" | |
| # Django 3.2 doesn't support Python 3.11+ | |
| - python-version: "3.11" | |
| django-version: "3.2" | |
| - python-version: "3.12" | |
| django-version: "3.2" | |
| - python-version: "3.13" | |
| django-version: "3.2" | |
| - python-version: "3.14" | |
| django-version: "3.2" | |
| # Django 4.2 doesn't support Python 3.14 (experimental/prerelease) | |
| - python-version: "3.14" | |
| django-version: "4.2" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Rust and build WASM | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install wasm-pack and maturin | |
| run: | | |
| curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
| pip install maturin | |
| - name: Build WASM bindings | |
| run: | | |
| cd bindings/javascript | |
| wasm-pack build --target web | |
| - name: Sync assets to Django | |
| run: | | |
| cd bindings/django | |
| python3 build_assets.py || python build_assets.py | |
| - name: Install Django and package | |
| shell: bash | |
| run: | | |
| pip install Django==${{ matrix.django-version }} | |
| # Build and install core npdatetime from local source | |
| cd bindings/python | |
| maturin build --out dist | |
| pip install dist/*.whl | |
| cd ../.. | |
| # Install django package | |
| cd bindings/django | |
| pip install . | |
| - name: Run Django checks | |
| run: | | |
| cd bindings/django | |
| python -c "import npdatetime_django; print('✓ Package imported successfully')" | |
| python -c "from npdatetime_django import NepaliDateField; print('✓ Model fields imported')" | |
| python -c "from npdatetime_django.widgets import NepaliDatePickerWidget; print('✓ Widgets imported')" | |
| python -c "from npdatetime_django.templatetags import nepali_date; print('✓ Template tags imported')" |