Wheels #269
This file contains 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
name: Wheels | |
on: | |
push: | |
pull_request: | |
paths-ignore: | |
- "docs/**" | |
- "CONTRIBUTING.md" | |
release: | |
types: | |
- published | |
schedule: | |
# At 12:00 on every day-of-month | |
- cron: "0 12 */1 * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: tests | |
path: tests | |
build_wheels: | |
needs: [build_sdist] | |
name: Wheel for Linux-${{ matrix.cibw_python }}-${{ matrix.cibw_arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
cibw_python: | |
["cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"] | |
cibw_arch: ["x86_64", "i686"] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- uses: actions/download-artifact@v3 | |
with: | |
name: tests | |
path: tests | |
- name: Extract sdist | |
run: | | |
tar zxvf dist/*.tar.gz --strip-components=1 | |
- name: Disable ptrace security restrictions | |
run: | | |
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.13.1 | |
env: | |
CIBW_BUILD: ${{ matrix.cibw_python }} | |
CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }} | |
CIBW_PRERELEASE_PYTHONS: True | |
CIBW_TEST_EXTRAS: test | |
CIBW_TEST_COMMAND: python -m pytest {package}/tests | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: ./wheelhouse/*.whl | |
build_wheels_macos: | |
name: Wheel for MacOS-${{ matrix.cibw_python }}-${{ matrix.cibw_arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-11] | |
cibw_python: ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"] | |
cibw_arch: ["x86_64", "arm64"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Sets env vars for compilation | |
if: matrix.cibw_arch == 'arm64' | |
run: | | |
echo "CFLAGS=-target arm64-apple-macos11" >> $GITHUB_ENV | |
echo "MEMRAY_LIBBACKTRACE_TARGET=arm64-apple-macos11" >> $GITHUB_ENV | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.13.1 | |
env: | |
CIBW_BUILD: ${{ matrix.cibw_python }} | |
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }} | |
CIBW_PRERELEASE_PYTHONS: True | |
CIBW_TEST_EXTRAS: test | |
CIBW_TEST_COMMAND: pytest {package}/tests | |
CIBW_BUILD_VERBOSITY: 1 | |
MACOSX_DEPLOYMENT_TARGET: "10.14" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: ./wheelhouse/*.whl | |
upload_pypi: | |
needs: [build_wheels, build_wheels_macos, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Avoid publishing Python 3.12 wheels | |
run: | | |
rm -f dist/*cp312* | |
ls -l dist/ | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip_existing: true | |
password: ${{ secrets.PYPI_PASSWORD }} |