forked from quantopian/zipline
-
Notifications
You must be signed in to change notification settings - Fork 217
122 lines (111 loc) · 3.41 KB
/
build_wheels.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: PyPI
on:
workflow_dispatch:
inputs:
target:
type: choice
description: 'Package Index'
required: true
default: 'TESTPYPI'
options: [ 'TESTPYPI', 'PYPI' ]
version:
type: string
description: 'Version tag'
required: true
default: '3.1'
jobs:
build_wheels:
name: Wheels for ${{ matrix.python }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest , windows-latest, macos-latest ]
python: [ "cp39", "cp310", "cp311", "cp312" ]
arch: [ auto64 ]
steps:
- name: Checkout zipline
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.inputs.version }}
- name: Set Xcode version
uses: maxim-lobanov/setup-xcode@v1
if: ${{ matrix.os == 'macos-latest' }}
with:
xcode-version: latest-stable
- name: Wheels macOS / Linux
if: runner.os != 'Windows'
uses: pypa/[email protected]
env:
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_BUILD: "${{ matrix.python }}-*"
CIBW_SKIP: "*-musllinux_*"
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.15
- name: Install MSVC amd64
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Wheels Windows
if: runner.os == 'Windows'
uses: pypa/[email protected]
env:
CIBW_BUILD: "${{ matrix.python }}-win_amd64"
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: my-artifact-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.arch }}.whl
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.inputs.version }}
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.11'
- name: Build sdist
run: |
pip install -U pip setuptools build
python -m build --sdist
- name: upload sdist
uses: actions/upload-artifact@v4
with:
name: my-artifact-sdist
path: ./dist/*.tar.gz
upload_pypi:
needs: [ build_wheels, build_sdist ]
runs-on: ubuntu-latest
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
pattern: my-artifact-*
path: artifacts/
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R artifacts
- name: Publish to PyPI
if: ${{ github.event.inputs.target == 'PYPI' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages-dir: artifacts/
- name: Publish to PyPI - Test
if: ${{ github.event.inputs.target == 'TESTPYPI' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TESTPYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
verbose: true
packages-dir: artifacts/