Skip to content

Commit 2667851

Browse files
feat: add ci config
1 parent d947680 commit 2667851

File tree

4 files changed

+256
-0
lines changed

4 files changed

+256
-0
lines changed

.circleci/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
continue_config.yml

.circleci/config.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
version: 2.1
2+
3+
# This exposes the parameters to be overridden in the generated pipeline
4+
parameters:
5+
ssh-fingerprint:
6+
type: string
7+
default: 'SHA256:jV+vtmEE6tY1NjGJKLYccAoeQAbVEQ805X70tJHiQ9Q'
8+
GHA_Actor:
9+
type: string
10+
default: ''
11+
GHA_Action:
12+
type: string
13+
default: ''
14+
GHA_Event:
15+
type: string
16+
default: ''
17+
GHA_Meta:
18+
type: string
19+
default: ''
20+
21+
# this allows you to use CircleCI's dynamic configuration feature
22+
setup: true
23+
24+
orbs:
25+
vfcommon: voiceflow/[email protected]
26+
gomplate: xavientois/[email protected]
27+
path-filtering: circleci/[email protected]
28+
29+
workflows:
30+
generate-config:
31+
when:
32+
and:
33+
- not:
34+
equal: [scheduled_pipeline, << pipeline.trigger_source >>]
35+
- not:
36+
equal: ['prerelease', << pipeline.parameters.GHA_Meta >>]
37+
jobs:
38+
- gomplate/render-config:
39+
context: dev-test
40+
install-gomplate: false
41+
executor:
42+
name: vfcommon/node-executor-node-20
43+
tag: '20.11.1-vf-3'
44+
pre-steps:
45+
- vfcommon/checkout_clone:
46+
clone_type: treeless
47+
- vfcommon/compute_base_revision:
48+
base_revision: >-
49+
<< pipeline.git.base_revision >>
50+
<<^ pipeline.git.base_revision >>
51+
<< pipeline.git.revision >>
52+
<</ pipeline.git.base_revision >>
53+
git_branch: << pipeline.git.branch >>
54+
- vfcommon/set-pr-number
55+
- vfcommon/set-pr-branch:
56+
target_env_var: &pr_branch PR_BRANCH
57+
- vfcommon/set-json-string-from-env:
58+
field: pr_branch
59+
value-env-var: *pr_branch
60+
- vfcommon/set-json-string:
61+
field: branch
62+
# HACK: this cannot be empty, so we pass both branch and tag (only one of them will be non-empty)
63+
# TODO: Fix this once https://discuss.circleci.com/t/empty-string-for-parameter-breaks-config/47695 has a solution
64+
value: '<< pipeline.git.branch >><< pipeline.git.tag >>'
65+
- vfcommon/set-json-command:
66+
field: node_version
67+
command: jq --raw-output '.volta.node // ""' package.json
68+
- vfcommon/set-json-string-from-env:
69+
field: common_orb_version
70+
value-env-var: COMMON_ORB_VERSION
71+
- run: cat values.json
72+
contexts: values.json
73+
filters:
74+
branches:
75+
ignore:
76+
- /.*\.tmp/
77+
prerelease:
78+
when:
79+
equal: ['prerelease', << pipeline.parameters.GHA_Meta >>]
80+
jobs:
81+
- path-filtering/filter:
82+
base-revision: master
83+
config-path: .circleci/prerelease-config.yml
84+
mapping: |
85+
package.json build-all true

.circleci/continue_config.yml.tmpl

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
version: 2.1
2+
3+
parameters:
4+
ssh-fingerprint:
5+
type: string
6+
default: "SHA256:jV+vtmEE6tY1NjGJKLYccAoeQAbVEQ805X70tJHiQ9Q"
7+
GHA_Actor:
8+
type: string
9+
default: ''
10+
GHA_Action:
11+
type: string
12+
default: ''
13+
GHA_Event:
14+
type: string
15+
default: ''
16+
GHA_Meta:
17+
type: string
18+
default: ''
19+
20+
orbs:
21+
vfcommon: voiceflow/common@{{ .values.common_orb_version }}
22+
sonarcloud: sonarsource/[email protected]
23+
docker: circleci/[email protected]
24+
25+
{{- ne .values.branch "staging" | test.Assert "staging is a deprecated bors branch and should not be in use" }}
26+
27+
{{- $mqBranches := coll.Slice "trying" "/^gtmq_.*/" }}
28+
{{- $isMaster := eq .values.branch "master" }}
29+
30+
{{/* isBors denotes whether we are on a gtmq_/trying branch */}}
31+
{{- $isBors := or (.values.branch | strings.HasPrefix "gtmq_") (has $mqBranches .values.branch) }}
32+
33+
# Reusable YAML chunks
34+
defaults:
35+
slack-fail-post-step: &slack-fail-post-step
36+
post-steps:
37+
- vfcommon/notify_slack:
38+
channel: dev_general
39+
event: fail
40+
mentions: "@eng_dx"
41+
template: basic_fail_1
42+
branch_pattern: master
43+
44+
executor: &node-executor
45+
name: vfcommon/node-executor-node-20
46+
tag: {{ .values.node_version }}-vf-5
47+
48+
workflows:
49+
{{- if $isMaster }}
50+
test-and-release:
51+
{{- else if $isBors }}
52+
e2e-tests:
53+
{{- else }}
54+
test:
55+
{{- end }}
56+
jobs:
57+
- vfcommon/install_and_build:
58+
<<: *slack-fail-post-step
59+
executor:
60+
<<: *node-executor
61+
default_resource_class: xlarge
62+
context: dev-test
63+
avoid_post_install_scripts: false
64+
name: build
65+
package: all
66+
monorepo_engine: "turborepo"
67+
force_execute: true
68+
run_in_container: false
69+
container_folder_to_copy: "" #Copy all
70+
71+
{{- $testJobs := (coll.Slice "lint_report" "types_tests" "dependency_tests" "unit_tests")}}
72+
{{ range $testJob := $testJobs }}
73+
- vfcommon/monorepo_{{ $testJob }}:
74+
<<: *slack-fail-post-step
75+
context: dev-test
76+
name: {{ strings.KebabCase $testJob }}
77+
run_on_root: true
78+
executor:
79+
<<: *node-executor
80+
default_resource_class: xlarge
81+
default_node_memory: "8096"
82+
requires:
83+
- build
84+
filters:
85+
branches:
86+
ignore:
87+
- production
88+
- /^break-glass.*$/
89+
{{- end }}
90+
91+
- vfcommon/sonarcloud_scan:
92+
<<: *slack-fail-post-step
93+
context: dev-test
94+
name: sonarcloud-scan
95+
filters:
96+
branches:
97+
ignore:
98+
- production
99+
- /^break-glass.*$/
100+
101+
- vfcommon/monorepo_release:
102+
<<: *slack-fail-post-step
103+
executor: *node-executor
104+
avoid_post_install_scripts: false
105+
ssh_key: << pipeline.parameters.ssh-fingerprint >>
106+
context: dev-test
107+
release_engine: "lite"
108+
requires:
109+
{{- range $testJob := $testJobs }}
110+
- {{ strings.KebabCase $testJob }}
111+
{{- end }}
112+
- build
113+
filters:
114+
branches:
115+
only: master
116+
{{- end }}

.circleci/prerelease-config.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
version: 2.1
2+
3+
parameters:
4+
ssh-fingerprint:
5+
type: string
6+
default: 'SHA256:jV+vtmEE6tY1NjGJKLYccAoeQAbVEQ805X70tJHiQ9Q'
7+
build-apps:
8+
type: boolean
9+
default: false
10+
build-all:
11+
type: boolean
12+
default: false
13+
GHA_Actor:
14+
type: string
15+
default: ''
16+
GHA_Action:
17+
type: string
18+
default: ''
19+
GHA_Event:
20+
type: string
21+
default: ''
22+
GHA_Meta:
23+
type: string
24+
default: ''
25+
26+
orbs:
27+
vfcommon: voiceflow/[email protected]
28+
29+
workflows:
30+
test-and-release:
31+
jobs:
32+
- vfcommon/install_and_build:
33+
executor: &node-executor
34+
name: vfcommon/node-executor-node-20
35+
default_resource_class: large
36+
context: dev-test
37+
avoid_post_install_scripts: false
38+
name: build
39+
package: all
40+
monorepo_engine: 'turborepo'
41+
force_execute: true
42+
run_in_container: false
43+
container_folder_to_copy: '' #Copy all
44+
45+
- vfcommon/monorepo_release:
46+
name: monorepo_prerelease
47+
executor: *node-executor
48+
avoid_post_install_scripts: false
49+
ssh_key: << pipeline.parameters.ssh-fingerprint >>
50+
context: dev-test
51+
prerelease: true
52+
release_engine: 'lite'
53+
requires:
54+
- build

0 commit comments

Comments
 (0)