Skip to content

Nanobind port: Order module #31

Nanobind port: Order module

Nanobind port: Order module #31

Workflow file for this run

name: release
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- "main"
- "nanobind"
- "next"
tags:
- "*"
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
env:
name: freud
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
build_wheels:
name: Build wheels [${{ matrix.python.version }}, ${{ matrix.os.base }}-${{ matrix.os.arch }}]
runs-on: ${{ matrix.os.base }}-${{ matrix.os.version }}
strategy:
fail-fast: false
matrix:
os:
- base: ubuntu
version: latest
arch: 'x86_64'
# - base: windows
# version: latest
# arch: 'amd64'
- base: macos
version: 14
arch: 'arm64'
- base: macos
version: 13
arch: 'x86_64'
python:
# Pinned versions installed in CIBW_TEST_REQIURES are kept. Those defined installed in
# CIBW_BEFORE_TEST are often upgraded when the wheel is installed. This means we can't
# store the pinned requirements in a requirements file.
# Generate these version sets with commands like this:
# echo -e "numpy==1.21.6\nscipy\ngsd\nmatplotlib\nsympy" | uv pip compile --python-platform linux --python-version 3.9 --only-binary :all: - --resolution=lowest --no-deps
- version: 'cp39'
oldest_numpy: '1.22.4'
oldest_scipy: '1.7.3'
oldest_gsd: '2.5.0'
oldest_matplotlib: '3.5.0'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
- version: 'cp310'
oldest_numpy: '1.22.4'
oldest_scipy: '1.7.3'
oldest_gsd: '2.7.0'
oldest_matplotlib: '3.5.0'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
- version: 'cp311'
oldest_numpy: '1.23.2'
oldest_scipy: '1.9.2'
oldest_gsd: '2.7.0'
oldest_matplotlib: '3.6.0'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
- version: 'cp312'
oldest_numpy: '1.26.2'
oldest_scipy: '1.11.2'
oldest_gsd: '3.2.0'
oldest_matplotlib: '3.7.3'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
- version: 'cp313'
oldest_numpy: '2.1.2'
oldest_scipy: '1.14.1'
oldest_gsd: '3.4.1'
oldest_matplotlib: '3.9.2'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
steps:
- name: checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: "recursive"
- name: Build wheels
uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0
env:
CIBW_BUILD: "${{ matrix.python.version }}-*"
CIBW_SKIP: "{pp*,*-musllinux_*}"
# Build only on 64-bit architectures.
CIBW_ARCHS: auto64
# Configure environment variables.
CIBW_ENVIRONMENT_LINUX: "CMAKE_PREFIX_PATH=/project/tbb LD_LIBRARY_PATH=/project/tbb/lib/intel64/gcc4.8:$LD_LIBRARY_PATH CMAKE_ARGS=-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=True"
CIBW_ENVIRONMENT_MACOS: "CMAKE_PREFIX_PATH=/Users/runner/work/freud/freud/tbb:/Users/runner/work/tbb-install CMAKE_ARGS=-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=True"
MACOSX_DEPLOYMENT_TARGET: "11.0"
# Set up TBB.
CIBW_BEFORE_BUILD_LINUX: "source .github/workflows/cibuildwheel-before-build.sh {package} linux"
CIBW_BEFORE_BUILD_MACOS: "source .github/workflows/cibuildwheel-before-build.sh {package} macos"
CIBW_BEFORE_BUILD_WINDOWS: "powershell .github/workflows/cibuildwheel-before-build.ps1 {package}"
# Test the wheels.
CIBW_TEST_REQUIRES: >
pytest==${{ matrix.python.oldest_pytest }}
sympy==${{ matrix.python.oldest_sympy }}
numpy==${{ matrix.python.oldest_numpy }}
scipy==${{ matrix.python.oldest_scipy }}
gsd==${{ matrix.python.oldest_gsd }}
matplotlib==${{ matrix.python.oldest_matplotlib }}
# Test only the currently ported modules
CIBW_TEST_COMMAND: "cd {package}/tests && pytest test_box_box.py test_parallel.py test_locality_*.py test_data.py test_pmft.py test_util.py test_msd_msd.py test_interface.py test_order_*.py test_cluster.py -v --log-level=DEBUG"
# CIBW_TEST_COMMAND: "cd {package}/tests && pytest . -v --log-level=DEBUG"
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: dist-${{ matrix.os.base }}-${{ matrix.os.version }}-${{ matrix.python.version }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: "recursive"
- name: Set up Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: "3.13"
- name: Set up Python environment
uses: glotzerlab/workflows/setup-uv@e130dd2814c7db5635babe4427dedcbd5aab76d4 # 0.5.0
with:
lockfile: ".github/workflows/environments/requirements-build-sdist.txt"
- name: Build sdist
run: python -m build --installer uv --sdist --outdir dist/ .
- name: Check sdist size
run: du -hs dist/*
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: dist-sdist
path: dist/*.tar.gz
upload_pypi:
name: Publish [PyPI]
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
concurrency: upload
steps:
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
merge-multiple: 'true'
pattern: dist-*
path: dist
- name: Check files
run: ls -lR dist
- name: Upload to PyPI
# upload to PyPI on every tag starting with 'v'
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Slack notification
if: startsWith(github.ref, 'refs/tags/v') || failure()
uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
with:
status: ${{ job.status }}
channel: '#dev-freud'
source:
name: Build source tarball
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
path: code
submodules: true
- name: Determine filename-safe ref from GITHUB_REF_NAME
run: echo ref="$(echo "${GITHUB_REF_NAME}" | sed -e 's/\//-/g')" >> "$GITHUB_ENV"
- name: Copy source
run: cp -R code "${name}-${ref}"
- name: Remove .git
run: rm -rf "${name}-${ref}/.git"
- name: Remove examples data
run: rm -rf "${name}-${ref}/doc/source/gettingstarted/examples" && ls -laR "${name}-${ref}"
- name: Tar/zstd source
run: tar --zstd -cvf "${name}-${ref}.tar.zst" "${name}-${ref}"
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: source
path: |
*.tar.*
release-notes:
name: Extract release notes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
path: code
- name: Write release-notes.md
# 1. Search for the content from the start of the file to the 2nd version heading.
# 2. Remove the 2nd version heading.
# 3. Search for the content after the first version heading (removes any description at the
# start of the file.
# 4. Remove the 1st version heading.
# This leaves the content of the release notes for the current release.
run: >
grep -P -m 2 -B 10000 "^## v*\d*\.\d*\.\d*" ChangeLog.md |
sed '$d' |
grep -P -A 10000 "^## v*\d*\.\d*\.\d*" |
sed '1d' |
tee "${GITHUB_WORKSPACE}/release-notes.md"
working-directory: code
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: release-notes
path: |
release-notes.md
publish_github:
name: Publish [GitHub]
needs: [release-notes, source]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
merge-multiple: true
- name: List files
run: ls -lR
- name: Create release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
*.zst
body_path: release-notes.md
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}