-
Notifications
You must be signed in to change notification settings - Fork 2
144 lines (138 loc) · 4.69 KB
/
build-wheels.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
name: build-wheel
on:
push:
schedule:
- cron: "5 0 * * 0"
jobs:
tag:
name: Tag new version
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
changelog: ${{ steps.tag_version.outputs.changelog }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Bump version and push tag
id: tag_version
if: github.ref == 'refs/heads/master'
uses: anothrNick/github-tag-action@1.64.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: false
DEFAULT_BUMP: patch
wheels:
name: Build wheel on ${{ matrix.python }} ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
arch: [x86_64]
env:
SCCACHE_GHA_ENABLED: "on"
permissions:
contents: write
needs: tag
steps:
- name: Set cibuildwheel Python version
run: |
python_version="${{ matrix.python }}"
cibw_python="cp${python_version/./}"
echo "CIBW_PYTHON=$cibw_python" >> $GITHUB_ENV
- uses: actions/checkout@v4
if: github.ref != 'refs/heads/master'
with:
fetch-depth: 0
- uses: actions/checkout@v4
if: github.ref == 'refs/heads/master'
with:
fetch-depth: 0
ref: ${{ needs.tag.outputs.new_tag }}
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Get dakota src
run: make get-dakota-src
- uses: pypa/cibuildwheel@v2.16
env:
CIBW_BUILD: ${{ env.CIBW_PYTHON }}*${{ matrix.arch }}
- name: Run tests
run: |
pip install pytest
pip install ./wheelhouse/itis_dakota*.whl
make test
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ env.CIBW_PYTHON }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
release:
name: Create new github release
runs-on: ubuntu-latest
permissions:
contents: write
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs:
- tag
- wheels
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.tag.outputs.new_tag }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.tag.outputs.new_tag }}
generateReleaseNotes: true
artifacts: wheels-*
test-pypi:
name: Publish wheels on Test PyPI
runs-on: ubuntu-latest
needs:
- release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
environment:
name: testpypi
url: https://test.pypi.org/p/itis-dakota
permissions:
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
pypi:
name: Publish wheels on PyPI
runs-on: ubuntu-latest
needs:
- test-pypi
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
environment:
name: pypi
url: https://pypi.org/p/itis-dakota
permissions:
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1