-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (136 loc) · 4.18 KB
/
pypi.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: pypi
# 任务触发
on:
# 当 提交到当前仓库时立即运行
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
source-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Setup Python"
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: "Build source"
run: |
pip install --upgrade pip &&
pip install build &&
python -m build --sdist
- name: Get version
id: version
uses: frabert/replace-string-action@v2
with:
pattern: 'refs/tags/v(.+)'
string: ${{ github.ref }}
replace-with: 'v$1'
- uses: actions/upload-artifact@v3
with:
name: build_${{ steps.version.outputs.replaced }}
path: dist/*.tar.gz
retention-days: 1
manylinux-build:
runs-on: ubuntu-latest
needs: ["source-build"]
strategy:
matrix:
py_version: ['cp38-cp38', 'cp39-cp39', 'cp310-cp310']
steps:
- uses: actions/checkout@v3
- name: Get version
id: version
uses: frabert/replace-string-action@v2
with:
pattern: 'refs/tags/v(.+)'
string: ${{ github.ref }}
replace-with: 'v$1'
- uses: actions/download-artifact@v3
with:
name: build_${{ steps.version.outputs.replaced }}
path: dist/
- name: Build on manylinux2010
uses: GCS-ZHN/[email protected]
with:
python-versions: ${{ matrix.py_version }}
build-requirements: |
versioneer[toml]
cmake>=3.18
scikit-build>=0.13
setuptools>=42
system-packages: zlib-devel
source: dist/*.tar.gz
- uses: actions/upload-artifact@v3
with:
name: build_${{ steps.version.outputs.replaced }}
path: dist/*-manylinux*.whl
retention-days: 1
win-build:
runs-on: windows-2022
needs: ["source-build"]
strategy:
matrix:
py_version: ['3.7', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- name: "Setup Miniconda"
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.py_version }}
auto-update-conda: true
activate-environment: "diamond4py"
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
- name: "Build and test for Windows"
shell: powershell
run: |
python -m pip install --upgrade pip;
pip install build "setuptools>=42" "scikit-build>=0.13" "cmake>=3.18,<=3.25.2" "ninja" "versioneer[toml]";
conda install -c anaconda zlib ;
python -m build --wheel --no-isolation;
Get-ChildItem -Path dist -Filter diamond4py*whl | ForEach-Object{ pip install "dist\$_" };
pushd test; python test.py; popd
- name: Get version
id: version
uses: frabert/replace-string-action@v2
with:
pattern: 'refs/tags/v(.+)'
string: ${{ github.ref }}
replace-with: 'v$1'
- uses: actions/upload-artifact@v3
with:
name: build_${{ steps.version.outputs.replaced }}
path: dist/*
retention-days: 1
release:
needs: ["manylinux-build", "win-build"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get version
id: version
uses: frabert/replace-string-action@v2
with:
pattern: 'refs/tags/v(.+)'
string: ${{ github.ref }}
replace-with: 'v$1'
- uses: actions/download-artifact@v3
with:
name: build_${{ steps.version.outputs.replaced }}
path: dist/
- name: Release to GitHub
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*
draft: true
- name: Relase to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository_url: ${{ vars.PYPI_URL }}
packages_dir: dist/