forked from openpifpaf/openpifpaf
-
Notifications
You must be signed in to change notification settings - Fork 22
138 lines (120 loc) · 5.25 KB
/
pypi-deploy.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Build and upload to PyPI
# Build on every branch push, tag push, and pull request change:
# on: [push, pull_request]
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
jobs:
# build_wheels:
# name: Build wheels on ${{ matrix.os }}
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# include:
# - os: ubuntu-20.04
# linux_archs: "x86_64"
# linux_torch_version: "torch==1.9.0+cpu -f https://download.pytorch.org/whl/torch_stable.html"
# - os: ubuntu-20.04
# linux_archs: "aarch64"
# linux_torch_version: "torch==1.9.0 -f https://download.pytorch.org/whl/torch_stable.html"
# - os: windows-latest
# - os: macos-11
# macos_archs: "x86_64"
# - os: macos-11
# macos_archs: "arm64"
# steps:
# - uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Cache checkpoints and data
# uses: actions/cache@v2
# with:
# path: |
# ~/.cache
# data-cifar10
# key: ${{ runner.os }}-${{ hashFiles('setup.py') }}
# - uses: actions/setup-python@v2
# name: Install Python
# with:
# python-version: '3.7'
# - name: Set up QEMU
# if: runner.os == 'Linux'
# uses: docker/setup-qemu-action@v1
# with:
# platforms: all
# - name: Install cibuildwheel
# run: python -m pip install cibuildwheel==2.3.0
# - name: Build wheels
# env:
# CIBW_BUILD: "cp3[6789]-manylinux* cp3[6789]-macosx* cp3[6789]-win_amd64"
# CIBW_BUILD_VERBOSITY: 1
# CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
# MACOSX_DEPLOYMENT_TARGET: "10.14" # for C++17 support
# CIBW_ARCHS_MACOS: ${{ matrix.macos_archs }}
# CIBW_ARCHS_LINUX: ${{ matrix.linux_archs }}
# CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
# pip3 install numpy ${{ matrix.linux_torch_version }};
# python -c 'import torch.utils.cpp_extension;print(torch.utils.cpp_extension.library_paths()[0])';
# LD_LIBRARY_PATH=`python -c 'import torch.utils.cpp_extension;print(torch.utils.cpp_extension.library_paths()[0])'` auditwheel repair -w {dest_dir} {wheel}
# CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
# pip3 install numpy torch;
# python -c 'import torch.utils.cpp_extension;print(torch.utils.cpp_extension.library_paths()[0])';
# DYLD_LIBRARY_PATH=`python -c 'import torch.utils.cpp_extension;print(torch.utils.cpp_extension.library_paths()[0])'` delocate-listdeps {wheel} &&
# DYLD_LIBRARY_PATH=`python -c 'import torch.utils.cpp_extension;print(torch.utils.cpp_extension.library_paths()[0])'` delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
# # CIBW_BEFORE_BUILD: "pip3 install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html"
# # CIBW_REPAIR_WHEEL_COMMAND_LINUX: "pip3 install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html; python -c 'import torch.utils.cpp_extension;print(torch.utils.cpp_extension.library_paths()[0])'; LD_LIBRARY_PATH=`python -c 'import torch.utils.cpp_extension;print(torch.utils.cpp_extension.library_paths()[0])'` auditwheel repair -w {dest_dir} {wheel}"
# # CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" # deactivate repair wheel for now (embeds 100s of MB of PyTorch libraries otherweise)
# run: python -m cibuildwheel --output-dir wheelhouse
# - run: ls -hla ./wheelhouse
# if: runner.os != 'Windows'
# - uses: actions/upload-artifact@v2
# with:
# path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.10'
- run: pip install -e .
- run: python -c "import openpifpaf; print(openpifpaf.__version__)"
- run: git status
- run: git diff
- run: python -c "import openpifpaf; assert 'dirty' not in openpifpaf.__version__"
- name: Build sdist
run: python setup.py sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
# To test: repository_url: https://test.pypi.org/legacy/