-
Notifications
You must be signed in to change notification settings - Fork 4
165 lines (165 loc) · 4.83 KB
/
build-and-upload.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
162
163
164
165
name: Build and upload
on:
push:
branches: master
paths:
- "setup.py"
jobs:
testing:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.12"]
steps:
- name: Checkout Repository And Submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Display Python Version
run: python -c "import sys; print(sys.version)"
shell: bash
- name: Install Pydivsufsort And Other Dependencies
run: |
python -m pip install pytest flake8
bash ./build.sh
python -m pip install . -v
shell: bash
- name: Run Flake8
run: flake8 .
shell: bash
- name: Run Unit Tests
run: |
pytest tests
shell: bash
build_linux_macos_wheels:
needs: testing
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout Repository And Submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install build and pip
run: python -m pip install -U pip build
shell: bash
- name: Build Sdist
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
python -m build --sdist
fi
shell: bash
- name: Install Cibuildwheel
run: python -m pip install cibuildwheel
shell: bash
- name: Build Wheels
env:
CIBW_BEFORE_BUILD: pip install -U pip
CIBW_SKIP: pp* *-musllinux_* *-manylinux_i686
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "pytest {project}/tests"
CIBW_ARCHS_MACOS: x86_64 arm64
run: |
python -m cibuildwheel --output-dir wheelhouse
ls wheelhouse/*
shell: bash
- name: Upload Builds
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install twine
if [ "$RUNNER_OS" == "Linux" ]; then
# Replace/remove echo
python -m twine upload --skip-existing dist/*
fi
python -m twine upload --skip-existing wheelhouse/*.whl
shell: bash
build_win32_wheels:
needs: testing
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- name: Checkout Repository And Submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Cibuildwheel
run: python -m pip install cibuildwheel
shell: bash
- name: Build Wheels
env:
CIBW_BEFORE_BUILD: bash ./build.sh
CIBW_SKIP: pp* *-win_amd64
CIBW_ENVIRONMENT: PLATFORM_OPTION='-A win32'
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "pytest {project}/tests"
run: |
python -m cibuildwheel --output-dir wheelhouse
ls wheelhouse/*
shell: bash
- name: Upload Builds
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install twine
python -m twine upload --skip-existing wheelhouse/*.whl
shell: bash
build_amd64_wheels:
needs: testing
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- name: Checkout Repository And Submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Cibuildwheel
run: python -m pip install cibuildwheel
shell: bash
- name: Build Wheels
env:
CIBW_BEFORE_BUILD: bash ./build.sh
CIBW_SKIP: pp* *-win32
CIBW_ENVIRONMENT: PLATFORM_OPTION='-A x64'
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "pytest {project}/tests"
run: |
python -m cibuildwheel --output-dir wheelhouse
ls wheelhouse/*
shell: bash
- name: Upload Builds
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install twine
python -m twine upload --skip-existing wheelhouse/*.whl
shell: bash