Skip to content

Merge pull request #184 from bandframework/sdkupdate #28

Merge pull request #184 from bandframework/sdkupdate

Merge pull request #184 from bandframework/sdkupdate #28

Workflow file for this run

#
# This action could publish distributions that it produces to the surmise PyPI
# account. For more information on potential security issues associated with
# automatic publishing, please refer to
#
# https://docs.pypi.org/trusted-publishers/security-model/
#
# In particular, there exists the possibility of breaking that page or allowing
# nefarious actors to alter it. Since surmise is only released a few times a
# year, we presently prefer the conservative route of manually publishing to
# PyPI the distributions built and tested by this action.
#
# ALL CHANGES TO THIS ACTION SHOULD BE REVIEWED VERY CAREFULLY TO ENSURE THAT
# THE CHANGES ARE AS INTENDED AND WELL UNDERSTOOD!
#
name: Build & test distributions
env:
PKG_ROOT: ${{ github.workspace }}
DIST_PATH: ${{ github.workspace }}/dist
WHEEL_PATH: ${{ github.workspace }}/wheelhouse
on:
push:
branches: [main]
release:
types: [published]
jobs:
build-wheels:
name: Build wheels on ${{ matrix.os }}
strategy:
matrix:
# macOS 13 should build for Intel processors
# macOS 14 should build for Arm64 processors
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
runs-on: ${{ matrix.os }}
steps:
# Clone the repository with the full history since setuptools-scm needs
# the tags to set the correct version.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build & test wheels
uses: pypa/cibuildwheel@v3.1.3
with:
package-dir: ${{ env.PKG_ROOT }}
output-dir: ${{ env.WHEEL_PATH }}
config-file: "{package}/pyproject.toml"
- name: Archive prebuilt wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ${{ env.WHEEL_PATH }}/*.whl
make-sdist:
name: Build source distribution
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.13"]
runs-on: ${{ matrix.os }}
steps:
# Clone the repository with the full history since setuptools-scm needs
# the tags to set the correct version.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Make & test sdist
run: |
# Setup Python
echo ""
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install build
# Build distribution & install
echo ""
pushd $PKG_ROOT
python -m build --sdist
popd
python -m pip install ${{ env.DIST_PATH }}/surmise-*.tar.gz
# Log info
echo ""
which python
python -m pip list
# Run tests through package
echo ""
python -c "import surmise ; exit(not surmise.test())"
- name: Archive source distribution
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: ${{ env.DIST_PATH }}/surmise-*.tar.gz
# THE FOLLOWING SHOULD BE CAREFULLY REVIEWED BEFORE UNCOMMENTING. IT IS
# EFFECTIVELY A PLACEHOLDER.
#
# TODO: Should this only publish on release/publish events?
# https://cibuildwheel.pypa.io/en/stable/deliver-to-pypi/
#pypi-publish:
# name: Upload release to PyPI
# needs: [build-wheels, make-sdist]
# runs-on: ubuntu-latest
# environment:
# name: pypi
# url: https://pypi.org/project/surmise/
# permissions:
# id-token: write
# steps:
# - uses: actions/download-artifact@v5
# with:
# name: cibw-*
# path: dist
# merge-multiple: true
# - name: Publish distribution 📦 to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.PYPI_ACCESS_TOKEN }}