|
| 1 | +name: Publish wheels |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v* |
| 7 | + pull_request: |
| 8 | + paths: |
| 9 | + - 'Cargo.toml' |
| 10 | + - 'pyproject.toml' |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + # This workflow comes from https://github.com/pydantic/pydantic-core/blob/main/.github/workflows/ci.yml |
| 15 | + name: build on ${{ matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux }}) |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - os: windows |
| 21 | + ls: dir |
| 22 | + target: x86_64 |
| 23 | + manylinux: auto |
| 24 | + python-architecture: x64 |
| 25 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 26 | + - os: windows |
| 27 | + ls: dir |
| 28 | + target: i686 |
| 29 | + manylinux: auto |
| 30 | + python-architecture: x86 |
| 31 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 32 | + - os: macos |
| 33 | + target: x86_64 |
| 34 | + manylinux: auto |
| 35 | + python-architecture: x64 |
| 36 | + interpreter: 3.7 3.8 3.9 3.10 3.11 pypy3.7 pypy3.8 pypy3.9 |
| 37 | + - os: macos |
| 38 | + target: aarch64 |
| 39 | + manylinux: auto |
| 40 | + python-architecture: x64 |
| 41 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 42 | + # Build all manylinux targets on 2_24 |
| 43 | + # https://github.com/pypa/manylinux#readme |
| 44 | + # https://github.com/PyO3/maturin-action/blob/135c746/src/index.ts#L33 |
| 45 | + - os: ubuntu |
| 46 | + target: x86_64 |
| 47 | + manylinux: 2_24 |
| 48 | + python-architecture: x64 |
| 49 | + interpreter: 3.7 3.8 3.9 3.10 3.11 pypy3.7 pypy3.8 pypy3.9 |
| 50 | + - os: ubuntu |
| 51 | + target: aarch64 |
| 52 | + manylinux: 2_24 |
| 53 | + python-architecture: x64 |
| 54 | + interpreter: 3.7 3.8 3.9 3.10 3.11 pypy3.7 pypy3.8 pypy3.9 |
| 55 | + - os: ubuntu |
| 56 | + target: i686 |
| 57 | + manylinux: 2_24 |
| 58 | + python-architecture: x64 |
| 59 | + interpreter: 3.7 3.8 3.9 3.10 3.11 pypy3.7 pypy3.8 pypy3.9 |
| 60 | + - os: ubuntu |
| 61 | + target: armv7 |
| 62 | + manylinux: 2_24 |
| 63 | + python-architecture: x64 |
| 64 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 65 | + - os: ubuntu |
| 66 | + target: ppc64le |
| 67 | + manylinux: 2_24 |
| 68 | + python-architecture: x64 |
| 69 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 70 | + - os: ubuntu |
| 71 | + target: s390x |
| 72 | + manylinux: 2_24 |
| 73 | + python-architecture: x64 |
| 74 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 75 | + # musllinux - https://musl.libc.org/about.html |
| 76 | + - os: ubuntu |
| 77 | + target: x86_64 |
| 78 | + manylinux: musllinux_1_1 # /!\ value used in steps conditions below. |
| 79 | + python-architecture: x64 |
| 80 | + interpreter: 3.7 3.8 3.9 3.10 3.11 pypy3.7 pypy3.8 pypy3.9 |
| 81 | + - os: ubuntu |
| 82 | + target: aarch64 |
| 83 | + manylinux: musllinux_1_1 |
| 84 | + python-architecture: x64 |
| 85 | + interpreter: 3.7 3.8 3.9 3.10 3.11 pypy3.7 pypy3.8 pypy3.9 |
| 86 | + |
| 87 | + runs-on: ${{ matrix.os }}-latest |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v3 |
| 90 | + |
| 91 | + - name: set up python |
| 92 | + uses: actions/setup-python@v4 |
| 93 | + with: |
| 94 | + python-version: '3.11' |
| 95 | + architecture: ${{ matrix.python-architecture }} |
| 96 | + |
| 97 | + - run: pip install -U twine |
| 98 | + |
| 99 | + - name: build sdist |
| 100 | + if: ${{ matrix.os == 'ubuntu' && matrix.target == 'x86_64' && matrix.manylinux != 'musllinux_1_1' }} |
| 101 | + uses: messense/maturin-action@v1 |
| 102 | + with: |
| 103 | + command: sdist |
| 104 | + args: --out dist/ |
| 105 | + rust-toolchain: stable |
| 106 | + |
| 107 | + - name: build wheels |
| 108 | + uses: messense/maturin-action@v1 |
| 109 | + with: |
| 110 | + target: ${{ matrix.target }} |
| 111 | + manylinux: ${{ matrix.manylinux }} |
| 112 | + args: --release --out dist/ --interpreter ${{ matrix.interpreter }} |
| 113 | + rust-toolchain: stable |
| 114 | + |
| 115 | + - run: ${{ matrix.ls || 'ls -lh' }} dist/ |
| 116 | + |
| 117 | + - run: twine check --strict dist/* |
| 118 | + |
| 119 | + - name: install built wheel |
| 120 | + if: ${{ matrix.os == 'ubuntu' && matrix.target == 'x86_64' && matrix.manylinux != 'musllinux_1_1' }} |
| 121 | + run: | |
| 122 | + pip install canonicaljson-rs --no-index --find-links dist/ --force-reinstall |
| 123 | + python -c "import canonicaljson" |
| 124 | +
|
| 125 | + - uses: actions/upload-artifact@v3 |
| 126 | + with: |
| 127 | + name: pypi_files |
| 128 | + path: dist/ |
0 commit comments