-
Notifications
You must be signed in to change notification settings - Fork 11
125 lines (95 loc) · 2.78 KB
/
build_and_publish.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
name: build_and_publish
on:
push:
tags:
branches:
pull_request:
branches:
repository_dispatch:
types: build
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_type }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
run_cpp_tests:
name: "Run C++ tests"
runs-on: ubuntu-22.04
steps:
- name: "Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: "Install dependencies"
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -qq --yes >/dev/null
sudo apt-get install -qq --yes build-essential gsl-bin libboost-all-dev libgsl-dev >/dev/null
- name: "Build C++ tests"
run: |
make tests
- name: "Run C++ tests"
run: |
make run-tests
build_wheels:
name: "Build wheel (${{ matrix.os }}, py${{ matrix.python-version }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macOS-11 ]
python-version: [ 36, 37, 38, 39, 310, 311 ]
steps:
- name: "Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: "Build wheel (${{ matrix.os }}, py${{ matrix.python-version }})"
uses: pypa/cibuildwheel@v2.11.1
with:
config-file: cibuildwheel.toml
env:
CIBW_BUILD: "cp${{ matrix.python-version}}-*"
- name: "Upload build artifacts (${{ matrix.os }}, py${{ matrix.python-version }})"
uses: actions/upload-artifact@v3
with:
name: dist
path: ./wheelhouse/*.whl
make_sdist:
name: "Make source distribution"
runs-on: ubuntu-22.04
steps:
- name: "Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: "Build sdist"
run: |
pip3 install pipx ppsetuptools
pipx run build --sdist
- name: "Upload build artifacts"
uses: actions/upload-artifact@v3
with:
name: "dist"
path: "dist/*.tar.gz"
publish_to_pypi:
name: "Publish to PyPI"
if: startsWith(github.ref, 'refs/tags')
needs: [ run_cpp_tests, build_wheels, make_sdist ]
runs-on: ubuntu-22.04
strategy:
fail-fast: true
steps:
- name: "Download build artifacts"
uses: actions/download-artifact@v3
with:
name: "dist"
path: "dist"
- name: "Publish to PyPI"
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}