Port sample/feature selection from equisolve to metatensor-learn
#2491
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Python wheels | |
on: | |
push: | |
branches: [master] | |
tags: ["*"] | |
pull_request: | |
# Check all PR | |
concurrency: | |
group: python-wheels-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
env: | |
METATENSOR_NO_LOCAL_DEPS: "1" | |
jobs: | |
build-core-wheels: | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.name }} | |
strategy: | |
matrix: | |
include: | |
- name: x86_64 Linux | |
os: ubuntu-22.04 | |
rust-target: x86_64-unknown-linux-gnu | |
cibw_arch: x86_64 | |
- name: Aarch64 Linux | |
os: ubuntu-22.04 | |
rust-target: aarch64-unknown-linux-gnu | |
cibw_arch: aarch64 | |
- name: x86_64 macOS | |
os: macos-11 | |
rust-target: x86_64-apple-darwin | |
cibw_arch: x86_64 | |
- name: M1 macOS | |
os: macos-14 | |
rust-target: aarch64-apple-darwin | |
cibw_arch: arm64 | |
- name: x86_64 Windows | |
os: windows-2019 | |
# TODO: add a 32-bit windows builder? | |
rust-target: x86_64-pc-windows-msvc | |
cibw_arch: AMD64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
target: ${{ matrix.rust-target }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: install dependencies | |
run: python -m pip install cibuildwheel twine | |
- name: Set up QEMU for docker | |
if: matrix.os == 'ubuntu-22.04' | |
uses: docker/setup-qemu-action@v3 | |
- name: build manylinux with rust docker image | |
if: matrix.os == 'ubuntu-22.04' | |
run: docker build -t rustc-manylinux2014_${{ matrix.cibw_arch }} python/scripts/rustc-manylinux2014_${{ matrix.cibw_arch }} | |
- name: build metatensor-core wheel | |
run: python -m cibuildwheel python/metatensor-core | |
env: | |
CIBW_BUILD: cp311-* | |
CIBW_SKIP: "*musllinux*" | |
CIBW_ARCHS: ${{ matrix.cibw_arch }} | |
CIBW_BUILD_VERBOSITY: 2 | |
CIBW_MANYLINUX_X86_64_IMAGE: rustc-manylinux2014_x86_64 | |
CIBW_MANYLINUX_AARCH64_IMAGE: rustc-manylinux2014_aarch64 | |
- name: check wheels with twine | |
run: twine check wheelhouse/* | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
- name: upload wheel to GitHub release | |
if: startsWith(github.ref, 'refs/tags/metatensor-core-v') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./wheelhouse/*.whl | |
prerelease: ${{ contains(github.ref, '-rc') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-others: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: install dependencies | |
run: python -m pip install wheel build twine | |
- name: build metatensor-core sdist | |
run: python -m build python/metatensor-core --sdist --outdir=dist/ | |
- name: build metatensor-operations sdist and wheel | |
run: python -m build python/metatensor-operations --outdir=dist/ | |
- name: build metatensor-learn sdist and wheel | |
run: python -m build python/metatensor-learn --outdir=dist/ | |
- name: build metatensor-torch sdist | |
run: python -m build python/metatensor-torch --sdist --outdir=dist/ | |
- name: build metatensor sdist and wheel | |
run: python -m build . --outdir=dist/ | |
- name: check sdist and wheels with twine | |
run: twine check dist/*.tar.gz dist/*.whl | |
- name: create C++ tarballs | |
run: | | |
./scripts/package-core.sh dist/cxx/ | |
./scripts/package-torch.sh dist/cxx/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: | | |
dist/*.tar.gz | |
dist/cxx/*.tar.gz | |
dist/*.whl | |
- name: upload to GitHub release (metatensor-core) | |
if: startsWith(github.ref, 'refs/tags/metatensor-core-v') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/metatensor-core-*.tar.gz | |
dist/cxx/metatensor-core-cxx-*.tar.gz | |
dist/metatensor_core-*.whl | |
prerelease: ${{ contains(github.ref, '-rc') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: upload to GitHub release (metatensor-torch) | |
if: startsWith(github.ref, 'refs/tags/metatensor-torch-v') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/metatensor-torch-*.tar.gz | |
dist/cxx/metatensor-torch-cxx-*.tar.gz | |
dist/metatensor_torch-*.whl | |
prerelease: ${{ contains(github.ref, '-rc') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: upload to GitHub release (metatensor-operations) | |
if: startsWith(github.ref, 'refs/tags/metatensor-operations-v') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/metatensor-operations-*.tar.gz | |
dist/metatensor_operations-*.whl | |
prerelease: ${{ contains(github.ref, '-rc') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: upload to GitHub release (metatensor-learn) | |
if: startsWith(github.ref, 'refs/tags/metatensor-learn-v') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/metatensor-learn-*.tar.gz | |
dist/metatensor_learn-*.whl | |
prerelease: ${{ contains(github.ref, '-rc') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: remove all sdist except metatensor | |
run: | | |
rm dist/metatensor-core-*.tar.gz | |
rm dist/metatensor-torch-*.tar.gz | |
rm dist/metatensor-learn-*.tar.gz | |
rm dist/metatensor-operations-*.tar.gz | |
- name: upload to GitHub release (metatensor-python) | |
if: startsWith(github.ref, 'refs/tags/metatensor-python-v') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/metatensor-*.tar.gz | |
dist/metatensor-*.whl | |
prerelease: ${{ contains(github.ref, '-rc') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |