Skip to content

Commit ed9d159

Browse files
authored
Tweak ci pipeline (#595)
1 parent d3fe979 commit ed9d159

File tree

4 files changed

+101
-275
lines changed

4 files changed

+101
-275
lines changed

.circleci/config.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,4 @@ workflows:
9999
# This is mandatory to trigger a pipeline when pushing a tag
100100
filters:
101101
tags:
102-
only: /.*(?<!dev\d{8})$/
103-
- continuation/continue:
104-
configuration_path: .circleci/dev-release-config.yml
105-
# This is mandatory to trigger a pipeline when pushing a tag
106-
filters:
107-
tags:
108-
only: /.*(?<=dev\d{8})$/
109-
102+
only: /.*/

.circleci/continue-config.yml

+44-92
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,25 @@ parameters:
2121
type: boolean
2222
default: false
2323

24-
# Define a job to be invoked later in a workflow.
25-
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
26-
jobs:
27-
linux_ut:
28-
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
29-
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
30-
docker:
31-
- image: secretflow/ubuntu-base-ci:latest
24+
executors:
25+
linux_executor: # declares a reusable executor
3226
parameters:
3327
resource_class:
3428
type: string
29+
docker:
30+
- image: secretflow/ubuntu-base-ci:latest
3531
resource_class: << parameters.resource_class >>
3632
shell: /bin/bash --login -eo pipefail
37-
# Add steps to the job
38-
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
33+
34+
commands:
35+
build_and_test:
36+
parameters:
37+
targets:
38+
type: string
39+
default: "//..."
40+
extra_bazel_test_args:
41+
type: string
42+
default: ""
3943
steps:
4044
# Kill the whole ci after 1hr
4145
- run:
@@ -45,14 +49,12 @@ jobs:
4549
sleep 7200
4650
echo "Canceling workflow as too much time has elapsed"
4751
curl -X POST --header "Content-Type: application/json" "https://circleci.com/api/v2/workflow/${CIRCLE_WORKFLOW_ID}/cancel?circle-token=${BUILD_TIMER_TOKEN}"
48-
- checkout
4952
- run:
5053
name: Checkout devtools
5154
command: git clone https://github.com/secretflow/devtools.git ../devtools
5255
- run:
5356
name: "Install dependencies"
5457
command: |
55-
python3 -m pip install -U pip
5658
python3 -m pip install -r requirements.txt
5759
python3 -m pip install -r requirements-dev.txt
5860
- run:
@@ -62,83 +64,57 @@ jobs:
6264
../devtools/bazel_cache_setup.py --in_file=../gcs.data --out_file=../gcs.json --min_download
6365
- run:
6466
name: "build"
65-
command: bazel build //... -c opt --ui_event_filters=-info,-debug,-warning --jobs 20
67+
command: bazel build <<parameters.targets>> -c opt --ui_event_filters=-info,-debug,-warning --jobs 20
6668
- run:
6769
name: "test"
6870
command: |
6971
set +e
7072
declare -i test_status
71-
bazel test //... -c opt --ui_event_filters=-info,-debug,-warning --test_output=errors| tee test_result.log; test_status=${PIPESTATUS[0]}
73+
bazel test <<parameters.extra_bazel_test_args>> <<parameters.targets>> -c opt --ui_event_filters=-info,-debug,-warning --test_output=errors| tee test_result.log; test_status=${PIPESTATUS[0]}
7274
7375
sh ../devtools/rename-junit-xml.sh
74-
find bazel-bin/ -executable -type f -name "*_test" -print0 | xargs -0 tar -cvzf test_binary.tar.gz
7576
find bazel-testlogs/ -type f -name "test.log" -print0 | xargs -0 tar -cvzf test_logs.tar.gz
7677
7778
exit ${test_status}
7879
- store_test_results:
7980
path: test-results
80-
- store_artifacts:
81-
path: test_binary.tar.gz
8281
- store_artifacts:
8382
path: test_logs.tar.gz
84-
linux_ml_ut:
85-
docker:
86-
- image: secretflow/ubuntu-base-ci:latest
87-
# arm is not supported
88-
resource_class: 2xlarge
89-
shell: /bin/bash --login -eo pipefail
83+
84+
# Define a job to be invoked later in a workflow.
85+
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
86+
jobs:
87+
linux_ut:
88+
parameters:
89+
resource_class:
90+
type: string
91+
executor:
92+
name: linux_executor
93+
resource_class: << parameters.resource_class >>
94+
# Add steps to the job
95+
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
9096
steps:
91-
- run:
92-
name: Cancel build after set time
93-
background: true
94-
command: |
95-
sleep 7200
96-
echo "Canceling workflow as too much time has elapsed"
97-
curl -X POST --header "Content-Type: application/json" "https://circleci.com/api/v2/workflow/${CIRCLE_WORKFLOW_ID}/cancel?circle-token=${BUILD_TIMER_TOKEN}"
9897
- checkout
98+
- build_and_test
99+
linux_ml_ut:
100+
executor:
101+
name: linux_executor
102+
resource_class: 2xlarge+
103+
steps:
99104
- run:
100-
name: Checkout devtools
101-
command: git clone https://github.com/secretflow/devtools.git ../devtools
102-
- run:
103-
name: "Install dependencies"
105+
name: Install extra deps
104106
command: |
105-
python3 -m pip install -U pip
106-
python3 -m pip install -r requirements.txt
107-
python3 -m pip install -r requirements-dev.txt
108107
python3 -m pip install tzdata
109108
python3 -m pip install -r examples/python/ml/requirements.txt
110-
- run:
111-
name: Setup GCS
112-
command: |
113-
echo ${gcs_content} > ../gcs.data
114-
../devtools/bazel_cache_setup.py --in_file=../gcs.data --out_file=../gcs.json --min_download
115-
- run:
116-
name: "build"
117-
command: bazel build //examples/python/ml:ml_test -c opt --ui_event_filters=-info,-debug,-warning --jobs 20
118-
- run:
119-
name: "test"
120-
command: |
121-
set +e
122-
declare -i test_status
123-
bazel test --test_env LD_LIBRARY_PATH=/root/miniconda3/lib/ //examples/python/ml:ml_test -c opt --ui_event_filters=-info,-debug,-warning --test_timeout=3600 --test_output=errors| tee test_result.log; test_status=${PIPESTATUS[0]}
124-
125-
sh ../devtools/rename-junit-xml.sh
126-
find bazel-testlogs/ -type f -name "test.log" -print0 | xargs -0 tar -cvzf test_logs.tar.gz
127-
128-
exit ${test_status}
129-
- store_test_results:
130-
path: test-results
131-
- store_artifacts:
132-
path: test_logs.tar.gz
109+
- build_and_test:
110+
targets: //examples/python/ml:ml_test
111+
extra_bazel_test_args: --test_env LD_LIBRARY_PATH=/root/miniconda3/lib/
133112
macOS_ut:
134113
macos:
135-
xcode: 15.1
114+
xcode: 15.1.0
136115
resource_class: macos.m1.large.gen1
137116
steps:
138117
- checkout
139-
- run:
140-
name: Checkout devtools
141-
command: git clone https://github.com/secretflow/devtools.git ../devtools
142118
- run:
143119
name: "Install homebrew dependencies"
144120
command: brew install bazelisk cmake ninja libomp wget md5sha1sum
@@ -151,45 +127,21 @@ jobs:
151127
conda init bash zsh
152128
pip install -r requirements.txt
153129
pip install -r requirements-dev.txt
154-
- run:
155-
name: Setup GCS
156-
command: |
157-
echo ${gcs_content} > ../gcs.data
158-
../devtools/bazel_cache_setup.py --in_file=../gcs.data --out_file=../gcs.json --min_download
159-
- run:
160-
name: "build"
161-
command: bazel build //... -c opt --ui_event_filters=-info,-debug,-warning
162-
- run:
163-
name: "test"
164-
command: |
165-
set +e
166-
declare -i test_status
167-
bazel test //... -c opt --ui_event_filters=-info,-debug,-warning --test_output=errors | tee test_result.log; test_status=${PIPESTATUS[0]}
168-
169-
sh ../devtools/rename-junit-xml.sh
170-
find bazel-bin/ -perm +111 -type f -name "*_test" -print0 | xargs -0 tar -cvzf test_binary.tar.gz
171-
find bazel-testlogs/ -type f -name "test.log" -print0 | xargs -0 tar -cvzf test_logs.tar.gz
172-
173-
exit ${test_status}
174-
- store_test_results:
175-
path: test-results
176-
- store_artifacts:
177-
path: test_binary.tar.gz
178-
- store_artifacts:
179-
path: test_logs.tar.gz
130+
- build_and_test
180131
# Invoke jobs via workflows
181132
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
182133
workflows:
183134
unittest:
184135
when: << pipeline.parameters.build-and-run >>
185136
jobs:
186137
- linux_ut:
138+
name: linux_ut-<<matrix.resource_class>>
187139
matrix:
188140
parameters:
189-
resource_class: ["2xlarge", "arm.2xlarge"]
141+
resource_class: ["2xlarge+", "arm.2xlarge"]
190142
- linux_ml_ut:
191143
requires:
192-
- linux_ut
144+
- linux_ut-2xlarge+
193145
filters:
194146
branches:
195147
only:

.circleci/dev-release-config.yml

-117
This file was deleted.

0 commit comments

Comments
 (0)