Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

config.yml 24 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
  1. version: 2.1
  2. # This filter operates on SemVer2 tags only
  3. release_tag_filter: &release_tag_filter
  4. filters:
  5. branches:
  6. ignore: /.*/
  7. tags:
  8. only: /^\d+\.\d+\.\d+$/
  9. release_candidate_filter: &release_candidate_filter
  10. filters:
  11. branches:
  12. only: master
  13. commands:
  14. run_on_account:
  15. description: "Run a command using a given role"
  16. parameters:
  17. command:
  18. type: string
  19. aws_role:
  20. type: string
  21. env_name:
  22. type: string
  23. steps:
  24. - run:
  25. environment:
  26. ENVIRONMENT_NAME: << parameters.env_name >>
  27. name: Run a command on << parameters.aws_role >> aws account
  28. command: scripts/aws-sudo.sh -c '<< parameters.command >>' << parameters.aws_role >>
  29. set_env_login_details:
  30. description: "log into codeartifcat specific repo "
  31. parameters:
  32. repo_name:
  33. type: string
  34. aws_account_id:
  35. type: string
  36. aws_role:
  37. type: string
  38. env_name:
  39. type: string
  40. steps:
  41. - run_on_account:
  42. aws_role: << parameters.aws_role >>
  43. env_name: << parameters.env_name >>
  44. command: |
  45. aws codeartifact login --tool pip --repository << parameters.repo_name >> --domain deci-packages --domain-owner << parameters.aws_account_id >>
  46. - run:
  47. name: edit the pip conf
  48. command: sed -i 's/^index-url/extra-index-url/g' ~/.config/pip/pip.conf
  49. create_github_release:
  50. description: create a pull request on github
  51. parameters:
  52. directory_to_cd_into:
  53. type: string
  54. tag:
  55. type: string
  56. notes:
  57. type: string
  58. default: "Automated nightly release"
  59. steps:
  60. - run:
  61. name: install gh cli
  62. command: |
  63. curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
  64. echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
  65. sudo apt update
  66. sudo apt install gh
  67. - run:
  68. name: authenticate
  69. command: |
  70. echo "$GITHUB_CLI_TOKEN" > token.txt
  71. gh auth login --with-token < token.txt
  72. rm token.txt
  73. - run:
  74. name: create the release
  75. command: |
  76. cd << parameters.directory_to_cd_into >>
  77. gh release create << parameters.tag >> --notes "<< parameters.notes >>"
  78. #gh auth logout
  79. tag_as:
  80. description: "tag as a certain name"
  81. parameters:
  82. tag_name:
  83. type: string
  84. delete_remote:
  85. type: boolean
  86. steps:
  87. - when:
  88. condition: << parameters.delete_remote >>
  89. steps:
  90. - run:
  91. name: Remove local and remote tag
  92. command: |
  93. git tag -d << parameters.tag_name >>
  94. git push --delete origin << parameters.tag_name >>
  95. - run:
  96. name: Tag stable and push
  97. command: |
  98. git tag << parameters.tag_name >>
  99. git push origin << parameters.tag_name >>
  100. upload_package_run:
  101. description: "uploads the package to dev and prod"
  102. parameters:
  103. version:
  104. type: string
  105. default: ""
  106. py_version:
  107. type: string
  108. default: ""
  109. clone_specific_tag:
  110. type: boolean
  111. default: false
  112. tag_to_checkout_from:
  113. type: string
  114. default: ""
  115. steps:
  116. - upload_package:
  117. aws_role: $AWS_DEV_ROLE
  118. aws_account: $AWS_DEV_ACCOUNT_ID
  119. version: << parameters.version >>
  120. py_version: << parameters.py_version >>
  121. clone_specific_tag: << parameters.clone_specific_tag >>
  122. tag_to_checkout_from: << parameters.tag_to_checkout_from >>
  123. - upload_package:
  124. aws_role: $AWS_PROD_ROLE
  125. aws_account: $AWS_PROD_ACCOUNT_ID
  126. version: << parameters.version >>
  127. py_version: << parameters.py_version >>
  128. clone_specific_tag: << parameters.clone_specific_tag >>
  129. tag_to_checkout_from: << parameters.tag_to_checkout_from >>
  130. upload_package:
  131. description: "uploads a package to a designated repo"
  132. parameters:
  133. aws_account:
  134. type: string
  135. aws_role:
  136. type: string
  137. version:
  138. type: string
  139. default: ""
  140. py_version:
  141. type: string
  142. default: ""
  143. clone_specific_tag:
  144. type: boolean
  145. default: false
  146. tag_to_checkout_from:
  147. type: string
  148. default: ""
  149. codeartifact_repository:
  150. type: string
  151. default: "deci-packages"
  152. steps:
  153. - unless:
  154. condition: << parameters.clone_specific_tag >>
  155. steps:
  156. - checkout_and_skip_build
  157. - when:
  158. condition: << parameters.clone_specific_tag >>
  159. steps:
  160. - clone_specific_tag:
  161. tag_to_checkout_from: << parameters.tag_to_checkout_from >>
  162. - attach_workspace:
  163. at: ~/
  164. - restore_cache:
  165. key: << parameters.py_version >>-dependency-cache-{{ checksum "setup.py" }}-{{ checksum "requirements.txt" }}
  166. - run:
  167. name: Taking version from tag or env vars
  168. command: |
  169. echo "upload_package Command got version: << parameters.version >>"
  170. NEW_VERSION=<< parameters.version >>
  171. if [[ $NEW_VERSION ]]
  172. then
  173. export NEW_VERSION=$NEW_VERSION
  174. echo "export NEW_VERSION=$NEW_VERSION" >> $BASH_ENV
  175. else
  176. cat ~/new-env-vars >> $BASH_ENV
  177. source $BASH_ENV
  178. fi
  179. echo "new version is ${NEW_VERSION}"
  180. # - run: #TODO:implement linter
  181. # name: install Flake8 python linter
  182. # command: |
  183. # pip install --user flake8
  184. # - run:
  185. # name: Lint all python files changed since develop branch
  186. # command: |
  187. # flake8 --statistics --config -v --exclude venv/,documentation scripts/flake8-config setup.py $(git diff --diff-filter ACM origin/master --name-only | grep 'py$')
  188. - run:
  189. command: |
  190. sudo apt-get update
  191. pip install -U importlib-metadata>=3.6
  192. pip install --user awscli twine wheel
  193. - set_codeartifact_login:
  194. aws_role: << parameters.aws_role >>
  195. aws_account: << parameters.aws_account >>
  196. tool: "twine"
  197. repository: << parameters.codeartifact_repository >>
  198. # - run:
  199. # name: build documentation
  200. # command: |
  201. # . venv/bin/activate
  202. # pip install -r documentation/requirements.txt
  203. # sh ./scripts/generate_docs.sh
  204. # - store_artifacts:
  205. # path: docs/
  206. - upload_package_and_edit_version:
  207. version: $NEW_VERSION
  208. - set_codeartifact_login:
  209. aws_role: << parameters.aws_role >>
  210. aws_account: << parameters.aws_account >>
  211. tool: "pip"
  212. repository: << parameters.codeartifact_repository >>
  213. - test_on_clean_env:
  214. package_name: "super-gradients"
  215. version: $NEW_VERSION
  216. ## if test worked push to repo, otherwise delete from pypi
  217. - run:
  218. name: delete dist
  219. command: |
  220. rm -rf dist/*
  221. run_on_aws_account:
  222. description: "Run a command using a role"
  223. parameters:
  224. command:
  225. type: string
  226. aws_role:
  227. type: string
  228. steps:
  229. - run:
  230. name: Run a command using an aws account
  231. command: |
  232. scripts/aws-sudo.sh -c '<< parameters.command >>' << parameters.aws_role >>
  233. set_codeartifact_login:
  234. description: "Connecting to codeartifact"
  235. parameters:
  236. repository:
  237. type: string
  238. default: "deci-packages"
  239. domain:
  240. type: string
  241. default: "deci-packages"
  242. aws_role:
  243. type: string
  244. aws_account:
  245. type: string
  246. tool:
  247. type: string
  248. steps:
  249. - run:
  250. name: "remove old"
  251. command: |
  252. if [ -f ~/.config/pip/pip.conf ]; then
  253. rm ~/.config/pip/pip.conf
  254. fi
  255. - run_on_aws_account:
  256. aws_role: << parameters.aws_role >>
  257. command: |
  258. CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain << parameters.domain >> --domain-owner << parameters.aws_account >> --query authorizationToken --output text`
  259. aws codeartifact login --tool << parameters.tool >> --repository << parameters.repository >> --domain << parameters.domain >> --domain-owner << parameters.aws_account >>
  260. test_on_clean_env:
  261. parameters:
  262. package_name:
  263. type: string
  264. version:
  265. type: string
  266. steps:
  267. - run:
  268. name: install python dependencies
  269. command: |
  270. python3 -m venv clean_env
  271. . clean_env/bin/activate
  272. sed -i 's/^index-url/extra-index-url/g' ~/.config/pip/pip.conf
  273. python -m pip install << parameters.package_name >>==<< parameters.version >>
  274. - run:
  275. name: todo - implement tests for the package. Maybe use poc repo # TODO: Still need to get the tests going
  276. command: |
  277. . clean_env/bin/activate
  278. echo "TODO: Still need to get the pacakge tests going"
  279. upload_package_and_edit_version:
  280. parameters:
  281. version:
  282. type: string
  283. description: "Uploading a package to pypi"
  284. steps:
  285. - run:
  286. name: edit package version
  287. command: |
  288. echo << parameters.version >> > version.txt
  289. - run:
  290. name: create packages
  291. command: |
  292. python setup.py bdist_wheel
  293. - run:
  294. name: upload to pypi using codeartifact
  295. command: |
  296. twine upload -r codeartifact dist/*
  297. git_commit_and_tag:
  298. parameters:
  299. version:
  300. type: string
  301. default: ""
  302. is_release:
  303. type: boolean
  304. default: false
  305. steps:
  306. - run:
  307. name: Avoid hosts unknown for github
  308. command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
  309. - run:
  310. name: Commit and Push version file
  311. command: |
  312. git config --global user.email "circleci@deci.ai"
  313. git config --global user.name "CircleCI commit"
  314. git commit version.txt -m "CircleCi - Changed version to << parameters.version >>"
  315. git push --force --set-upstream origin master
  316. - tag_as:
  317. tag_name: << parameters.version >>
  318. delete_remote: << parameters.is_release >>
  319. checkout_and_skip_build:
  320. description: "Checkout code and check if we should skip the build"
  321. steps:
  322. - checkout
  323. - run:
  324. name: Check if we should skip build when not triggered by tag
  325. command: |
  326. if [[ ! $CIRCLE_TAG ]]; then
  327. last_commit_user=$(git log -1 --pretty=format:'%an')
  328. if [ "${last_commit_user}" == "CircleCI commit" ]; then
  329. echo "\n\n PLEASE NOTICE: Skipping Build to prevent commit loop since the last commit was genereated by automated CI/CD \n\n"
  330. circleci-agent step halt
  331. fi
  332. fi
  333. - run:
  334. name: Check if we should skip build when triggered by tag
  335. command: |
  336. version_in_file=`cat version.txt`
  337. echo "The version written in version.txt is ${version_in_file}"
  338. if [[ $CIRCLE_TAG ]] && [[ "$CIRCLE_TAG" == "${version_in_file}" ]]; then
  339. echo "** version.txt is set with the same version , avoiding loop and exiting **"
  340. circleci-agent step halt
  341. fi
  342. clone_specific_tag:
  343. description: "got clone and check out specific tag"
  344. parameters:
  345. tag_to_checkout_from:
  346. type: string
  347. steps:
  348. - checkout
  349. - run:
  350. name: Checkout tag
  351. command: |
  352. cd super_gradients
  353. git checkout tags/<< parameters.tag_to_checkout_from >>
  354. jobs:
  355. get_version_info:
  356. working_directory: ~/project
  357. docker:
  358. - image: cimg/base:2021.04
  359. resource_class: small
  360. description: "Putting latest tag in environment"
  361. steps:
  362. - checkout_and_skip_build
  363. - run:
  364. name: get latest tag
  365. command: |
  366. set +e
  367. LATEST_RELEASE=$(git tag --list | grep --regexp="^[0-9]\+\.[0-9]\+\.[0-9]\+$" | sort -V | tail -n 1)
  368. echo "export LATEST_RELEASE=${LATEST_RELEASE}" >> $BASH_ENV
  369. NEW_VERSION=$(bash scripts/version-up.sh -v $LATEST_RELEASE -i)
  370. BRANCH=<< pipeline.git.branch >>
  371. echo "PIPELINE is ${BRANCH} "
  372. case << pipeline.git.branch >> in
  373. master)
  374. echo "export NEW_VERSION=${NEW_VERSION}rc${CIRCLE_BUILD_NUM}" >> $BASH_ENV
  375. ;;
  376. *)
  377. echo "export NEW_VERSION=${NEW_VERSION}b${CIRCLE_BUILD_NUM}" >> $BASH_ENV
  378. ;;
  379. esac
  380. cat $BASH_ENV
  381. - run: cat $BASH_ENV >> ~/new-env-vars
  382. - persist_to_workspace:
  383. root: ~/
  384. paths:
  385. - new-env-vars
  386. build:
  387. parameters:
  388. py_version:
  389. type: string
  390. default: latest
  391. package_name:
  392. type: string
  393. docker:
  394. - image: cimg/python:<< parameters.py_version >>
  395. steps:
  396. - checkout_and_skip_build
  397. - attach_workspace:
  398. at: ~/
  399. - run:
  400. name: set version at bash env
  401. command: |
  402. if [[ $CIRCLE_TAG ]]
  403. then
  404. echo "export NEW_VERSION=$CIRCLE_TAG" >> $BASH_ENV
  405. else
  406. cat ~/new-env-vars >> $BASH_ENV
  407. fi
  408. # - restore_cache:
  409. # key: << parameters.py_version >>-dependency-cache-{{ checksum "setup.py" }}-{{ checksum "requirements.txt" }}
  410. - run:
  411. name: install python dependencies
  412. command: |
  413. python3 -m venv venv
  414. . venv/bin/activate
  415. python -m pip install --upgrade pip
  416. cat requirements.txt | cut -f1 -d"#" | xargs -n 1 -L 1 pip install --progress-bar off
  417. # - save_cache:
  418. # key: << parameters.py_version >>-dependency-cache-{{ checksum "setup.py" }}-{{ checksum "requirements.txt" }}
  419. # paths:
  420. # - "venv"
  421. - run:
  422. name: edit package version
  423. command: |
  424. echo "${NEW_VERSION}" > version.txt
  425. cat version.txt
  426. - run:
  427. name: setup custom environment variables
  428. command: |
  429. echo 'export PYTHONPATH=/home/circleci/super_gradients' >> $BASH_ENV
  430. - run:
  431. name: install package
  432. no_output_timeout: 30m
  433. command: |
  434. . venv/bin/activate
  435. cp requirements.txt tmp.txt
  436. cat tmp.txt | head -n -1 > requirements.txt
  437. rm tmp.txt
  438. rm ~/.config/pip/pip.conf
  439. python -m pip install .
  440. - run:
  441. name: run tests with coverage
  442. no_output_timeout: 30m
  443. command: |
  444. . venv/bin/activate
  445. coverage run --source=super_gradients -m unittest tests/deci_core_unit_test_suite_runner.py
  446. coverage report
  447. coverage html # open htmlcov/index.html in a browser
  448. - store_artifacts:
  449. path: htmlcov
  450. - store_artifacts:
  451. path: ~/sg_logs
  452. build_and_release:
  453. docker:
  454. - image: cimg/python:3.7
  455. steps:
  456. - get_version_info
  457. - build:
  458. name: "build3.7"
  459. py_version: "3.7"
  460. package_name: "super-gradients"
  461. requires:
  462. - get_version_info
  463. - upload_package:
  464. aws_role: $AWS_PROD_ROLE
  465. aws_account: $AWS_PROD_ACCOUNT_ID
  466. version: $CIRCLE_TAG
  467. py_version: << parameters.py_version >>
  468. release_candidate:
  469. docker:
  470. - image: cimg/python:3.7
  471. parameters:
  472. py_version:
  473. type: string
  474. steps:
  475. - upload_package:
  476. aws_role: $AWS_DEV_ROLE
  477. aws_account: $AWS_DEV_ACCOUNT_ID
  478. py_version: << parameters.py_version >>
  479. - git_commit_and_tag:
  480. version: $NEW_VERSION
  481. release_version:
  482. docker:
  483. - image: cimg/python:3.7
  484. parameters:
  485. py_version:
  486. type: string
  487. steps:
  488. - upload_package_run:
  489. version: $CIRCLE_TAG
  490. py_version: << parameters.py_version >>
  491. - upload_package:
  492. aws_role: $AWS_PROD_ROLE
  493. aws_account: $AWS_PROD_ACCOUNT_ID
  494. version: $CIRCLE_TAG
  495. py_version: << parameters.py_version >>
  496. codeartifact_repository: "deci-toolkit"
  497. - git_commit_and_tag:
  498. version: $CIRCLE_TAG
  499. is_release: true
  500. - tag_as:
  501. tag_name: "stable"
  502. delete_remote: true
  503. - create_github_release:
  504. directory_to_cd_into: "."
  505. tag: $CIRCLE_TAG
  506. notes: "This GitHub Release was done automatically by CircleCI"
  507. upload_to_pypi:
  508. docker:
  509. - image: cimg/python:3.7.8
  510. parameters:
  511. package_name:
  512. type: string
  513. sleep:
  514. type: string
  515. default: "0"
  516. steps:
  517. - checkout_and_skip_build
  518. - run:
  519. command: |
  520. sudo apt-get update
  521. pip install --user awscli twine
  522. sleep << parameters.sleep >>
  523. - run_on_aws_account:
  524. aws_role: $AWS_PROD_ROLE
  525. command: |
  526. export LATEST_VERSION_ON_AWS="$(aws codeartifact list-package-versions --domain deci-packages --repository \
  527. deci-packages --package << parameters.package_name >> --domain-owner ${AWS_PROD_ACCOUNT_ID} \
  528. --query versions[0].version --sort-by PUBLISHED_TIME --format pypi --output text)"
  529. echo "Will attempt to upload $LATEST_VERSION_ON_AWS to pypi"
  530. assets=$(aws codeartifact list-package-version-assets --domain deci-packages --repository deci-packages \
  531. --package << parameters.package_name >> --format pypi --package-version $LATEST_VERSION_ON_AWS \
  532. --domain-owner ${AWS_PROD_ACCOUNT_ID} --query assets[*].name --output text)
  533. echo "assets: $assets "
  534. for ass in $assets;
  535. do
  536. echo "working on $ass"
  537. aws codeartifact get-package-version-asset --repository deci-packages --domain deci-packages --domain-owner ${AWS_PROD_ACCOUNT_ID} --package << parameters.package_name >> --package-version $LATEST_VERSION_ON_AWS --format pypi --asset "${ass}" "${ass}"
  538. done
  539. for ass in $assets
  540. do
  541. echo "*** \n regular upload of $ass \n ***"
  542. python -m twine upload --repository-url "https://upload.pypi.org/legacy/" -u __token__ -p ${PYPI_TOKEN} "${ass}"
  543. done
  544. # it's funny because it's gas
  545. release_version_from_rc:
  546. docker:
  547. - image: cimg/python:3.7
  548. steps:
  549. - attach_workspace:
  550. at: ~/
  551. - run:
  552. name: exit if $AUTO_RELEASED_VERSION is empty
  553. command: |
  554. if ! [[ -f ~/new-env-vars ]]; then
  555. echo "no version to release"
  556. circleci-agent step halt
  557. exit 0
  558. fi
  559. cat ~/new-env-vars >> $BASH_ENV
  560. source $BASH_ENV
  561. if [[ -z $AUTO_RELEASED_VERSION ]]; then
  562. echo "no version to release"
  563. circleci-agent step halt
  564. exit 0
  565. else
  566. echo "will create a release $AUTO_RELEASED_VERSION from ${LATEST_RELEASE_AWS}"
  567. fi
  568. - clone_specific_tag:
  569. tag_to_checkout_from: $LATEST_RELEASE_AWS
  570. - run:
  571. name: tag git repository
  572. command: |
  573. git tag $AUTO_RELEASED_VERSION
  574. git push origin $AUTO_RELEASED_VERSION
  575. - create_github_release:
  576. directory_to_cd_into: "."
  577. tag: $AUTO_RELEASED_VERSION
  578. notes: "Automated nightly release. Generated from ${LATEST_RELEASE_AWS}"
  579. get_unreleased_rc:
  580. working_directory: ~/repo
  581. docker:
  582. - image: cimg/python:3.7.5
  583. resource_class: small
  584. steps:
  585. - checkout
  586. - run:
  587. command: |
  588. pip install --user awscli
  589. - run_on_aws_account:
  590. aws_role: $AWS_DEV_ROLE
  591. command: |
  592. LATEST_RELEASE_AWS="null"
  593. LATEST_RELEASE_AWS=$(aws codeartifact list-package-versions --domain deci-packages --domain-owner $AWS_DEV_ACCOUNT_ID --repository deci-packages --format pypi --package super-gradients --max-results 1 --sort-by PUBLISHED_TIME --query versions[0].version --output text)
  594. echo "export LATEST_RELEASE_AWS=${LATEST_RELEASE_AWS}" >> $BASH_ENV
  595. - run:
  596. name: "check for unreleased rc"
  597. command: |
  598. source $BASH_ENV
  599. LAST_REV=$(git rev-list --tags --max-count=1)
  600. GIT_LATEST_TAG=$(git describe --tags "${LAST_REV}")
  601. echo "latest tag: ${GIT_LATEST_TAG}"
  602. echo "latest release on AWS: ${LATEST_RELEASE_AWS}"
  603. if ! [[ "${GIT_LATEST_TAG}" =~ "rc" ]]; then
  604. echo "latest is a release, nothing to do. Off for fusball"
  605. circleci-agent step halt
  606. elif [[ "${GIT_LATEST_TAG}" != "${LATEST_RELEASE_AWS}" ]]; then
  607. echo "latest tag does not equal the latest release on dev account"
  608. echo "something is phishy, we wont proceed"
  609. circleci-agent step halt
  610. else
  611. echo "we have a release candidate to release - ${GIT_LATEST_TAG}"
  612. AUTO_RELEASED_VERSION=$(echo $GIT_LATEST_TAG | cut -d 'r' -f1)
  613. echo "version to release: $AUTO_RELEASED_VERSION"
  614. echo "export AUTO_RELEASED_VERSION=${AUTO_RELEASED_VERSION}" >> $BASH_ENV
  615. fi
  616. - run: cat $BASH_ENV >> ~/new-env-vars
  617. - persist_to_workspace:
  618. root: ~/
  619. paths:
  620. - new-env-vars
  621. login_to_codeartifact:
  622. description: Authenticate to aws code artifact. By default authenticates to prod
  623. docker:
  624. - image: cimg/python:3.7.5
  625. parameters:
  626. dev_account:
  627. description: authenticate to development codeartifact
  628. type: boolean
  629. default: false
  630. pip_repo_name:
  631. type: string
  632. steps:
  633. - checkout
  634. - run:
  635. command: |
  636. pip install --user awscli
  637. - when:
  638. condition: << parameters.dev_account >>
  639. steps:
  640. - set_env_login_details:
  641. repo_name: << parameters.pip_repo_name >>
  642. aws_account_id: ${AWS_DEV_ACCOUNT_ID}
  643. aws_role: ${AWS_DEV_ROLE}
  644. env_name: "development"
  645. - unless:
  646. condition: << parameters.dev_account >>
  647. steps:
  648. - set_env_login_details:
  649. repo_name: << parameters.pip_repo_name >>
  650. aws_account_id: ${AWS_PROD_ACCOUNT_ID}
  651. aws_role: ${AWS_PROD_ROLE}
  652. env_name: "production"
  653. - persist_to_workspace:
  654. root: ~/
  655. paths:
  656. - .config/pip/pip.conf
  657. workflows:
  658. release:
  659. jobs:
  660. - login_to_codeartifact:
  661. name: "login_to_codeartifact_release"
  662. dev_account: false
  663. pip_repo_name: "deci-packages"
  664. <<: *release_tag_filter
  665. - build:
  666. name: "build3.7"
  667. py_version: "3.7"
  668. package_name: "super-gradients"
  669. requires:
  670. - login_to_codeartifact_release
  671. <<: *release_tag_filter
  672. - release_version:
  673. py_version: "3.7"
  674. requires:
  675. - "build3.7"
  676. <<: *release_tag_filter
  677. - upload_to_pypi:
  678. package_name: "super-gradients"
  679. name: upload_super_gradients_to_pypi
  680. sleep: "60"
  681. requires:
  682. - "release_version"
  683. context:
  684. - pypi-public
  685. <<: *release_tag_filter
  686. build_and_deploy:
  687. jobs:
  688. - get_version_info
  689. - login_to_codeartifact:
  690. pip_repo_name: "deci-packages"
  691. dev_account: false
  692. - build:
  693. name: "build3.7"
  694. py_version: "3.7"
  695. package_name: "super-gradients"
  696. requires:
  697. - get_version_info
  698. - login_to_codeartifact
  699. - release_candidate: # happens on merge
  700. py_version: "3.7"
  701. requires:
  702. - "build3.7"
  703. <<: *release_candidate_filter
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...