Repository navigation
106 lines (89 loc) · 3.2 KB
/
Copy pathpython-publish.yml
File metadata and controls
106 lines (89 loc) · 3.2 KB
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
name: Build and publish deism
on:
release:
types: [published, prereleased]
permissions:
contents: read
jobs:
build-wheels:
name: Wheels / ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: Linux x86_64
artifact: linux-x86_64
- os: windows-latest
platform: Windows AMD64
artifact: windows-amd64
# No Intel macOS target: numba's llvmlite dependency no longer
# publishes macOS x86_64 wheels, and building it from source needs
# an LLVM toolchain the runner does not carry.
- os: macos-latest
platform: macOS arm64
artifact: macos-arm64
steps:
- uses: actions/checkout@v7
- name: Build and test wheels
uses: pypa/cibuildwheel@v4.2.1
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: deism-wheels-${{ matrix.artifact }}
path: wheelhouse/*.whl
if-no-files-found: error
build-sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Build and check source distribution
run: |
python -m pip install --upgrade pip
python -m pip install build twine
python -m build --sdist
python -m twine check dist/*
- name: Install and smoke-test source distribution in a clean environment
run: |
python -m venv /tmp/deism-sdist-smoke
/tmp/deism-sdist-smoke/bin/python -m pip install --upgrade pip
/tmp/deism-sdist-smoke/bin/python -m pip install dist/*.tar.gz
cd /tmp
/tmp/deism-sdist-smoke/bin/python -c "from deism import DEISM, libroom_deism; from deism.count_reflections_wrapper import CPP_COUNTING_AVAILABLE, count_reflections_cpp; assert libroom_deism is not None; assert CPP_COUNTING_AVAILABLE; assert count_reflections_cpp(0, (3, 4, 5), 343, 1) == 1; assert DEISM('RIR', 'convex', silent=True) is not None"
- name: Upload source distribution
uses: actions/upload-artifact@v7
with:
name: deism-sdist
path: dist/*.tar.gz
if-no-files-found: error
publish:
name: Validate and publish
runs-on: ubuntu-latest
needs: [build-wheels, build-sdist]
steps:
- name: Download all distributions
uses: actions/download-artifact@v8
with:
pattern: deism-*
path: dist
merge-multiple: true
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Validate all distributions
run: |
python -m pip install --upgrade twine
python -m twine check dist/*
- name: Publish production release to PyPI
if: github.event.action == 'published' && !github.event.release.prerelease
run: python -m twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.API_TOKEN }}