PyPI #216
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: PyPI | |
on: | |
workflow_dispatch: | |
inputs: | |
target: | |
type: choice | |
description: 'Package Index' | |
required: true | |
default: 'PYPI' | |
options: [ 'TESTPYPI', 'PYPI' ] | |
jobs: | |
build_wheels: | |
name: On ${{ matrix.os }} | ${{ matrix.python }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# os: [ macos-latest, ubuntu-latest, windows-latest ] | |
# python: [ cp39, cp310, cp311 , cp312 ] | |
os: [ macos-latest ] | |
python: [ cp310 ] | |
arch: [ auto64 ] | |
steps: | |
- name: Checkout zipline | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
ref: 3.0.4 | |
- 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/cibuildwheel@v2.18.0 | |
env: | |
CIBW_BEFORE_ALL_LINUX: ./tools/install_talib.sh | |
CIBW_BEFORE_ALL_MACOS: brew install ta-lib | |
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 | |
CIBW_TEST_COMMAND_MACOS: pytest {package}/tests/ | |
ACTIONS_RUNNER_DEBUG: true | |
- name: Install MSVC amd64 | |
if: runner.os == 'Windows' | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64 | |
- name: Wheels Windows | |
if: runner.os == 'Windows' | |
uses: pypa/cibuildwheel@v2.18.0 | |
env: | |
CIBW_BUILD: "${{ matrix.python }}-win_amd64" | |
CIBW_BEFORE_TEST: pip install -U setuptools | |
CIBW_BEFORE_TEST_WINDOWS: > | |
call "c:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 && | |
call ./tools/install_talib.bat | |
- name: Store artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }}-${{ strategy.job-index }} | |
overwrite: true | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout zipline | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
ref: 3.0.4 | |
- 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 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [ build_wheels, build_sdist ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- name: Publish to testpypi | |
if: ${{ github.event.inputs.target == 'TESTPYPI2' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TESTPYPI_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish to pypi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: ${{ github.event.inputs.target == 'PYPI' }} | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |