name: Wheels

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
     - sparse-blossom-remove-skbuild
  release:
    types:
      - published

jobs:
  build_sdist:
    name: Build SDist
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        submodules: true

    - name: Build SDist
      run: pipx run build --sdist

    - name: Check metadata
      run: pipx run twine check dist/*

    - uses: actions/upload-artifact@v3
      with:
        path: dist/*.tar.gz


  build_wheels:
    name: Wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    env:
      MACOSX_DEPLOYMENT_TARGET: "10.15"
      CIBW_BUILD: "cp3*-*"
      CIBW_SKIP: "*-win32"
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-2022, macos-latest]

    steps:
    - uses: actions/checkout@v3
      with:
        submodules: true

    - uses: pypa/cibuildwheel@v2.11.1
      env:
        CIBW_ARCHS_MACOS: auto universal2

    - name: Verify clean directory
      run: git diff --exit-code
      shell: bash

    - name: Upload wheels
      uses: actions/upload-artifact@v3
      with:
        path: wheelhouse/*.whl


name: Wheels

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
     - sparse-blossom-remove-skbuild
  release:
    types:
      - published

jobs:
  build_sdist:
    name: Build SDist
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        submodules: true

    - name: Build SDist
      run: pipx run build --sdist

    - name: Check metadata
      run: pipx run twine check dist/*

    - uses: actions/upload-artifact@v3
      with:
        path: dist/*.tar.gz


  build_wheels:
    name: Wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    env:
      MACOSX_DEPLOYMENT_TARGET: "10.15"
      CIBW_BUILD: "cp3*-*"
      CIBW_SKIP: "*-win32"
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-2022, macos-latest]

    steps:
    - uses: actions/checkout@v3
      with:
        submodules: true

    - uses: pypa/cibuildwheel@v2.11.1
      env:
        CIBW_ARCHS_MACOS: "x86_64 arm64"
        CIBW_BEFORE_BUILD: pip install --upgrade ninja
        CIBW_TEST_REQUIRES: pytest
        CIBW_TEST_COMMAND: pytest {project}/src

    - name: Verify clean directory
      run: git diff --exit-code
      shell: bash

    - name: Upload wheels
      uses: actions/upload-artifact@v3
      with:
        path: wheelhouse/*.whl


Add CIBW tests and ninja build requirement
Add CIBW tests and ninja build requirement
