diff --git a/.github/workflows/pypi-wheel-builds.yml b/.github/workflows/pypi-wheel-builds.yml new file mode 100644 index 000000000..c3113ea78 --- /dev/null +++ b/.github/workflows/pypi-wheel-builds.yml @@ -0,0 +1,78 @@ +name: Spglib PyPI Wheel builds for linux + +on: + push: + branches: + - rc + - master + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, windows-2019, macOS-11] + + steps: + - uses: actions/checkout@v3 + + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v2 + with: + platforms: all + + - name: Build wheels + uses: pypa/cibuildwheel@v2.9.0 + env: + CIBW_ARCHS_LINUX: auto aarch64 + CIBW_ARCHS_MACOS: x86_64 arm64 + with: + package-dir: python + output-dir: wheelhouse + config-file: "{package}/pyproject.toml" + + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build sdist + run: | + pip install numpy + cd python + sh pre-build-script.sh + python setup.py sdist + cd .. + - uses: actions/upload-artifact@v3 + with: + path: python/dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + + - name: Publish package to TestPyPI + if: startsWith(github.ref, 'refs/heads/rc') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + + - name: Publish package to PyPI + if: startsWith(github.ref, 'refs/heads/master') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/pypi-wheels-win-mac.yml b/.github/workflows/pypi-wheels-win-mac.yml deleted file mode 100644 index 63bfdf8fe..000000000 --- a/.github/workflows/pypi-wheels-win-mac.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Spglib PyPI Wheel builds for win and mac - -on: - push: - branches: - - rc - - master - -jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-2019, macOS-11] - - steps: - - uses: actions/checkout@v3 - - # Used to host cibuildwheel - - uses: actions/setup-python@v3 - - - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.9.0 - # to supply options, put them in 'env', like: - # env: - # CIBW_SOME_OPTION: value - - - name: Build wheels for macOS - if: matrix.os == 'macOS-11' - env: - CIBW_ARCHS_MACOS: x86_64 arm64 - run: | - python -m cibuildwheel --output-dir wheelhouse python - - - name: Build wheels for win - if: matrix.os != 'macOS-11' - run: | - python -m cibuildwheel --output-dir wheelhouse python - - - uses: actions/upload-artifact@v3 - with: - path: ./wheelhouse/*.whl - - # build_sdist: - # name: Build source distribution - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Build sdist - # run: | - # pip install numpy - # cd python - # sh pre-build-script.sh - # python setup.py sdist - # cd .. - # - uses: actions/upload-artifact@v3 - # with: - # path: python/dist/*.tar.gz - - upload_pypi: - # needs: [build_wheels, build_sdist] - needs: [build_wheels] - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - - name: Publish package to TestPyPI - if: startsWith(github.ref, 'refs/heads/rc') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - - - name: Publish package to PyPI - if: startsWith(github.ref, 'refs/heads/master') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/pypi-wheels.yml b/.github/workflows/pypi-wheels.yml deleted file mode 100644 index 5f1e9e53d..000000000 --- a/.github/workflows/pypi-wheels.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Spglib PyPI Wheel builds - -on: - push: - branches: - - rc - - master - -jobs: - build-wheel: - name: Build ${{ matrix.platform }} wheels - runs-on: ubuntu-latest - strategy: - matrix: - platform: - - manylinux2014_x86_64 - - manylinux2014_aarch64 - - manylinux2010_x86_64 - fail-fast: false - steps: - - uses: actions/checkout@v2 - - - name: Set up QEMU - if: matrix.platform == 'manylinux2014_aarch64' - uses: docker/setup-qemu-action@v1 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Build sdist - if: matrix.platform == 'manylinux2010_x86_64' - run: | - pip install numpy - cd python - sh pre-build-script.sh - python setup.py sdist - cd .. - - name: Build manylinux Python wheels manylinux2014_x86_64 - if: matrix.platform == 'manylinux2014_x86_64' - uses: RalfG/python-wheels-manylinux-build@v0.3.4-manylinux2014_x86_64 - with: - python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310' - pre-build-command: 'sh pre-build-script.sh' - package-path: ./python - - name: Build manylinux Python wheels manylinux2014_aarch64 - if: matrix.platform == 'manylinux2014_aarch64' - uses: RalfG/python-wheels-manylinux-build@v0.3.4-manylinux2014_aarch64 - with: - python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310' - pre-build-command: 'sh pre-build-script.sh' - package-path: ./python - - name: Build manylinux Python wheels manylinux2010_x86_64 - if: matrix.platform == 'manylinux2010_x86_64' - uses: RalfG/python-wheels-manylinux-build@v0.3.4-manylinux2010_x86_64 - with: - python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310' - pre-build-command: 'sh pre-build-script.sh' - package-path: ./python - - name: mkdir - run: | - mkdir dist - - name: copy source - if: matrix.platform == 'manylinux2010_x86_64' - run: | - cp ./python/dist/*.tar.gz dist - - name: copy manylinux wheels - run: | - cp ./python/dist/*manylinux*whl dist - - - name: Publish package to TestPyPI - if: startsWith(github.ref, 'refs/heads/rc') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - - - name: Publish package to PyPI - if: startsWith(github.ref, 'refs/heads/master') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }}