-
Notifications
You must be signed in to change notification settings - Fork 38
139 lines (124 loc) · 3.85 KB
/
build.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
name: Build
on:
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
call-test-workflow:
uses: BlueBrain/eFEL/.github/workflows/test.yml@master
tag:
name: Bump version, push tag and make a release
needs: call-test-workflow
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Bump version and push tag
uses: anothrNick/[email protected]
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
id: tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: false
DEFAULT_BUMP: patch
- name: Get and store tag from 'Bump version and push tag' step
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: echo "TAG_NAME=${{ steps.tag.outputs.new_tag }}" >> $GITHUB_ENV
- name: Get and store tag from triggered tag push
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG_NAME }}
name: ${{ env.TAG_NAME }}
generate_release_notes: true
wheels:
needs: [call-test-workflow, tag]
name: Build wheels for ${{ matrix.python }} ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
python: [cp38, cp39, cp310, cp311]
arch: [x86_64, amd64]
exclude:
- os: macos-latest
arch: amd64
- os: ubuntu-20.04
arch: amd64
- os: windows-latest
arch: x86_64
env:
CIBW_BUILD: ${{ matrix.python }}*${{ matrix.arch }}
CIBW_TEST_REQUIRES: pytest neo[neomatlabio]>=0.5.1 pytest-xdist>=3.3.1
CIBW_TEST_COMMAND: pytest -sx -n auto {project}/tests
CIBW_SKIP: "*-musllinux_*"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install cibuildwheel
run: pip install cibuildwheel
- name: Build wheels
run: cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
with:
name: wheels-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
tarball:
name: Build tarball
runs-on: ubuntu-20.04
needs: [call-test-workflow, tag]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Build a source tarball
run:
python setup.py sdist
- uses: actions/upload-artifact@v2
with:
name: tarball
path: dist
publish:
name: Release and Publish on PyPI
runs-on: ubuntu-20.04
needs: [call-test-workflow, tag, wheels, tarball]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Put artifacts into dist directory
run: |
mkdir -p dist
find artifacts -type f \( -iname \*.whl -o -iname \*.tar.gz \) -exec mv {} dist \;
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}