|
| 1 | +# |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +# or more contributor license agreements. See the NOTICE file |
| 4 | +# distributed with this work for additional information |
| 5 | +# regarding copyright ownership. The ASF licenses this file |
| 6 | +# to you under the Apache License, Version 2.0 (the |
| 7 | +# "License"); you may not use this file except in compliance |
| 8 | +# with the License. You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, |
| 13 | +# software distributed under the License is distributed on an |
| 14 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +# KIND, either express or implied. See the License for the |
| 16 | +# specific language governing permissions and limitations |
| 17 | +# under the License. |
| 18 | +# |
| 19 | + |
| 20 | +name: "Python Release" |
| 21 | + |
| 22 | +on: |
| 23 | + workflow_dispatch: |
| 24 | + inputs: |
| 25 | + version: |
| 26 | + description: 'Version' |
| 27 | + type: string |
| 28 | + default: 'master' |
| 29 | + |
| 30 | + |
| 31 | +jobs: |
| 32 | + build_wheels: |
| 33 | + name: Build wheels on ${{ matrix.os }} |
| 34 | + runs-on: ${{ matrix.os }} |
| 35 | + strategy: |
| 36 | + matrix: |
| 37 | + os: [ ubuntu-22.04, windows-2022, macos-11 ] |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + fetch-depth: 0 |
| 43 | + |
| 44 | + - uses: actions/setup-python@v4 |
| 45 | + with: |
| 46 | + python-version: '3.8' |
| 47 | + |
| 48 | + - name: Install poetry |
| 49 | + run: pip install poetry |
| 50 | + |
| 51 | + - name: Set version |
| 52 | + run: python -m poetry version "${{ inputs.version }}" |
| 53 | + working-directory: ./python |
| 54 | + if: "${{ github.event.inputs.version != 'master' }}" |
| 55 | + |
| 56 | + # Publish the source distribution with the version that's in |
| 57 | + # the repository, otherwise the tests will fail |
| 58 | + - name: Compile source distribution |
| 59 | + run: python3 -m poetry build --format=sdist |
| 60 | + if: startsWith(matrix.os, 'ubuntu') |
| 61 | + working-directory: ./python |
| 62 | + |
| 63 | + - name: Build wheels |
| 64 | + |
| 65 | + with: |
| 66 | + output-dir: wheelhouse |
| 67 | + config-file: "pyproject.toml" |
| 68 | + env: |
| 69 | + # Ignore 32 bit architectures |
| 70 | + CIBW_ARCHS: "auto64" |
| 71 | + CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8,<3.12" |
| 72 | + CIBW_TEST_REQUIRES: "pytest==7.4.2 moto==4.2.2" |
| 73 | + CIBW_TEST_EXTRAS: "s3fs,glue" |
| 74 | + CIBW_TEST_COMMAND: "pytest -Werror {project}/tests/avro/test_decoder.py" |
| 75 | + # There is an upstream issue with installing on MacOSX |
| 76 | + # https://github.com/pypa/cibuildwheel/issues/1603 |
| 77 | + # Ignore tests for pypy since not all dependencies are compiled for it |
| 78 | + # and would require a local rust build chain |
| 79 | + CIBW_TEST_SKIP: "pp* *macosx*" |
| 80 | + |
| 81 | + - name: Add source distribution |
| 82 | + if: startsWith(matrix.os, 'ubuntu') |
| 83 | + run: ls -lah dist/* && cp dist/* wheelhouse/ |
| 84 | + |
| 85 | + - uses: actions/upload-artifact@v3 |
| 86 | + with: |
| 87 | + name: "release-${{ github.event.inputs.version }}" |
| 88 | + path: ./wheelhouse/* |
0 commit comments