mirror of https://github.com/phonopy/phonopy.git
97 lines
2.8 KiB
YAML
97 lines
2.8 KiB
YAML
name: wheel-build-and-deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- make-wheel
|
|
- make-wheel-test
|
|
|
|
jobs:
|
|
build_wheels:
|
|
name: Build wheels on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# Used to host cibuildwheel
|
|
- uses: actions/setup-python@v5
|
|
|
|
- name: Install cibuildwheel
|
|
run: python -m pip install cibuildwheel==2.22.0
|
|
|
|
- name: Build wheels on ubuntu
|
|
if: ${{ startsWith(matrix.os, 'ubuntu') }}
|
|
run: |
|
|
git tag v`grep __version__ phonopy/version.py|awk -F'"' '{print($2)}'`
|
|
python -m cibuildwheel --output-dir wheelhouse
|
|
env:
|
|
CIBW_SKIP: "cp39-* pp* *_i686 *musllinux*"
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
|
|
- name: Build wheels on macos
|
|
if: ${{ startsWith(matrix.os, 'macos') }}
|
|
run: |
|
|
git tag v`grep __version__ phonopy/version.py|awk -F'"' '{print($2)}'`
|
|
python -m cibuildwheel --output-dir wheelhouse
|
|
env:
|
|
CIBW_SKIP: "cp39-* pp*"
|
|
# CIBW_ARCHS_MACOS: "x86_64 arm64"
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
|
|
- name: Build wheels on windows
|
|
if: ${{ startsWith(matrix.os, 'windows') }}
|
|
run: |
|
|
$version = Select-String -Path "phonopy\version.py" -Pattern '__version__' | ForEach-Object {
|
|
($_ -split '"')[1]
|
|
}
|
|
git tag "v$version"
|
|
Write-Output "The value of version is: $version"
|
|
python -m cibuildwheel --output-dir wheelhouse
|
|
env:
|
|
CIBW_SKIP: "cp39-* pp*"
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
path: ./wheelhouse/*.whl
|
|
|
|
upload_pypi_test:
|
|
name: Upload to PyPI (test)
|
|
needs: [build_wheels,]
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/make-wheel-test' }}
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: cibw-wheels-*
|
|
path: dist
|
|
merge-multiple: true
|
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
repository-url: https://test.pypi.org/legacy/
|
|
skip-existing: true
|
|
|
|
upload_pypi:
|
|
name: Upload to PyPI
|
|
needs: [build_wheels,]
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/make-wheel' }}
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: cibw-wheels-*
|
|
path: dist
|
|
merge-multiple: true
|
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
skip-existing: true
|