Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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.

version: 2.1

setup: true

orbs:
path-filtering: circleci/path-filtering@1.0.0
continuation: circleci/continuation@1.0.0

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

workflows:
unittest-workflow:
when:
and:
- not: << pipeline.parameters.GHA_Action >>
- not: << pipeline.parameters.GHA_Meta >>
jobs:
- path-filtering/filter:
base-revision: main
config-path: .circleci/continue-config.yml
mapping: |
requirements.txt base true
dev-requirements.txt base true
.circleci/continue-config.yml base true
secretflow_spec/.* spec true
tests/.* test true
publish-workflow:
when:
equal: ["publish_pypi", << pipeline.parameters.GHA_Meta >>]
jobs:
- continuation/continue:
configuration_path: .circleci/release-config.yml
116 changes: 116 additions & 0 deletions .circleci/continue-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
parameters:
base:
type: boolean
default: false
spec:
type: boolean
default: false
test:
type: boolean
default: false

executors:
linux_executor: # declares a reusable executor
parameters:
resource_class:
type: string
docker:
- image: secretflow/ubuntu-base-ci:latest
resource_class: << parameters.resource_class >>
shell: /bin/bash --login -eo pipefail

commands:
kill_countdown:
steps:
- run:
name: Cancel job after set time
background: true
command: |
sleep 2400
echo "Canceling workflow as too much time has elapsed"
curl -X POST --header "Content-Type: application/json" "https://circleci.com/api/v2/workflow/${CIRCLE_WORKFLOW_ID}/cancel?circle-token=${BUILD_TIMER_TOKEN}"
pytest_wrapper:
parameters:
target_folder:
type: string
steps:
- restore_cache:
name: restore pip cache
key: pip-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}
- run:
name: Install test tools
command: |
conda init
pip install -r dev-requirements.txt
pip install --force-reinstall pytest
- run:
name: "Run tests"
command: |
conda init
pytest --suppress-no-test-exit-code -n auto --junitxml=results.xml -v -x --capture=no --cov=secretflow_spec/ --cov-report=xml:coverage.xml << parameters.target_folder >>
- store_test_results:
path: ./results.xml
run_test:
steps:
- kill_countdown
- when:
condition:
or:
- << pipeline.parameters.spec >>
- << pipeline.parameters.test >>
steps:
- pytest_wrapper:
target_folder: tests
jobs:
linux_build:
parameters:
resource_class:
type: string
executor:
name: linux_executor
resource_class: << parameters.resource_class >>
steps:
- checkout
- restore_cache:
name: restore pip cache
key: &pip-cache pip-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}
- run:
name: Install python deps
command: |
conda init
arch=$(uname -i)
mkdir -p artifacts
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
- persist_to_workspace:
root: .
paths:
- artifacts
- save_cache:
key: *pip-cache
paths:
- /root/miniconda3/lib/python3.10/site-packages
run_test:
parameters:
resource_class:
type: string
executor:
name: linux_executor
resource_class: << parameters.resource_class >>
steps:
- checkout
- run_test

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
build_and_test:
jobs:
- linux_build:
name: linux_build-<<matrix.resource_class>>
matrix:
parameters:
resource_class: ["2xlarge+"]
- run_test
72 changes: 72 additions & 0 deletions .circleci/release-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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_Actor:
type: string
default: ""
GHA_Action:
type: string
default: ""
GHA_Event:
type: string
default: ""
GHA_Meta:
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

commands:
build_and_upload:
parameters:
python_ver:
type: string
steps:
- checkout
- run:
name: "build package and publish"
command: |
conda create -n build python=<< parameters.python_ver >> -y
conda activate build

python3 setup.py bdist_wheel
python3 setup.py clean

ls dist/*.whl
python3 -m pip install twine
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
- build_and_upload:
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.10"]
executor: [ "linux_x64_executor"]
filters:
tags:
only: /.*/
11 changes: 11 additions & 0 deletions .condarc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
custom_channels:
conda-forge: https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
msys2: https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
bioconda: https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
menpo: https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
15 changes: 15 additions & 0 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Publish PyPI Package"
on:
workflow_dispatch:

jobs:
trigger-circleci:
runs-on: ubuntu-latest
steps:
- name: spec-deploy
id: spec-deploy
uses: CircleCI-Public/trigger-circleci-pipeline-action@v1.0.5
with:
GHA_Meta: "publish_pypi"
env:
CCI_TOKEN: ${{ secrets.CCI_TOKEN }}
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@ bazel-*

# macos
.DS_Store

.pytest_cache/
.coverage
coverage.xml
results.xml
dist

# build
build/
secretflow_spec.egg-info/
secretflow_spec/protos/protoc-26.1/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ After you modified protos, please check with API Linter.

```bash
go install github.com/googleapis/api-linter/cmd/api-linter@latest
sh run_api_linter.sh
sh secretflow_spec/protos/run_api_linter.sh
```
13 changes: 0 additions & 13 deletions api_linter_config.json

This file was deleted.

11 changes: 11 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
cd "$(dirname "$(readlink -f "$0")")"

FILE="secretflow_spec/version.py"
CACHE=$(cat "$FILE")

rm -f dist/*.whl
python3 setup.py bdist_wheel
rm -rf ./build ./secretflow_spec.egg-info

echo "$CACHE" > "$FILE"
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest==7.3.1
pytest-cov==4.0.0
1 change: 1 addition & 0 deletions docs/locale/zh_CN/LC_MESSAGES/README.po
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ msgstr ""
#: ../../README.md:22
msgid "The generated html is at **_build/html/**"
msgstr ""

1 change: 1 addition & 0 deletions docs/locale/zh_CN/LC_MESSAGES/index.po
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ msgid ""
"We officially launch the first version of Specification with SecretFlow "
"1.0.0."
msgstr "我们伴随 SecretFlow 1.0.0 发布了第一个版本。"

1 change: 1 addition & 0 deletions docs/locale/zh_CN/LC_MESSAGES/intro.po
Original file line number Diff line number Diff line change
Expand Up @@ -955,3 +955,4 @@ msgstr ""
msgid "In SecretFlow, the type str for Report is *sf.report*."
msgstr ""
"在SecretFlow中,Report的类型为 *sf.report* 。"

1 change: 1 addition & 0 deletions docs/locale/zh_CN/LC_MESSAGES/spec.po
Original file line number Diff line number Diff line change
Expand Up @@ -1600,3 +1600,4 @@ msgstr ""
#~ "The path of attributes. The attribute"
#~ " path for a TableAttrDef is `(input"
#~ msgstr "属性路径。 一个TableAttrDef的属性路径为 `(input"

1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ sphinx==5.3.0
myst-parser==0.18.1
sphinx-intl==2.1.0
pydata-sphinx-theme

Loading