Skip to content

Commit

Permalink
Add release ci
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinxc committed Jan 5, 2024
1 parent 2a55fa6 commit 820ff75
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 7 deletions.
26 changes: 24 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,22 @@ version: 2.1
setup: true

orbs:
path-filtering: circleci/[email protected]
path-filtering: circleci/[email protected]
continuation: circleci/[email protected]

parameters:
GHA_Actor:
type: string
default: ""
GHA_Action:
type: string
default: ""
GHA_Event:
type: string
default: ""
GHA_Meta:
type: string
default: ""
enable_regtest:
type: boolean
default: false
Expand All @@ -31,7 +44,10 @@ parameters:
workflows:
run_ut:
when:
not: << pipeline.parameters.enable_regtest >>
and:
- not: << pipeline.parameters.enable_regtest >>
- not: << pipeline.parameters.GHA_Action >>
- not: << pipeline.parameters.GHA_Meta >>
jobs:
- path-filtering/filter:
base-revision: main
Expand All @@ -58,3 +74,9 @@ workflows:
pkg/.* run_regtest true
.bazelrc run_regtest true
.circleci/regtest-config.yml run_regtest true
publish-workflow:
when:
equal: [ "release", << pipeline.parameters.GHA_Event >> ]
jobs:
- continuation/continue:
configuration_path: .circleci/release-config.yml
110 changes: 110 additions & 0 deletions .circleci/release-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Copyright 2023 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_Actor:
type: string
default: ""
GHA_Action:
type: string
default: ""
GHA_Event:
type: string
default: ""
GHA_Meta:
type: string
default: ""

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
build_binary:
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
- image: secretflow/scql-ci:latest
parameters:
resource_class:
type: string
resource_class: << parameters.resource_class >>
shell: /bin/bash --login -eo pipefail
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
steps:
- checkout
- run:
name: "Checkout devtools"
command: git clone https://github.com/secretflow/devtools.git ../devtools
- run:
name: Setup GCS
command: |
echo ${gcs_content} > ../gcs.data
../devtools/bazel_cache_setup.py --in_file=../gcs.data --out_file=gcs.json
- run:
name: "Build"
command: |
make && bazel build //engine/exe:scqlengine -c opt --ui_event_filters=-info,-debug,-warning
- run:
name: "Copy binary"
command: |
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
DIR=/tmp/binary/linux/amd64
else
DIR=/tmp/binary/linux/arm64
fi
mkdir -p ${DIR}
cp bazel-bin/engine/exe/scqlengine ${DIR}
cp bin/scdbserver ${DIR}
cp bin/scdbclient ${DIR}
cp bin/broker ${DIR}
cp bin/brokerctl ${DIR}
- persist_to_workspace:
root: "/tmp/binary/linux"
paths:
- "amd64"
- "arm64"
docker_image_publish:
docker:
- image: cimg/deploy:2023.06.1
steps:
- checkout
- setup_remote_docker
- attach_workspace:
at: /tmp/binary/linux
- run:
name: Build Docker image
command: |
# login docker
# docker login -u secretflow -p ${DOCKER_DEPLOY_TOKEN}
# Build image
cd docker
cp /tmp/binary .
docker buildx build --platform linux/arm64,linux/amd64 -f scql-ubuntu.Dockerfile .
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
publish:
jobs:
- build_binary:
matrix:
parameters:
resource_class: ["2xlarge", "arm.2xlarge"]
- docker_image_publish:
requires:
- build_binary
28 changes: 28 additions & 0 deletions .github/workflows/trigger_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2023 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 Python Package"
on:
release:
types: [published]
permissions: read-all
jobs:
trigger-circleci:
runs-on: ubuntu-latest
steps:
- name: secretflow-scql-deploy
id: secretflow-scql-deploy
uses: CircleCI-Public/[email protected]
env:
CCI_TOKEN: ${{ secrets.CCI_TOKEN }}
10 changes: 5 additions & 5 deletions docker/scql-ubuntu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ RUN apt update \
&& apt upgrade -y \
&& apt clean

COPY ./scqlengine /home/admin/bin/scqlengine
COPY ./scdbserver /home/admin/bin/scdbserver
COPY ./scdbclient /home/admin/bin/scdbclient
COPY ./broker /home/admin/bin/broker
COPY ./brokerctl /home/admin/bin/brokerctl
COPY ./$TARGETPLATFORM/scqlengine /home/admin/bin/scqlengine
COPY ./$TARGETPLATFORM/scdbserver /home/admin/bin/scdbserver
COPY ./$TARGETPLATFORM/scdbclient /home/admin/bin/scdbclient
COPY ./$TARGETPLATFORM/broker /home/admin/bin/broker
COPY ./$TARGETPLATFORM/brokerctl /home/admin/bin/brokerctl

FROM base as image-dev

Expand Down

0 comments on commit 820ff75

Please sign in to comment.