Skip to content

Commit

Permalink
Ad: pip publish workflow (#6)
Browse files Browse the repository at this point in the history
* test pypi publish

* update

* format
  • Loading branch information
oeqqwq authored Sep 14, 2024
1 parent 777e587 commit cefd1d5
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,13 @@ workflows:
.bazelrc sdk-build-and-run true
WORKSPACE sdk-build-and-run true
- lint
sdk-publish-workflow:
when:
equal: [ "release", << pipeline.parameters.GHA_Event >> ]
jobs:
- continuation/continue:
configuration_path: .circleci/release-config.yml
# This is mandatory to trigger a pipeline when pushing a tag
filters:
tags:
only: /^v.*/
126 changes: 126 additions & 0 deletions .circleci/release-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Copyright 2024 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

parameters:
GHA_Action:
type: string
default: ""
GHA_Actor:
type: string
default: ""
GHA_Event:
type: string
default: ""

executors:
linux_x64_executor: # declares a reusable executor
docker:
- image: secretflow/release-ci:latest
resource_class: 2xlarge+
shell: /bin/bash --login -eo pipefail
linux_aarch64_executor:
docker:
- image: secretflow/release-ci-aarch64:latest
resource_class: arm.2xlarge
shell: /bin/bash --login -eo pipefail
macos_arm64_executor:
macos:
xcode: 15.1.0
resource_class: macos.m1.large.gen1

commands:
pip_publish:
parameters:
python_ver:
type: string
steps:
- run:
name: "build package and publish"
command: |
conda create -n build python=<< parameters.python_ver >> -y
conda activate build
python3 -m pip install twine
cd dataproxy_sdk/python
python setup.py bdist_wheel
python3 -m twine upload -r pypi -u __token__ -p ${PYPI_TWINE_TOKEN} dist/*.whl
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
linux_publish:
parameters:
python_ver:
type: string
executor:
type: string
executor: <<parameters.executor>>
steps:
- checkout
- pip_publish:
python_ver: << parameters.python_ver >>

macOS_publish:
parameters:
python_ver:
type: string
executor:
type: string
executor: <<parameters.executor>>
steps:
- checkout
- run:
name: "Install homebrew dependencies"
command: |
brew install bazelisk cmake ninja libomp wget go
- run:
name: "Install Miniconda"
command: |
wget https://repo.anaconda.com/miniconda/Miniconda3-py310_24.1.2-0-MacOSX-arm64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
source $HOME/miniconda/bin/activate
conda init zsh bash
- pip_publish:
python_ver: << parameters.python_ver >>

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
publish:
jobs:
- linux_publish:
matrix:
parameters:
python_ver: ["3.9", "3.10", "3.11"]
executor: ["linux_x64_executor", "linux_aarch64_executor"]
# This is mandatory to trigger a pipeline when pushing a tag
filters:
tags:
only: /^v.*/
- macOS_publish:
matrix:
parameters:
python_ver: ["3.9", "3.10", "3.11"]
executor: ["macos_arm64_executor"]
# This is mandatory to trigger a pipeline when pushing a tag
filters:
tags:
only: /^v.*/
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
name: "Publish SDK Python Package"
on:
release:
types: [published]
permissions: read-all
jobs:
trigger-circleci:
runs-on: ubuntu-latest
steps:
- name: secretflow-serving-deploy
id: secretflow-serving-deploy
uses: CircleCI-Public/[email protected]
env:
CCI_TOKEN: ${{ secrets.CCI_TOKEN }}

0 comments on commit cefd1d5

Please sign in to comment.