-
Notifications
You must be signed in to change notification settings - Fork 6
154 lines (144 loc) · 4.51 KB
/
on_release.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
name: Release CI/CD # workflow name
on: # trigger
push:
branches: [release]
release:
branches: [master]
types:
- created
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Sources:
# https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml
# https://cibuildwheel.readthedocs.io/en/stable/options/
# Windows
- os: windows-2019
arch: AMD64
- os: windows-2019
arch: x86
# MacOS
- os: macos-13
arch: x86_64
- os: macos-13
arch: arm64
- os: macos-13
arch: universal2
# Linux
- os: ubuntu-20.04
arch: x86_64
- os: ubuntu-20.04
arch: i686
# - os: ubuntu-20.04 # raspberry pi, takes long
# arch: aarch64
# - os: ubuntu-20.04
# arch: ppc64le
# - os: ubuntu-20.04
# arch: s390x
steps:
- name: Set Github Workspace
uses: actions/checkout@v2
- name: Set up Python 3.10 # set architecture and Python3
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
uses: ./.github/common/install_dependencies
- name: Build wheels
uses: ./.github/common/build_wheels
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
make_sdist:
name: Make source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
unit_tests:
name: Run unit tests
runs-on: ubuntu-latest # runner
needs: [build_wheels, make_sdist]
steps: # tasks
- name: Set Github Workspace # access Github Workspace
uses: actions/checkout@v2
- name: Set up Python 3.10 # set architecture and Python3
uses: actions/setup-python@v2
with:
python-version: "3.10"
architecture: "x64" # architecture
- name: Downloads artifact
uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Install test dependencies
uses: ./.github/common/install_test_dependencies
- name: Install wheel
run: pip install --find-links ./dist jpeglib --no-index
- name: Run unit tests # run unittests
uses: ./.github/common/unit_tests
code_analysis:
name: Run code analysis
runs-on: ubuntu-latest # runner
needs: [build_wheels, make_sdist]
steps: # tasks
- name: Set Github Workspace # access Github Workspace
uses: actions/checkout@v2
- name: Set up Python 3.10 # set architecture and Python3
uses: actions/setup-python@v2
with:
python-version: "3.10"
architecture: "x64" # architecture
- name: Install dependencies
uses: ./.github/common/install_dependencies
- name: Run code analysis
uses: ./.github/common/code_quality
upload_to_test_pypi:
name: Upload to TestPyPi
needs: [build_wheels, make_sdist, unit_tests, code_analysis]
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/release' }}
steps:
- name: Downloads artifact
uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish on TestPyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
verbose: true
upload_to_pypi:
name: Upload to PyPi
needs: [build_wheels, make_sdist, unit_tests, code_analysis]
runs-on: ubuntu-latest
if: ${{github.event_name == 'release' && github.event.action == 'created'}}
steps:
- name: Downloads artifact
uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish on PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
verbose: true