-
Notifications
You must be signed in to change notification settings - Fork 107
196 lines (176 loc) · 5.76 KB
/
merge_master.yaml
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Master merge
# on:
# push:
# branches: [ master ]
# workflow_dispatch:
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
MKN_COMPILE_THREADS: 2
MKN_GCC_PREFERRED: 1
MKN_LIB_LINK_LIB: 1
KLOG: 3
jobs:
build_linux:
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version: ['cp311-cp311']
# python-version: ['cp39-cp39', 'cp310-cp310', 'cp311-cp311', 'cp312-cp312']
steps:
- name: add Python dir to path
run: |
echo "/opt/python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH
- uses: actions/checkout@v3
with:
submodules: true
- name: Build for Python ${{ matrix.python-version }}
run: |
git config --global --add safe.directory '*'
python3 -V
python3 -m pip install -U pip
python3 -m pip install -U build twine wheel
python3 -m pip install -U -r requirements.txt
curl -Lo mkn https://github.com/mkn/mkn/releases/download/latest/mkn_manylinux
chmod +x mkn
PATH=$PWD:$PATH mkn -C lib build -g 0 -dtOa "-fPIC -std=c++17"
python3 -m build --wheel --no-isolation .
python3 -m twine check dist/*
- name: Make wheels universal
run: for wheel in $(ls dist/*.whl); do auditwheel repair $wheel; done
- name: Save packages as artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/*.whl
build_other:
strategy:
fail-fast: false
max-parallel: 4
matrix:
os: [macos-11, windows-latest]
python-version: ['3.11']
# python-version: ['3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
with:
arch: amd64
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: setup Python ${{ matrix.os }} ${{ matrix.python-version }}
run: |
git config --global --add safe.directory '*'
python3 -V
python3 -m pip install -U pip
python3 -m pip install -U build twine wheel
python3 -m pip install -U -r requirements.txt
- name: build windows
if: runner.os == 'Windows'
shell: cmd
run: |
curl -Lo mkn https://github.com/mkn/mkn/releases/download/latest/mkn.exe
mkn -C lib build -g 0 -dtOa "-std:c++17 -EHsc"
- name: build macos
if: runner.os != 'Windows'
run: |
curl -Lo mkn https://github.com/mkn/mkn/releases/download/latest/mkn_osx
chmod +x mkn
PATH=$PWD:$PATH mkn -C lib build -g 0 -dtOa "-fPIC -std=c++17"
- name: build wheel
run: |
python3 -m build --wheel --no-isolation .
python3 -m twine check dist/*
- name: Save packages as artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/*.whl
# build_macos_arm:
# strategy:
# matrix:
# python-version: ['3.11']
# runs-on: self-hosted
# steps:
# - uses: actions/checkout@v3
# - name: add pyenv to path
# run: |
# echo "$HOME/.pyenv/shims" >> $GITHUB_PATH
# - name: install dependencies
# run: |
# brew install pyenv
# pyenv install ${{ matrix.python-version }}
# pyenv local ${{ matrix.python-version }}
# python3 -V
# python3 -m pip install -U pip
# python3 -m pip install -U build twine wheel
# python3 -m pip install -U -r requirements.txt
# - name: build package
# run: |
# pyenv local ${{ matrix.python-version }}
# CC=gcc-13 CXX=g++-13 python3 -m build --wheel --no-isolation .
# - name: Save packages as artifacts
# uses: actions/upload-artifact@v3
# with:
# name: wheels
# path: dist/*.whl
test_wheels:
needs: [build_linux, build_other]
strategy:
matrix:
os: [ubuntu-latest] # ,macos-11, windows-latest
python-version: ['3.11']
# python-version: ['3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: install wheel (Unix)
if: runner.os != 'Windows'
run: |
pip install --find-links $GITHUB_WORKSPACE/dist tick
- name: install wheel (Windows)
if: runner.os == 'Windows'
run: |
pip install --find-links $env:GITHUB_WORKSPACE\dist tick
- uses: actions/checkout@v3
- name: run tests
run: | # hide tick dir to avoid conflicts but still run tests
python3 -V
rm -rf tick/tick_cpp && mv tick _tick
python3 -m unittest discover -v . "*_test.py"
upload_test_pypi:
needs: [test_wheels]
runs-on: ubuntu-latest
# upload to test PyPI on github pushes
# if: github.event_name == 'push' && github.repository_owner == 'Tick'
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository-url: https://test.pypi.org/legacy/
skip-existing: false