v0.1.3 #17
Workflow file for this run
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
| # CI/CD workflow for vjson (PyO3/Maturin) | |
| # - Runs tests on PRs and pushes to main | |
| # - Builds and publishes wheels on release creation | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # ============================================================ | |
| # Test (Rust + Python) | |
| # ============================================================ | |
| test: | |
| name: Test - ${{ matrix.os }} - Python ${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.9", "3.12"] | |
| 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 toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Run Rust tests | |
| run: cargo test --all-features | |
| - name: Install dependencies | |
| run: pip install maturin pytest numpy | |
| - name: Build wheel | |
| run: maturin build --release --out dist | |
| - name: Install package | |
| shell: bash | |
| run: pip install --force-reinstall dist/*.whl | |
| - name: Run tests | |
| run: pytest tests/ -v --ignore=tests/test_simple.py | |
| # ============================================================ | |
| # Build wheels for Linux | |
| # ============================================================ | |
| linux: | |
| name: Linux - ${{ matrix.target }} | |
| needs: [test] | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: [x86_64, aarch64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: --release --out dist --find-interpreter | |
| manylinux: auto | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-linux-${{ matrix.target }} | |
| path: dist | |
| # ============================================================ | |
| # Build wheels for Windows | |
| # ============================================================ | |
| windows: | |
| name: Windows - ${{ matrix.target }} | |
| needs: [test] | |
| if: github.event_name == 'release' | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| target: [x64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: --release --out dist --find-interpreter | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-windows-${{ matrix.target }} | |
| path: dist | |
| # ============================================================ | |
| # Build wheels for macOS | |
| # ============================================================ | |
| macos: | |
| name: macOS - ${{ matrix.target }} | |
| needs: [test] | |
| if: github.event_name == 'release' | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| target: [x86_64, aarch64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: --release --out dist --find-interpreter | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-macos-${{ matrix.target }} | |
| path: dist | |
| # ============================================================ | |
| # Build source distribution | |
| # ============================================================ | |
| sdist: | |
| name: Source Distribution | |
| needs: [test] | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-sdist | |
| path: dist | |
| # ============================================================ | |
| # Publish to PyPI | |
| # ============================================================ | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: [linux, windows, macos, sdist] | |
| if: github.event_name == 'release' | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| merge-multiple: true | |
| path: dist | |
| - name: List packages | |
| run: ls -lhR dist/ | |
| - name: Publish to PyPI | |
| uses: PyO3/maturin-action@v1 | |
| env: | |
| MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
| with: | |
| command: upload | |
| args: --non-interactive --skip-existing dist/* |