-
Notifications
You must be signed in to change notification settings - Fork 40
135 lines (117 loc) · 4.43 KB
/
Copy pathpy.yaml
File metadata and controls
135 lines (117 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: PyPI 📦 Distribution
on:
push:
pull_request:
# https://github.com/Cryptex-github/ril-py/blob/main/.github/workflows/py-binding.yml
jobs:
build:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}
strategy:
fail-fast: false
matrix:
config:
- {
os: ubuntu-latest,
arch: x64,
python-version: 'cp38',
name: 'manylinux_x86_64',
alt_arch_name: x86_64
}
# - {
# os: macos-latest,
# arch: x64,
# python-ver: '3.8',
# name: 'macos_x86_64'
# }
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: set up rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.config.alt_arch_name }}
- name: Get pip cache dir
id: pip-cache
if: matrix.config.os != 'windows-latest'
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache python dependencies
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir || steps.pip-cache-win.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.config.python-version }}
- name: install python dependencies
run: pip install -U setuptools wheel twine cibuildwheel platformdirs
- name: Display cibuildwheel cache dir
id: cibuildwheel-cache
run: |
from platformdirs import user_cache_path
import os
with open(os.getenv('GITHUB_OUTPUT'), 'w') as f:
f.write(f"dir={str(user_cache_path(appname='cibuildwheel', appauthor='pypa'))}")
shell: python
- name: Cache cibuildwheel tools
uses: actions/cache@v3
with:
path: ${{ steps.cibuildwheel-cache.outputs.dir }}
key: ${{ runner.os }}-cibuildwheel-${{ matrix.config.python-version }}
- name: build sdist
if: matrix.config.os == 'ubuntu-latest' && matrix.config.python-version == 'cp38'
run: |
pip install maturin build
python -m build --sdist -o wheelhouse
- name: build ${{ matrix.config.platform || matrix.config.os }} binaries
run: cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD_FRONTEND: build
CIBW_BUILD: '${{ matrix.config.python-version }}-${{ matrix.config.name }}'
# rust doesn't seem to be available for musl linux on i686
CIBW_SKIP: '*-musllinux_i686'
# we build for "alt_arch_name" if it exists, else 'auto'
CIBW_ARCHS: ${{ matrix.config.alt_arch_name || 'auto' }}
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH" CARGO_TERM_COLOR="always"'
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH" CARGO_TERM_COLOR="always" MATURIN_PEP517_ARGS="--compatibility manylinux_2_28 --auditwheel=skip"'
# These are needed for Unicorn and cbindgen
CIBW_BEFORE_ALL: >
yum update -y && yum install -y clang clang-devel
CIBW_BEFORE_BUILD: rustup show
CIBW_BEFORE_BUILD_LINUX: >
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable --profile=minimal -y &&
rustup show
# CIBW_TEST_COMMAND: 'pytest {project}/test'
# CIBW_TEST_REQUIRES: pytest requests
# CIBW_TEST_SKIP: '*-macosx_arm64 *-macosx_universal2:arm64'
# We must skip auditwheel because libunicorn.so is loaded at import time instead of load time and thus auditwheel will always fail!
# This is hacky but should be okay
CIBW_REPAIR_WHEEL_COMMAND: ''
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BUILD_VERBOSITY: 1
- run: ${{ matrix.config.ls || 'ls -lh' }} wheelhouse/
- name: '📤 Upload artifact'
uses: actions/upload-artifact@v4
with:
name: wheels
path: wheelhouse/
publish:
needs: [build]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- name: '📦 Publish distribution to PyPI'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_pass }}