Skip to content

Commit 5c7e273

Browse files
authored
Move deploy from TravisCI to CircleCI (#3075)
Our travisci keeps breaking for different reasons so we decided to move our deploy to circleci.
1 parent 507eb53 commit 5c7e273

File tree

2 files changed

+100
-57
lines changed

2 files changed

+100
-57
lines changed

.circleci/config.yml

Lines changed: 100 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,33 @@ orbs:
55
go: circleci/go@1.7.0
66
slack: circleci/slack@4.4.2
77

8+
parameters:
9+
ubuntu_image:
10+
type: string
11+
default: "ubuntu-2004:202104-01"
12+
build_dir:
13+
type: string
14+
default: "/opt/cibuild"
15+
result_path:
16+
type: string
17+
default: "/tmp/build_test_results"
18+
819
executors:
920
amd64_medium:
1021
machine:
11-
image: ubuntu-2004:202104-01
22+
image: << pipeline.parameters.ubuntu_image >>
1223
resource_class: medium
1324
amd64_large:
1425
machine:
15-
image: ubuntu-2004:202104-01
26+
image: << pipeline.parameters.ubuntu_image >>
1627
resource_class: large
1728
arm64_medium:
1829
machine:
19-
image: ubuntu-2004:202101-01
30+
image: << pipeline.parameters.ubuntu_image >>
2031
resource_class: arm.medium
2132
arm64_large:
2233
machine:
23-
image: ubuntu-2004:202101-01
34+
image: << pipeline.parameters.ubuntu_image >>
2435
resource_class: arm.large
2536
mac_amd64_medium:
2637
macos:
@@ -138,6 +149,22 @@ workflows:
138149
requires:
139150
- << matrix.platform >>_<< matrix.job_type >>
140151

152+
- upload_binaries:
153+
name: << matrix.platform >>_upload_binaries
154+
matrix:
155+
<<: *matrix-default
156+
requires:
157+
- << matrix.platform >>_test_nightly_verification
158+
- << matrix.platform >>_integration_nightly_verification
159+
- << matrix.platform >>_e2e_expect_nightly_verification
160+
filters:
161+
branches:
162+
only:
163+
- /rel\/.*/
164+
context:
165+
- slack-secrets
166+
- aws-secrets
167+
141168
#- windows_x64_build
142169

143170
commands:
@@ -146,18 +173,20 @@ commands:
146173
steps:
147174
- run: |
148175
sudo rm -rf ${HOME}/.go_workspace /usr/local/go
176+
149177
prepare_build_dir:
150178
description: Set up build directory
151179
parameters:
152180
build_dir:
153181
type: string
154-
default: "/opt/cibuild"
182+
default: << pipeline.parameters.build_dir >>
155183
steps:
156184
- run:
157185
working_directory: /tmp
158186
command: |
159187
sudo mkdir -p << parameters.build_dir >>
160188
sudo chown -R $USER:$GROUP << parameters.build_dir >>
189+
161190
prepare_windows:
162191
description: Prepare windows image
163192
steps:
@@ -180,7 +209,7 @@ commands:
180209
parameters:
181210
build_dir:
182211
type: string
183-
default: "/opt/cibuild"
212+
default: << pipeline.parameters.build_dir >>
184213
steps:
185214
- restore_libsodium
186215
- restore_cache:
@@ -246,7 +275,7 @@ commands:
246275
parameters:
247276
build_dir:
248277
type: string
249-
default: "/opt/cibuild"
278+
default: << pipeline.parameters.build_dir >>
250279
result_subdir:
251280
type: string
252281
no_output_timeout:
@@ -257,11 +286,14 @@ commands:
257286
default: ""
258287
result_path:
259288
type: string
260-
default: "/tmp/results"
289+
default: << pipeline.parameters.result_path >>
261290
steps:
262291
- attach_workspace:
263292
at: << parameters.build_dir >>
264-
- run: mkdir -p << parameters.result_path >>/<< parameters.result_subdir >>/$CIRCLE_NODE_INDEX
293+
- run: |
294+
mkdir -p << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}
295+
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml
296+
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json
265297
- restore_cache:
266298
keys:
267299
- 'go-cache-v2-{{ .Environment.CIRCLE_STAGE }}-'
@@ -284,8 +316,8 @@ commands:
284316
scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
285317
PACKAGES="$(go list ./... | grep -v /go-algorand/test/)"
286318
export PACKAGE_NAMES=$(echo $PACKAGES | tr -d '\n')
287-
export PARTITION_TOTAL=$CIRCLE_NODE_TOTAL
288-
export PARTITION_ID=$CIRCLE_NODE_INDEX
319+
export PARTITION_TOTAL=${CIRCLE_NODE_TOTAL}
320+
export PARTITION_ID=${CIRCLE_NODE_INDEX}
289321
export PARALLEL_FLAG="-p 1"
290322
gotestsum --format testname --junitfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml --jsonfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json -- --tags "sqlite_unlock_notify sqlite_omit_load_extension" << parameters.short_test_flag >> -race -timeout 1h -coverprofile=coverage.txt -covermode=atomic -p 1 $PACKAGE_NAMES
291323
- store_artifacts:
@@ -316,7 +348,7 @@ commands:
316348
parameters:
317349
build_dir:
318350
type: string
319-
default: "/opt/cibuild"
351+
default: << pipeline.parameters.build_dir >>
320352
result_subdir:
321353
type: string
322354
no_output_timeout:
@@ -327,11 +359,14 @@ commands:
327359
default: ""
328360
result_path:
329361
type: string
330-
default: "/tmp/results"
362+
default: << pipeline.parameters.result_path >>
331363
steps:
332364
- attach_workspace:
333365
at: << parameters.build_dir >>
334-
- run: mkdir -p << parameters.result_path >>/<< parameters.result_subdir >>/$CIRCLE_NODE_INDEX
366+
- run: |
367+
mkdir -p << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}
368+
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml
369+
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json
335370
- run:
336371
name: Run integration tests
337372
no_output_timeout: << parameters.no_output_timeout >>
@@ -351,9 +386,9 @@ commands:
351386
scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
352387
export ALGOTEST=1
353388
export SHORTTEST=<< parameters.short_test_flag >>
354-
export TEST_RESULTS=<< parameters.result_path >>/<< parameters.result_subdir >>/$CIRCLE_NODE_INDEX
355-
export PARTITION_TOTAL=$CIRCLE_NODE_TOTAL
356-
export PARTITION_ID=$CIRCLE_NODE_INDEX
389+
export TEST_RESULTS=<< parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}
390+
export PARTITION_TOTAL=${CIRCLE_NODE_TOTAL}
391+
export PARTITION_ID=${CIRCLE_NODE_INDEX}
357392
test/scripts/run_integration_tests.sh
358393
- store_artifacts:
359394
path: << parameters.result_path >>
@@ -370,7 +405,7 @@ commands:
370405
parameters:
371406
result_path:
372407
type: string
373-
default: "/tmp/results"
408+
default: << pipeline.parameters.result_path >>
374409
result_subdir:
375410
type: string
376411
steps:
@@ -385,6 +420,27 @@ commands:
385420
path: << parameters.result_path >>/<< parameters.result_subdir >>
386421
destination: << parameters.result_subdir >>/combined-test-results
387422

423+
upload_binaries_command:
424+
description: save build artifacts for potential deployments
425+
parameters:
426+
platform:
427+
type: string
428+
build_dir:
429+
type: string
430+
default: << pipeline.parameters.build_dir >>
431+
steps:
432+
- run:
433+
name: Upload binaries << parameters.platform >>
434+
environment:
435+
TRAVIS_BRANCH: ${CIRCLE_BRANCH}
436+
command: |
437+
scripts/travis/deploy_packages.sh
438+
- when:
439+
condition:
440+
equal: [ "amd64", << parameters.platform >> ]
441+
steps:
442+
- run: scripts/travis/test_release.sh
443+
388444
jobs:
389445
codegen_verification:
390446
executor: amd64_medium
@@ -401,7 +457,7 @@ jobs:
401457
platform:
402458
type: string
403459
executor: << parameters.platform >>_medium
404-
working_directory: /opt/cibuild/project
460+
working_directory: << pipeline.parameters.build_dir >>/project
405461
steps:
406462
- prepare_build_dir
407463
- checkout
@@ -413,7 +469,7 @@ jobs:
413469
platform:
414470
type: string
415471
executor: << parameters.platform >>_large
416-
working_directory: /opt/cibuild/project
472+
working_directory: << pipeline.parameters.build_dir >>/project
417473
parallelism: 4
418474
steps:
419475
- prepare_build_dir
@@ -428,7 +484,7 @@ jobs:
428484
platform:
429485
type: string
430486
executor: << parameters.platform >>_large
431-
working_directory: /opt/cibuild/project
487+
working_directory: << pipeline.parameters.build_dir >>/project
432488
parallelism: 4
433489
steps:
434490
- prepare_build_dir
@@ -446,7 +502,7 @@ jobs:
446502
platform:
447503
type: string
448504
executor: << parameters.platform >>_large
449-
working_directory: /opt/cibuild/project
505+
working_directory: << pipeline.parameters.build_dir >>/project
450506
parallelism: 4
451507
environment:
452508
E2E_TEST_FILTER: "GO"
@@ -462,7 +518,7 @@ jobs:
462518
platform:
463519
type: string
464520
executor: << parameters.platform >>_large
465-
working_directory: /opt/cibuild/project
521+
working_directory: << pipeline.parameters.build_dir >>/project
466522
parallelism: 4
467523
environment:
468524
E2E_TEST_FILTER: "GO"
@@ -480,7 +536,7 @@ jobs:
480536
platform:
481537
type: string
482538
executor: << parameters.platform >>_large
483-
working_directory: /opt/cibuild/project
539+
working_directory: << pipeline.parameters.build_dir >>/project
484540
parallelism: 4
485541
environment:
486542
E2E_TEST_FILTER: "EXPECT"
@@ -496,7 +552,7 @@ jobs:
496552
platform:
497553
type: string
498554
executor: << parameters.platform >>_large
499-
working_directory: /opt/cibuild/project
555+
working_directory: << pipeline.parameters.build_dir >>/project
500556
parallelism: 4
501557
environment:
502558
E2E_TEST_FILTER: "EXPECT"
@@ -514,7 +570,7 @@ jobs:
514570
platform:
515571
type: string
516572
executor: << parameters.platform >>_large
517-
working_directory: /opt/cibuild/project
573+
working_directory: << pipeline.parameters.build_dir >>/project
518574
parallelism: 4
519575
environment:
520576
E2E_TEST_FILTER: "SCRIPTS"
@@ -530,7 +586,7 @@ jobs:
530586
platform:
531587
type: string
532588
executor: << parameters.platform >>_large
533-
working_directory: /opt/cibuild/project
589+
working_directory: << pipeline.parameters.build_dir >>/project
534590
parallelism: 4
535591
environment:
536592
E2E_TEST_FILTER: "SCRIPTS"
@@ -566,6 +622,7 @@ jobs:
566622
docker:
567623
- image: python:3.9.6-alpine
568624
resource_class: small
625+
working_directory: << pipeline.parameters.build_dir >>/project
569626
parameters:
570627
platform: # platform: ["amd64", "arm64", "mac_amd64"]
571628
type: string
@@ -575,3 +632,19 @@ jobs:
575632
- checkout
576633
- tests_verification_command:
577634
result_subdir: << parameters.platform >>_<< parameters.job_type >>
635+
636+
upload_binaries:
637+
working_directory: << pipeline.parameters.build_dir >>/project
638+
parameters:
639+
platform:
640+
type: string
641+
executor: << parameters.platform >>_medium
642+
steps:
643+
- prepare_build_dir
644+
- checkout
645+
- prepare_go
646+
- upload_binaries_command:
647+
platform: << parameters.platform >>
648+
- slack/notify: &slack-fail-event
649+
event: fail
650+
template: basic_fail_1

.travis.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,10 @@ stages:
1212
if: type = pull_request
1313
- name: build_release
1414
if: (branch =~ /^hotfix\// OR branch =~ /^rel\//) AND type != pull_request
15-
- name: deploy
16-
if: branch =~ /^rel\// AND type != pull_request
17-
- name: post_deploy
18-
if: branch =~ /^rel\// AND type != pull_request
1915

2016
jobs:
2117
allow_failures:
22-
- name: External ARM64 Deploy
2318
- name: External ARM Build
24-
- name: External ARM Deploy
2519
- name: Test Release Builds
2620
include:
2721
- stage: build_commit
@@ -95,30 +89,6 @@ jobs:
9589
script:
9690
- $mingw64 scripts/travis/build_test.sh
9791

98-
- stage: deploy
99-
name: Ubuntu Deploy
100-
os: linux
101-
script:
102-
- scripts/travis/deploy_packages.sh
103-
- scripts/travis/test_release.sh
104-
- # same stage, parallel job
105-
name: MacOS Deploy
106-
os: osx
107-
osx_image: xcode11
108-
script: scripts/travis/deploy_packages.sh
109-
- # same stage, parallel job
110-
name: External ARM64 Deploy
111-
os: linux
112-
env:
113-
- BUILD_TYPE: "external_build"
114-
- TARGET_PLATFORM: "linux-arm64"
115-
addons:
116-
apt:
117-
packages:
118-
- awscli
119-
script:
120-
- scripts/travis/external_build.sh ./scripts/travis/deploy_packages.sh
121-
12292
# Don't rebuild libsodium every time
12393
cache:
12494
directories:

0 commit comments

Comments
 (0)