Skip to content

Build torch wheels on CI #1346

Build torch wheels on CI

Build torch wheels on CI #1346

Workflow file for this run

name: Build Python wheels
on:
push:
branches: [main]
tags: ["*"]
pull_request:
# Check all PR
concurrency:
group: wheels-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
FEATOMIC_NO_LOCAL_DEPS: "1"
jobs:
build-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: x86_64 macOS
os: macos-13
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: build manylinux with rust docker image
if: matrix.os == 'ubuntu-22.04'
run: docker build -t rustc-manylinux2014_x86_64 python/scripts/rustc-manylinux2014_x86_64
- name: build featomic wheel
run: python -m cibuildwheel python/featomic
env:
CIBW_BUILD: cp310-*
CIBW_SKIP: "*musllinux*"
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BUILD_VERBOSITY: 2
CIBW_MANYLINUX_X86_64_IMAGE: rustc-manylinux2014_x86_64
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-wheel --ignore-missing-dependencies --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair --exclude libmetatensor.so -w {dest_dir} {wheel}"
CIBW_ENVIRONMENT: >
MACOSX_DEPLOYMENT_TARGET=11
FEATOMIC_NO_LOCAL_DEPS=1
- uses: actions/upload-artifact@v4
with:
name: featomic-wheel-${{ matrix.os }}-${{ matrix.cibw-arch }}
path: ./wheelhouse/*.whl
build-other:
runs-on: ubuntu-22.04
name: sdist
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: build featomic sdist
run: |
pip install build
python -m build --sdist python/featomic
- name: build featomic-torch sdist
run: |
python -m build --sdist python/featomic-torch
- name: create C++ tarballs
run: |
./scripts/package-featomic.sh dist/cxx/
./scripts/package-featomic-torch.sh dist/cxx/
- uses: actions/upload-artifact@v4
with:
name: others
path: |
dist/*.tar.gz
dist/cxx/*.tar.gz
- name: upload sdist to GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.tar.gz
dist/cxx/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
merge-and-release:
name: Merge and release wheels/sdists
needs: [build-wheels, build-others]

Check failure on line 130 in .github/workflows/build-wheels.yml

View workflow run for this annotation

GitHub Actions / Build Python wheels

Invalid workflow file

The workflow is not valid. .github/workflows/build-wheels.yml (Line: 130, Col: 27): Job 'merge-and-release' depends on unknown job 'build-others'.
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Download featomic wheels
uses: actions/download-artifact@v4
with:
path: wheels
pattern: featomic-wheel-*
merge-multiple: true
- name: Download other wheels and sdists
uses: actions/download-artifact@v4
with:
path: wheels
name: others
- name: Re-upload a single wheels artifact
uses: actions/upload-artifact@v4
with:
name: wheels
path: |
wheels/*
wheels/cxx/*
- name: upload to GitHub release (featomic)
if: startsWith(github.ref, 'refs/tags/featomic-v')
uses: softprops/action-gh-release@v2
with:
files: |
wheels/cxx/featomic-cxx-*.tar.gz
wheels/featomic-*
prerelease: ${{ contains(github.ref, '-rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: upload to GitHub release (featomic-torch)
if: startsWith(github.ref, 'refs/tags/featomic-torch-v')
uses: softprops/action-gh-release@v2
with:
files: |
wheels/cxx/featomic-torch-cxx-*.tar.gz
wheels/featomic_torch-*
prerelease: ${{ contains(github.ref, '-rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}