Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
taochen-ant committed Jul 7, 2023
1 parent 342226b commit 54aaf68
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 80 deletions.
92 changes: 17 additions & 75 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,97 +22,39 @@ orbs:
path-filtering: circleci/[email protected]

parameters:
run-regtest:
enable_regtest:
type: boolean
default: false

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
linux_regtest:
machine:
image: ubuntu-2004:2022.07.1
resource_class: 2xlarge
steps:
- checkout
- restore_cache:
name: "Restore engine cache"
key: engine-regtest-build-{{ arch }}-
- run:
name: "Checkout devtools"
command: git clone https://github.com/secretflow/devtools.git
- run:
name: Decompress cache
command: sh devtools/decompress-build-cache.sh engine_regtest_cache
- run:
name: "Build binary"
command: |
set +e
mkdir -p image
cp docker/scql.Dockerfile image
docker run -d -it --name scql-dev -v $(pwd):/home/admin/dev/ -v ~/.cache/engine_regtest_cache:/root/.cache/engine_regtest_cache -w /home/admin/dev --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --cap-add=NET_ADMIN --privileged=true secretflow/release-ci:latest
docker exec -it scql-dev bash -c "make && bazel build //engine/... -c opt --ui_event_filters=-info,-debug,-warning --disk_cache=~/.cache/engine_regtest_cache"
docker cp scql-dev:/home/admin/dev/bazel-bin/engine/exe/scqlengine image
docker cp scql-dev:/home/admin/dev/bin/scdbserver image
docker cp scql-dev:/home/admin/dev/bin/scdbclient image
docker stop scql-dev && docker rm scql-dev
- run:
name: Cleanup and compress cache
command: |
sh devtools/clean_disk_cache.sh ~/.cache/engine_regtest_cache
sh devtools/compress-build-cache.sh engine_regtest_cache
- save_cache:
key: engine-regtest-build-{{ arch }}-{{ .Environment.CIRCLE_BUILD_NUM }}
paths:
- ~/.cache/engine_regtest_cache.tar.gz
- run:
name: "Build image"
command: |
cd image
docker build -f scql.Dockerfile -t scql:latest .
- run:
name: "Deploy image"
command: |
set +e
cd .ci/docker-compose
docker compose -p regtest up -d
docker ps | grep regtest
- run:
name: "Run regtest"
command: |
set +e
sleep 1m
export SKIP_CONCURRENT_TEST=true
export $(grep -v '^#' .ci/docker-compose/.env | xargs)
go test ./cmd/regtest/... -v -count=1 -timeout=30m
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
run_ut:
when:
not: << pipeline.parameters.run-regtest >>
not: << pipeline.parameters.enable_regtest >>
jobs:
- path-filtering/filter:
base-revision: main
config-path: .circleci/unittest-config.yml
mapping: |
api/.* build-and-run true
bazel/.* build-and-run true
cmd/.* build-and-run true
engine/.* build-and-run true
pkg/.* build-and-run true
.bazelrc build-and-run true
api/.* run_unittest true
bazel/.* run_unittest true
cmd/.* run_unittest true
engine/.* run_unittest true
pkg/.* run_unittest true
.circleci/.* run_unittest true
.bazelrc run_unittest true
run_regtest:
when: << pipeline.parameters.run-regtest >>
when: << pipeline.parameters.enable_regtest >>
jobs:
- path-filtering/filter:
base-revision: main
config-path: .circleci/regtest-config.yml
mapping: |
api/.* build-and-run true
bazel/.* build-and-run true
cmd/.* build-and-run true
engine/.* build-and-run true
pkg/.* build-and-run true
.bazelrc build-and-run true
api/.* run_regtest true
bazel/.* run_regtest true
cmd/.* run_regtest true
engine/.* run_regtest true
pkg/.* run_regtest true
.circleci/.* run_regtest true
.bazelrc run_regtest true
9 changes: 6 additions & 3 deletions .circleci/regtest-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
version: 2.1

parameters:
build-and-run:
enable_regtest:
type: boolean
default: false
run_regtest:
type: boolean
default: false

Expand Down Expand Up @@ -84,7 +87,7 @@ jobs:
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
unittest:
when: << pipeline.parameters.build-and-run >>
regtest:
when: << pipeline.parameters.run_regtest >>
jobs:
- linux_regtest
7 changes: 5 additions & 2 deletions .circleci/unittest-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
version: 2.1

parameters:
build-and-run:
enable_regtest:
type: boolean
default: false
run_unittest:
type: boolean
default: false

Expand Down Expand Up @@ -179,7 +182,7 @@ jobs:
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
unittest:
when: << pipeline.parameters.build-and-run >>
when: << pipeline.parameters.run_unittest >>
jobs:
- linux_scdb_ut
- linux_engine_ut
Expand Down

0 comments on commit 54aaf68

Please sign in to comment.