├── .github └── workflows │ ├── create_tags.py │ ├── release.yml │ └── test.yml ├── Dockerfile ├── LICENSE ├── README.md ├── action.yml ├── entrypoint.sh └── full_workflow_example.yml /.github/workflows/create_tags.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import sys 3 | 4 | 5 | def main(): 6 | version = sys.argv[1] 7 | branch = "rel_" + version 8 | containers = [ 9 | "manylinux2014_x86_64", 10 | "manylinux2014_i686", 11 | "manylinux2014_aarch64", 12 | "manylinux2014_ppc64le", 13 | "manylinux2014_s390x", 14 | "manylinux_2_24_x86_64", 15 | "manylinux_2_24_i686", 16 | "manylinux_2_24_aarch64", 17 | "manylinux_2_24_ppc64le", 18 | "manylinux_2_24_s390x", 19 | "manylinux_2_28_x86_64", 20 | "manylinux_2_28_aarch64", 21 | "manylinux_2_28_ppc64le", 22 | "manylinux2010_x86_64", 23 | "manylinux2010_i686", 24 | "manylinux1_x86_64", 25 | "manylinux1_i686", 26 | "musllinux_1_1_x86_64", 27 | "musllinux_1_1_i686", 28 | "musllinux_1_1_aarch64", 29 | "musllinux_1_1_ppc64le", 30 | "musllinux_1_1_s390x", 31 | ] 32 | files_to_edit = ["./Dockerfile"] 33 | 34 | # Setup Git 35 | subprocess.call(["git", "config", "--global", "user.email", '"ralfg@hotmail.be"']) 36 | subprocess.call(["git", "config", "--global", "user.name", '"Ralf Gabriels"']) 37 | 38 | # Checkout new branch 39 | subprocess.call(["git", "checkout", "-b", branch]) 40 | 41 | # Replace, add, commit, tag 42 | for i, container in enumerate(containers): 43 | if i > 0: 44 | for file_ in files_to_edit: 45 | subprocess.call( 46 | [ 47 | "sed", 48 | "-i", 49 | "-e", 50 | f"s/{containers[i-1]}/{containers[i]}/g", 51 | file_, 52 | ] 53 | ) 54 | subprocess.call(["git", "add"] + files_to_edit) 55 | subprocess.call(["git", "commit", "-m", f'Change container to {container}']) 56 | subprocess.call(["git", "tag", version + "-" + container]) 57 | 58 | # Push 59 | subprocess.call(["git", "push", "--set-upstream", "origin", branch]) 60 | subprocess.call(["git", "push", "--tags"]) 61 | 62 | 63 | if __name__ == "__main__": 64 | main() 65 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | add_tags: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Get tag 13 | uses: little-core-labs/get-git-tag@v3.0.2 14 | id: tagName 15 | - name: Run latest-tag 16 | uses: EndBug/latest-tag@v1.3.1 17 | env: 18 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 19 | - name: Setup Python environment 20 | uses: actions/setup-python@v2 21 | with: 22 | python-version: 3.8 23 | - name: Create new tags 24 | run: python .github/workflows/create_tags.py "${{ steps.tagName.outputs.tag }}" 25 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | 9 | jobs: 10 | test: 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | include: 15 | - python-version: '3.7' 16 | pep-425-tag: 'cp37-cp37m' 17 | - python-version: '3.8' 18 | pep-425-tag: 'cp38-cp38' 19 | - python-version: '3.9' 20 | pep-425-tag: 'cp39-cp39' 21 | - python-version: '3.10' 22 | pep-425-tag: 'cp310-cp310' 23 | - python-version: '3.11' 24 | pep-425-tag: 'cp311-cp311' 25 | runs-on: ubuntu-latest 26 | steps: 27 | - name: Checkout action 28 | uses: actions/checkout@v3 29 | with: 30 | path: test_action 31 | - name: Checkout hello_py dummy project 32 | uses: actions/checkout@v3 33 | with: 34 | repository: ralfg/hello_py 35 | ref: v0.1.1 36 | path: hello_py 37 | - name: Setup Python environment 38 | uses: actions/setup-python@v4 39 | with: 40 | python-version: ${{ matrix.python-version }} 41 | - name: Build manylinux Python wheels 42 | uses: './test_action' 43 | with: 44 | python-versions: ${{ matrix.pep-425-tag }} 45 | build-requirements: 'setuptools numpy cython' 46 | system-packages: 'gzip' 47 | pre-build-command: 'echo Hello world! Testing pre-build command' 48 | package-path: 'hello_py' 49 | - name: Install wheel 50 | run: 'pip install hello_py/dist/hello_py*-manylinux*.whl' 51 | - name: Test wheel 52 | run: 'hello_py' 53 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM quay.io/pypa/manylinux2014_x86_64 2 | 3 | ENV PLAT manylinux2014_x86_64 4 | 5 | COPY entrypoint.sh /entrypoint.sh 6 | 7 | ENTRYPOINT ["/entrypoint.sh"] 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ⚠️ This action has been archived in favor of [PyPA/cibuildwheel](https://github.com/pypa/cibuildwheel) ⚠️ 2 | 3 | --- 4 | 5 | # Python wheels manylinux build - GitHub Action 6 | 7 | ![GitHub release](https://flat.badgen.net/github/release/RalfG/python-wheels-manylinux-build) 8 | ![License](https://flat.badgen.net/github/license/RalfG/python-wheels-manylinux-build) 9 | ![Open issues](https://flat.badgen.net/github/open-issues/RalfG/python-wheels-manylinux-build) 10 | ![Merged PRs](https://flat.badgen.net/github/merged-prs/RalfG/python-wheels-manylinux-build) 11 | ![GitHub Stars](https://flat.badgen.net/github/stars/RalfG/python-wheels-manylinux-build) 12 | ![GitHub Forks](https://flat.badgen.net/github/forks/RalfG/python-wheels-manylinux-build) 13 | 14 | Build manylinux wheels for a (Cython) Python package. 15 | 16 | This action uses the [manylinux](https://github.com/pypa/manylinux) containers to 17 | build manylinux wheels for a (Cython) Python package. The wheels are placed in a 18 | new directory `/dist` and can be uploaded to PyPI in the next step of your 19 | workflow. 20 | 21 | This is a relatively simple and straightforward action. For more complicated use cases, 22 | check out [PyPA/cibuildwheel](https://github.com/pypa/cibuildwheel). 23 | 24 | ## Usage 25 | 26 | ### Example 27 | Minimal: 28 | 29 | ```yaml 30 | uses: RalfG/python-wheels-manylinux-build@v0.7.1 31 | with: 32 | python-versions: 'cp310-cp310 cp311-cp311' 33 | ``` 34 | 35 | Using all arguments: 36 | 37 | ```yaml 38 | uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2010_x86_64 39 | with: 40 | python-versions: 'cp310-cp310 cp311-cp311' 41 | build-requirements: 'cython numpy' 42 | system-packages: 'lrzip-devel zlib-devel' 43 | pre-build-command: 'sh pre-build-script.sh' 44 | package-path: 'my_project' 45 | pip-wheel-args: '-w ./dist --no-deps' 46 | ``` 47 | 48 | See 49 | [full_workflow_example.yml](https://github.com/RalfG/python-wheels-manylinux-build/blob/master/full_workflow_example.yml) 50 | for a complete example that includes linting and uploading to PyPI. 51 | 52 | 53 | ### Inputs 54 | 55 | | name | description | required | default | example(s) | 56 | | - | - | - | - | - | 57 | | `python-versions` | Python version tags for which to build (PEP 425 tags) wheels, as described in the [manylinux image documentation](https://github.com/pypa/manylinux), space-separated | required | `'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311'` | `'cp310-cp310 cp311-cp311'` | 58 | | `build-requirements` | Python (pip) packages required at build time, space-separated | optional | `''` | `'cython'` or `'cython==0.29.14'` | 59 | | `system-packages` | System (yum) packages required at build time, space-separated | optional | `''` | `'lrzip-devel zlib-devel'` | 60 | | `pre-build-command` | Command to run before build, e.g. the execution of a script to perform additional build-environment setup | optional | `''` | `'sh pre-build-script.sh'` | 61 | | `package-path` | Path to python package to build (e.g. where `setup.py` file is located), relative to repository root | optional | `''` | `'my_project'` | 62 | | `pip-wheel-args` | Extra extra arguments to pass to the `pip wheel` command (see [pip documentation](https://pip.pypa.io/en/stable/reference/pip_wheel/)), passed paths are relative to `package-path` | optional | `'-w ./dist --no-deps'` | `'-w ./wheelhouse --no-deps --pre'` | 63 | 64 | ### Output 65 | The action creates wheels, by default in the `/dist` directory. The output 66 | path can be modified in the `pip-wheel-args` option with the `-w` argument. Be sure to 67 | upload only the `*-manylinux*.whl` wheels, as the non-audited (e.g. `linux_x86_64`) 68 | wheels are not accepted by PyPI. 69 | 70 | ### Using a different manylinux container 71 | The `manylinux2014_x86_64` container is used by default. To use another manylinux 72 | container, append `-` to the reference. For example: 73 | `RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_aarch64` instead of 74 | `RalfG/python-wheels-manylinux-build@v0.7.1`. 75 | 76 | ## Contributing 77 | Bugs, questions or suggestions? Feel free to post an issue in the 78 | [issue tracker](https://github.com/RalfG/python-wheels-manylinux-build/issues) 79 | or to make a pull request! 80 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | # action.yml 2 | name: 'Python wheels manylinux build' 3 | author: 'Ralf Gabriels' 4 | description: 'Build manylinux wheels for a (Cython) Python package' 5 | inputs: 6 | python-versions: 7 | description: 'Python versions to target, space-separated' 8 | required: true 9 | default: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311' 10 | build-requirements: 11 | description: 'pip packages required at build time, space-separated' 12 | required: false 13 | default: '' 14 | system-packages: 15 | description: 'yum packages to install, space-separated' 16 | required: false 17 | default: '' 18 | pre-build-command: 19 | description: 'command to run before build, e.g. the execution of a script to perform additional build-environment setup' 20 | required: false 21 | default: '' 22 | package-path: 23 | description: 'path to python package to build, relative to repository root' 24 | required: false 25 | default: '' 26 | pip-wheel-args: 27 | description: 'extra arguments to pass to the `pip wheel` command, passed paths are relative to `package-path`' 28 | required: false 29 | default: '-w ./dist --no-deps' 30 | runs: 31 | using: 'docker' 32 | image: 'Dockerfile' 33 | args: 34 | - ${{ inputs.python-versions }} 35 | - ${{ inputs.build-requirements }} 36 | - ${{ inputs.system-packages }} 37 | - ${{ inputs.pre-build-command }} 38 | - ${{ inputs.package-path }} 39 | - ${{ inputs.pip-wheel-args}} 40 | branding: 41 | icon: 'package' 42 | color: 'green' 43 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -x 3 | 4 | # CLI arguments 5 | PY_VERSIONS=$1 6 | BUILD_REQUIREMENTS=$2 7 | SYSTEM_PACKAGES=$3 8 | PRE_BUILD_COMMAND=$4 9 | PACKAGE_PATH=$5 10 | PIP_WHEEL_ARGS=$6 11 | 12 | # Temporary workaround for LD_LIBRARY_PATH issue. See 13 | # https://github.com/RalfG/python-wheels-manylinux-build/issues/26 14 | export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib 15 | 16 | cd "${GITHUB_WORKSPACE}"/"${PACKAGE_PATH}" 17 | 18 | # Install findutils by default on images with APK (Alpine: musllinux). Required for `find -iregex`. 19 | if command -v apk >/dev/null; then 20 | apk add findutils || { echo "Installing findutils with apk failed."; exit 1; } 21 | fi 22 | 23 | if [ ! -z "$SYSTEM_PACKAGES" ]; then 24 | if command -v apt-get >/dev/null; then 25 | apt-get update 26 | apt-get install -y ${SYSTEM_PACKAGES} || { echo "Installing apt package(s) failed."; exit 1; } 27 | elif command -v yum >/dev/null; then 28 | yum install -y ${SYSTEM_PACKAGES} || { echo "Installing yum package(s) failed."; exit 1; } 29 | elif command -v apk >/dev/null; then 30 | apk add ${SYSTEM_PACKAGES} || { echo "Installing apk package(s) failed."; exit 1; } 31 | else 32 | echo "Package managers apt, yum, or apk not found."; exit 1; 33 | fi 34 | fi 35 | 36 | if [ ! -z "$PRE_BUILD_COMMAND" ]; then 37 | eval $PRE_BUILD_COMMAND || { echo "Pre-build command failed."; exit 1; } 38 | fi 39 | 40 | # Compile wheels 41 | arrPY_VERSIONS=(${PY_VERSIONS// / }) 42 | for PY_VER in "${arrPY_VERSIONS[@]}"; do 43 | # Update pip 44 | /opt/python/"${PY_VER}"/bin/pip install --upgrade --no-cache-dir pip 45 | 46 | # Check if requirements were passed 47 | if [ ! -z "$BUILD_REQUIREMENTS" ]; then 48 | /opt/python/"${PY_VER}"/bin/pip install --no-cache-dir ${BUILD_REQUIREMENTS} || { echo "Installing requirements failed."; exit 1; } 49 | fi 50 | 51 | # Build wheels 52 | /opt/python/"${PY_VER}"/bin/pip wheel . ${PIP_WHEEL_ARGS} || { echo "Building wheels failed."; exit 1; } 53 | done 54 | 55 | # Bundle external shared libraries into the wheels 56 | # find -exec does not preserve failed exit codes, so use an output file for failures 57 | failed_wheels=$PWD/failed-wheels 58 | rm -f "$failed_wheels" 59 | find . -type f -iregex ".*-[manylinux|linux].*\.whl" -exec bash -c "auditwheel repair '{}' -w \$(dirname '{}') --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}' &>> "$failed_wheels"; }" \; 60 | 61 | if [[ -f "$failed_wheels" ]]; then 62 | sed -i '/This does not look like a platform wheel/d' "$failed_wheels" 63 | fi 64 | 65 | if [[ -s "$failed_wheels" ]]; then 66 | echo "Repairing wheels failed:" 67 | cat failed-wheels 68 | exit 1 69 | fi 70 | 71 | echo "Succesfully build wheels:" 72 | find . -type f -iname "*-manylinux*.whl" 73 | -------------------------------------------------------------------------------- /full_workflow_example.yml: -------------------------------------------------------------------------------- 1 | name: Python package build and publish 2 | 3 | on: 4 | release: 5 | types: [created] 6 | 7 | jobs: 8 | deploy: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Set up Python 13 | uses: actions/setup-python@v1 14 | with: 15 | python-version: 3.8 16 | - name: Install dependencies 17 | run: | 18 | python -m pip install --upgrade pip 19 | pip install twine flake8 20 | - name: Lint with flake8 for syntax errors 21 | run: | 22 | pip install flake8 23 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics 24 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics 25 | - name: Build manylinux Python wheels 26 | uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64 27 | with: 28 | python-versions: 'cp310-cp310 cp311-cp311' 29 | build-requirements: 'cython numpy' 30 | - name: Publish wheels to PyPI 31 | env: 32 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 33 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 34 | run: | 35 | twine upload dist/*-manylinux*.whl 36 | --------------------------------------------------------------------------------