|
6 | 6 |
|
7 | 7 | jobs: |
8 | 8 | pypi: |
9 | | - runs-on: ubuntu-latest |
10 | | - steps: |
11 | | - - uses: actions/checkout@v2 |
12 | | - - uses: actions/setup-python@v1 |
13 | | - with: |
14 | | - python-version: 3.9 |
15 | | - - name: Install Python dependencies |
16 | | - run: pip install maturin |
17 | | - - name: Build wheels |
18 | | - run: make wheels |
19 | | - - name: publish |
20 | | - uses: pypa/gh-action-pypi-publish@master |
21 | | - with: |
22 | | - user: __token__ |
23 | | - password: ${{ secrets.PYPI_TOKEN }} |
24 | | - packages_dir: target/wheels/ |
| 9 | + name: PyPI |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + os: [ ubuntu-latest, macos-latest, windows-latest ] |
| 13 | + python-version: [ "3.8", "3.9", "3.10" ] |
| 14 | + runs-on: ${{ matrix.os }} |
25 | 15 |
|
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + - uses: actions/setup-python@v2 |
| 19 | + with: |
| 20 | + python-version: ${{ matrix.python-version }} |
| 21 | + |
| 22 | + # install pip prerequisites |
| 23 | + - name: Install cffi and virtualenv |
| 24 | + run: pip install cffi virtualenv |
| 25 | + |
| 26 | + # install rust toolchoin |
| 27 | + - uses: actions-rs/toolchain@v1 |
| 28 | + id: rustup |
| 29 | + with: |
| 30 | + profile: minimal |
| 31 | + toolchain: stable |
| 32 | + override: true |
| 33 | + |
| 34 | + # setup macOS as in the maturin tests, see: |
| 35 | + # https://github.com/PyO3/maturin/blob/main/.github/workflows/test.yml |
| 36 | + - name: Install aarch64-apple-darwin Rust target |
| 37 | + if: matrix.os == 'macos-latest' |
| 38 | + run: rustup target add aarch64-apple-darwin |
| 39 | + - name: Setup Xcode env |
| 40 | + if: matrix.os == 'macos-latest' |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + sudo xcode-select -s /Applications/Xcode.app |
| 44 | + bindir="$(xcode-select --print-path)/Toolchains/XcodeDefault.xctoolchain/usr/bin" |
| 45 | + echo "CC=${bindir}/clang" >> "${GITHUB_ENV}" |
| 46 | + echo "CXX=${bindir}/clang++" >> "${GITHUB_ENV}" |
| 47 | + echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> "${GITHUB_ENV}" |
| 48 | + |
| 49 | + # setup linux |
| 50 | + - name: Install musl tools |
| 51 | + if: matrix.os == 'ubuntu-latest' |
| 52 | + run: sudo apt-get install -y musl-tools |
| 53 | + |
| 54 | + # build and publish |
| 55 | + - name: Install Python dependencies |
| 56 | + run: pip install maturin |
| 57 | + - name: Build wheels |
| 58 | + run: maturin build --release --strip |
| 59 | + - name: publish |
| 60 | + uses: pypa/gh-action-pypi-publish@master |
| 61 | + with: |
| 62 | + user: __token__ |
| 63 | + password: ${{ secrets.PYPI_TOKEN }} |
| 64 | + packages_dir: target/wheels/ |
0 commit comments