-
Notifications
You must be signed in to change notification settings - Fork 2
122 lines (108 loc) · 3.45 KB
/
ci.yml
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
name: CI
on:
push:
branches:
- master
tags:
- '**'
pull_request: {}
jobs:
build:
name: build py${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- macos
- windows
python-version:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
wheels-dir:
- '.wheels'
include:
- os: ubuntu
platform: linux
- os: windows
ls: dir
- python-version: 3.6
cibw-version: cp36
- python-version: 3.7
cibw-version: cp37
- python-version: 3.8
cibw-version: cp38
- python-version: 3.9
cibw-version: cp39
runs-on: ${{ format('{0}-latest', matrix.os) }}
steps:
- uses: actions/checkout@v2
- name: set up python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: set up rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.50.0
profile: minimal
default: true
override: true
- name: install python dependencies
run: |
pip install -U setuptools setuptools-rust wheel cibuildwheel==1.7.0
- name: build sdist
run: |
python setup.py sdist
- name: create wheels dir
run: |
mkdir ${{ matrix.wheels-dir }}
- name: build ${{ matrix.platform || matrix.os }} binaries
run: python -m cibuildwheel --output-dir ${{ matrix.wheels-dir }}
env:
CIBW_BUILD: '${{ matrix.cibw-version }}-*'
CIBW_SKIP: '*-win32'
CIBW_PLATFORM: ${{ matrix.platform || matrix.os }}
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"'
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
CIBW_BEFORE_BUILD: >
rustup show
CIBW_BEFORE_BUILD_LINUX: >
curl https://sh.rustup.rs -sSf | sh -s -- --profile=minimal -y &&
rustup show
CIBW_TEST_COMMAND: "pytest {project}/tests"
CIBW_TEST_EXTRAS: test
- name: build windows 32bit binaries
if: matrix.os == 'windows'
run: cibuildwheel --output-dir ${{ matrix.wheels-dir }}
env:
CIBW_BUILD: '${{ matrix.cibw-version }}-win32'
CIBW_PLATFORM: windows
CIBW_ENVIRONMENT: 'PATH="$UserProfile\.cargo\bin;$PATH"'
CIBW_BEFORE_BUILD: >
rustup default stable-i686-pc-windows-msvc &&
rustup show
CIBW_TEST_COMMAND: "pytest {project}/tests"
CIBW_TEST_EXTRAS: test
- name: list wheels
run: ${{ matrix.ls || 'ls -lh' }} ${{ matrix.wheels-dir }}
- name: twine check
run: |
pip install -U twine
twine check ${{ matrix.wheels-dir }}/*
- name: Upload to github releases
if: startsWith(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.wheels-dir }}/*
file_glob: true
tag: ${{ github.ref }}
- name: upload to pypi
if: startsWith(github.ref, 'refs/tags/')
run: twine upload ${{ matrix.wheels-dir }}/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}