Skip to content

Commit

Permalink
Merge pull request #380 from simpeg/github_action_wheels
Browse files Browse the repository at this point in the history
Create build_distributions.yml
  • Loading branch information
jcapriot authored Oct 18, 2024
2 parents e6b3a87 + fa7f4fb commit e3b5f01
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/build_distributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build Distribution artifacts

on: [push, pull_request]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
# env:
# CIBW_SOME_OPTION: value
# ...
# with:
# package-dir: .
# output-dir: wheelhouse
# config-file: "{package}/pyproject.toml"

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
# with:
# To test: repository-url: https://test.pypi.org/legacy/
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ build-verbosity = "3"
# test importing discretize to make sure externals are loadable.
test-command = 'python -c "import discretize; print(discretize.__version__)"'


# use the visual studio compilers
[tool.cibuildwheel.windows.config-settings]
setup-args = [
'--vsenv'
]

[tool.coverage.run]
branch = true
source = ["discretize", "tests", "examples", "tutorials"]
Expand Down

0 comments on commit e3b5f01

Please sign in to comment.