diff --git a/.github/workflows/build_distributions.yml b/.github/workflows/build_distributions.yml new file mode 100644 index 000000000..6dff9ce6c --- /dev/null +++ b/.github/workflows/build_distributions.yml @@ -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/ diff --git a/pyproject.toml b/pyproject.toml index 7fe69ddea..c4b6f5fb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"]