Skip to content

Commit e3b5f01

Browse files
authored
Merge pull request #380 from simpeg/github_action_wheels
Create build_distributions.yml
2 parents e6b3a87 + fa7f4fb commit e3b5f01

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build Distribution artifacts
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build wheels on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
# macos-13 is an intel runner, macos-14 is apple silicon
12+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Build wheels
20+
uses: pypa/cibuildwheel@v2.21.3
21+
# env:
22+
# CIBW_SOME_OPTION: value
23+
# ...
24+
# with:
25+
# package-dir: .
26+
# output-dir: wheelhouse
27+
# config-file: "{package}/pyproject.toml"
28+
29+
- uses: actions/upload-artifact@v4
30+
with:
31+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
32+
path: ./wheelhouse/*.whl
33+
34+
build_sdist:
35+
name: Build source distribution
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
41+
42+
- name: Build sdist
43+
run: pipx run build --sdist
44+
45+
- uses: actions/upload-artifact@v4
46+
with:
47+
name: cibw-sdist
48+
path: dist/*.tar.gz
49+
50+
upload_pypi:
51+
needs: [build_wheels, build_sdist]
52+
runs-on: ubuntu-latest
53+
environment: pypi
54+
permissions:
55+
id-token: write
56+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
57+
steps:
58+
- uses: actions/download-artifact@v4
59+
with:
60+
# unpacks all CIBW artifacts into dist/
61+
pattern: cibw-*
62+
path: dist
63+
merge-multiple: true
64+
65+
- uses: pypa/gh-action-pypi-publish@release/v1
66+
# with:
67+
# To test: repository-url: https://test.pypi.org/legacy/

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ build-verbosity = "3"
117117
# test importing discretize to make sure externals are loadable.
118118
test-command = 'python -c "import discretize; print(discretize.__version__)"'
119119

120+
121+
# use the visual studio compilers
122+
[tool.cibuildwheel.windows.config-settings]
123+
setup-args = [
124+
'--vsenv'
125+
]
126+
120127
[tool.coverage.run]
121128
branch = true
122129
source = ["discretize", "tests", "examples", "tutorials"]

0 commit comments

Comments
 (0)