-
Notifications
You must be signed in to change notification settings - Fork 10
145 lines (129 loc) · 4.08 KB
/
build-python.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
name: Build Python
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build-wheel:
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- name: Windows x86_64
os: windows-2022
version: "3.9"
cmake-env:
- name: Windows x86_64
os: windows-2022
version: "3.10"
cmake-env:
- name: Windows x86_64
os: windows-2022
version: "3.11"
cmake-env:
- name: Windows x86_64
os: windows-2022
version: "3.12"
cmake-env:
- name: Linux x86_64
os: ubuntu-24.04
version: "3.9"
cmake-env:
- name: Linux x86_64
os: ubuntu-24.04
version: "3.10"
cmake-env:
- name: Linux x86_64
os: ubuntu-24.04
version: "3.11"
cmake-env:
- name: Linux x86_64
os: ubuntu-24.04
version: "3.12"
cmake-env:
- name: macOS universal
os: macOS-14
version: "3.10"
cmake-env: CMAKE_OSX_ARCHITECTURES="x86_64;arm64"
- name: macOS universal
os: macOS-14
version: "3.11"
cmake-env: CMAKE_OSX_ARCHITECTURES="x86_64;arm64"
- name: macOS universal
os: macOS-14
version: "3.12"
cmake-env: CMAKE_OSX_ARCHITECTURES="x86_64;arm64"
name: ${{ matrix.version }} ${{ matrix.name }} wheel
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Make GCC 14 the default toolchain (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 200
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 200
- run: sudo xcode-select -switch /Applications/Xcode_15.3.app
if: startsWith(matrix.os, 'macOS')
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
- run: pip install typing_extensions
if: matrix.version == '3.9' || matrix.version == '3.10'
- run: python3 ./tools/update_version.py
- run: pip3 install build pytest
- run: ${{ matrix.cmake-env }} python3 -m build --wheel
- run: python3 ../.github/workflows/repair_wheel.py sleipnirgroup_jormungandr-*.whl
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macOS')
working-directory: dist
- run: pip3 install dist/sleipnirgroup_jormungandr-*.whl
shell: bash
- run: pytest
shell: bash
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.version }} ${{ matrix.name }} wheel
path: dist
build-sdist:
timeout-minutes: 10
name: sdist
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.12
- run: python3 ./tools/update_version.py
- run: pip3 install build
- run: python3 -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-24.04
needs: [build-wheel, build-sdist]
if: github.repository_owner == 'SleipnirGroup' && github.ref == 'refs/heads/main'
environment:
name: pypi
url: https://pypi.org/p/sleipnirgroup-jormungandr
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: '* wheel'
merge-multiple: true
- uses: actions/download-artifact@v4
with:
path: dist
pattern: 'sdist'
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1