Skip to content

Merge devel into master (#2772) #121

Merge devel into master (#2772)

Merge devel into master (#2772) #121

Workflow file for this run

name: Build and upload to PyPI
on:
push:
pull_request:
jobs:
build_wheels:
name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# linux-64
- os: ubuntu-latest
python: 311
platform_id: manylinux_x86_64
dp_variant: cuda
# macos-x86-64
- os: macos-latest
python: 311
platform_id: macosx_x86_64
dp_variant: cpu
# macos-arm64
- os: macos-latest
python: 311
platform_id: macosx_arm64
dp_variant: cpu
# win-64
- os: windows-2019
python: 311
platform_id: win_amd64
dp_variant: cpu
# linux-aarch64
- os: ubuntu-latest
python: 310
platform_id: manylinux_aarch64
dp_variant: cpu
steps:
- uses: actions/checkout@v3
with:
submodules: true
# https://github.com/pypa/setuptools_scm/issues/480
fetch-depth: 0
- uses: docker/setup-qemu-action@v2
name: Setup QEMU
if: matrix.platform_id == 'manylinux_aarch64'
- name: Build wheels
uses: pypa/cibuildwheel@v2.15
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS: all
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
DP_VARIANT: ${{ matrix.dp_variant }}
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.11'
- run: python -m pip install build
- name: Build sdist
run: python -m build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
build_docker:
# use the already built wheels to build docker
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: artifact
path: source/install/docker/dist
- name: Log in to the Container registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175
with:
images: ghcr.io/deepmodeling/deepmd-kit
- name: Build and push Docker image
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
with:
context: source/install/docker
push: ${{ github.repository_owner == 'deepmodeling' && github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
pass:
name: Pass testing build wheels
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: always()
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}