Skip to content

Commit 92d2ec4

Browse files
committed
Init repo
1 parent f292e76 commit 92d2ec4

27 files changed

+16958
-129
lines changed

.circleci/config.yml

+290
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
version: 2.1
2+
3+
parameters:
4+
triggerCommitHash:
5+
type: string
6+
default: ""
7+
isNightly:
8+
type: boolean
9+
default: false
10+
isRelease:
11+
type: boolean
12+
default: false
13+
14+
commands:
15+
prepare_environment_command:
16+
description: "Prepare environment (RAM, browsers, hosts, etc.)"
17+
steps:
18+
# CircleCI does not use the latest Chrome. Hence, we must install it manually.
19+
- run:
20+
name: Install the latest Chrome
21+
command: yarn ckeditor5-dev-ci-install-latest-chrome
22+
23+
bootstrap_repository_command:
24+
description: "Bootstrap the repository"
25+
steps:
26+
- install_ssh_keys_command
27+
- run:
28+
name: Install dependencies
29+
command: yarn install
30+
- prepare_environment_variables_commands
31+
32+
install_ssh_keys_command:
33+
description: "Install SSH keys"
34+
steps:
35+
- add_ssh_keys:
36+
fingerprints:
37+
- "a0:41:a2:56:c8:7d:3f:29:41:d1:87:92:fd:50:2b:6b"
38+
39+
npm_login_command:
40+
description: "Enable interacting with `npm` using an auth token"
41+
steps:
42+
- run:
43+
name: Login to the npm registry using '.npmrc' file
44+
command: echo "//registry.npmjs.org/:_authToken=\${CKE5_NPM_TOKEN}" > ~/.npmrc
45+
46+
git_credentials_command:
47+
description: "Setup git configuration"
48+
steps:
49+
- run:
50+
name: Setup git configuration
51+
command: |
52+
git config --global user.email "[email protected]"
53+
git config --global user.name "CKEditorBot"
54+
55+
prepare_environment_variables_commands:
56+
description: "Prepare non-secret environment variables"
57+
steps:
58+
- run:
59+
name: Prepare environment variables
60+
command: |
61+
#!/bin/bash
62+
63+
# Non-secret environment variables needed for the pipeline scripts.
64+
CKE5_GITHUB_ORGANIZATION="ckeditor"
65+
CKE5_GITHUB_REPOSITORY="ckeditor5-integrations-common"
66+
CKE5_CIRCLE_APPROVAL_JOB_NAME="release_approval"
67+
CKE5_GITHUB_RELEASE_BRANCH="master"
68+
69+
echo export CKE5_CIRCLE_APPROVAL_JOB_NAME=$CKE5_CIRCLE_APPROVAL_JOB_NAME >> $BASH_ENV
70+
echo export CKE5_GITHUB_RELEASE_BRANCH=$CKE5_GITHUB_RELEASE_BRANCH >> $BASH_ENV
71+
echo export CKE5_GITHUB_ORGANIZATION=$CKE5_GITHUB_ORGANIZATION >> $BASH_ENV
72+
echo export CKE5_GITHUB_REPOSITORY=$CKE5_GITHUB_REPOSITORY >> $BASH_ENV
73+
echo export CKE5_GITHUB_REPOSITORY_SLUG="$CKE5_GITHUB_ORGANIZATION/$CKE5_GITHUB_REPOSITORY" >> $BASH_ENV
74+
echo export CKE5_COMMIT_SHA1=$CIRCLE_SHA1 >> $BASH_ENV
75+
76+
jobs:
77+
notify_ci_failure:
78+
machine: true
79+
parameters:
80+
hideAuthor:
81+
type: string
82+
default: "false"
83+
steps:
84+
- checkout
85+
- bootstrap_repository_command
86+
- run:
87+
# In the PRs that comes from forked repositories, we do not share secret variables.
88+
# Hence, some of the scripts will not be executed.
89+
name: 👤 Verify if the build was triggered by community - Check if the build should continue
90+
command: |
91+
#!/bin/bash
92+
93+
if [[ -z ${COVERALLS_REPO_TOKEN} ]];
94+
then
95+
circleci-agent step halt
96+
fi
97+
- run:
98+
environment:
99+
CKE5_SLACK_NOTIFY_HIDE_AUTHOR: << parameters.hideAuthor >>
100+
CKE5_PIPELINE_NUMBER: << pipeline.number >>
101+
name: Waiting for other jobs to finish and sending notification on failure
102+
command: yarn ckeditor5-dev-ci-circle-workflow-notifier
103+
no_output_timeout: 1h
104+
105+
validate_and_tests:
106+
machine: true
107+
steps:
108+
- checkout
109+
- bootstrap_repository_command
110+
- prepare_environment_command
111+
- run:
112+
name: Execute ESLint
113+
command: npm run lint
114+
- run:
115+
name: Run build
116+
command: npm run build
117+
- run:
118+
name: Run unit tests
119+
command: npm run test
120+
- run:
121+
name: Verify the code coverage
122+
command: |
123+
#!/bin/bash
124+
125+
# Create the `nyc` directory.
126+
mkdir .nyc_output
127+
128+
# Copy results.
129+
cp coverage/coverage-final.json .nyc_output
130+
131+
# Verify results.
132+
npx nyc check-coverage --branches 100 --functions 100 --lines 100 --statements 100
133+
- unless:
134+
# Upload the code coverage results for non-nightly builds only.
135+
condition: << pipeline.parameters.isNightly >>
136+
steps:
137+
- run:
138+
# In the PRs that comes from forked repositories, we do not share secret variables.
139+
# Hence, some of the scripts will not be executed.
140+
name: 👤 Verify if the build was triggered by community - Check if the build should continue
141+
command: |
142+
#!/bin/bash
143+
144+
if [[ -z ${COVERALLS_REPO_TOKEN} ]];
145+
then
146+
circleci-agent step halt
147+
fi
148+
- run:
149+
name: Upload code coverage
150+
command: cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
151+
152+
release_prepare:
153+
machine: true
154+
steps:
155+
- checkout
156+
- bootstrap_repository_command
157+
- run:
158+
name: Check if packages are ready to be released
159+
command: npm run release:prepare-packages -- --verbose --compile-only
160+
161+
trigger_release_process:
162+
machine: true
163+
steps:
164+
- checkout
165+
- bootstrap_repository_command
166+
- run:
167+
name: Verify if the project is ready to release
168+
command: |
169+
#!/bin/bash
170+
171+
# Do not fail if the Node script ends with non-zero exit code.
172+
set +e
173+
174+
node scripts/ci/is-project-ready-to-release.js
175+
EXIT_CODE=$( echo $? )
176+
177+
if [ ${EXIT_CODE} -eq 1 ];
178+
then
179+
circleci-agent step halt
180+
fi
181+
- run:
182+
name: Trigger the release pipeline
183+
command: yarn ckeditor5-dev-ci-trigger-circle-build
184+
185+
release_project:
186+
machine: true
187+
steps:
188+
- checkout
189+
- bootstrap_repository_command
190+
- run:
191+
name: Verify the trigger commit from the repository
192+
command: |
193+
#!/bin/bash
194+
195+
CKE5_LATEST_COMMIT_HASH=$( git log -n 1 --pretty=format:%H origin/master )
196+
CKE5_TRIGGER_COMMIT_HASH=<< pipeline.parameters.triggerCommitHash >>
197+
198+
if [[ "${CKE5_LATEST_COMMIT_HASH}" != "${CKE5_TRIGGER_COMMIT_HASH}" ]]; then
199+
echo "There is a newer commit in the repository on the \`#master\` branch. Use its build to start the release."
200+
circleci-agent step halt
201+
fi
202+
- npm_login_command
203+
- git_credentials_command
204+
- run:
205+
name: Verify if a releaser triggered the job
206+
command: |
207+
#!/bin/bash
208+
209+
# Do not fail if the Node script ends with non-zero exit code.
210+
set +e
211+
212+
yarn ckeditor5-dev-ci-is-job-triggered-by-member
213+
EXIT_CODE=$( echo $? )
214+
215+
if [ ${EXIT_CODE} -ne 0 ];
216+
then
217+
echo "Aborting the release due to failed verification of the approver (no rights to release)."
218+
circleci-agent step halt
219+
fi
220+
- run:
221+
name: Disable the redundant workflows option
222+
command: yarn ckeditor5-dev-ci-circle-disable-auto-cancel-builds
223+
- run:
224+
name: Prepare the new version to release
225+
command: npm run release:prepare-packages -- --verbose
226+
- run:
227+
name: Publish the packages
228+
command: npm run release:publish-packages -- --verbose
229+
- run:
230+
name: Enable the redundant workflows option
231+
command: yarn ckeditor5-dev-ci-circle-enable-auto-cancel-builds
232+
when: always
233+
- run:
234+
name: Pack the "release/" directory (in case of failure)
235+
command: |
236+
zip -r ./release.zip ./release
237+
when: always
238+
- store_artifacts:
239+
path: ./release.zip
240+
when: always
241+
242+
workflows:
243+
version: 2
244+
main:
245+
when:
246+
and:
247+
- equal: [ false, << pipeline.parameters.isNightly >> ]
248+
- equal: [ false, << pipeline.parameters.isRelease >> ]
249+
jobs:
250+
- validate_and_tests
251+
- release_prepare
252+
- trigger_release_process:
253+
requires:
254+
- validate_and_tests
255+
- release_prepare
256+
filters:
257+
branches:
258+
only:
259+
- master
260+
- notify_ci_failure:
261+
filters:
262+
branches:
263+
only:
264+
- master
265+
266+
release:
267+
when:
268+
and:
269+
- equal: [ false, << pipeline.parameters.isNightly >> ]
270+
- equal: [ true, << pipeline.parameters.isRelease >> ]
271+
jobs:
272+
- release_approval:
273+
type: approval
274+
- release_project:
275+
requires:
276+
- release_approval
277+
278+
nightly:
279+
when:
280+
and:
281+
- equal: [ true, << pipeline.parameters.isNightly >> ]
282+
- equal: [ false, << pipeline.parameters.isRelease >> ]
283+
jobs:
284+
- validate_and_tests
285+
- notify_ci_failure:
286+
hideAuthor: "true"
287+
filters:
288+
branches:
289+
only:
290+
- master

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Configurations to normalize the IDE behavior.
2+
# http://editorconfig.org/
3+
4+
root = true
5+
6+
[*]
7+
indent_style = tab
8+
tab_width = 4
9+
charset = utf-8
10+
end_of_line = lf
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
[package.json]
15+
indent_style = space
16+
tab_width = 2

.eslintrc.cjs

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3+
* For licensing, see LICENSE.md.
4+
*/
5+
6+
/* use strict */
7+
8+
module.exports = {
9+
env: {
10+
es6: true,
11+
node: true,
12+
mocha: true
13+
},
14+
extends: [ 'eslint:recommended', 'ckeditor5' ],
15+
globals: {
16+
expect: true,
17+
sinon: true,
18+
shallow: true,
19+
mount: true
20+
},
21+
rules: {
22+
'no-console': 'off',
23+
'no-trailing-spaces': 'error',
24+
'ckeditor5-rules/allow-imports-only-from-main-package-entry-point':
25+
'off',
26+
'ckeditor5-rules/license-header': [
27+
'error',
28+
{
29+
headerLines: [
30+
'/**',
31+
' * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.',
32+
' * For licensing, see LICENSE.md.',
33+
' */'
34+
]
35+
}
36+
]
37+
},
38+
ignorePatterns: [ '**/*.d.ts', 'dist/**', 'coverage/**', 'node_modules' ],
39+
overrides: [
40+
{
41+
files: [ '**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx' ],
42+
rules: {
43+
'ckeditor5-rules/ckeditor-error-message': 'off'
44+
}
45+
},
46+
{
47+
files: [
48+
'tests/**/*.js',
49+
'tests/**/*.jsx',
50+
'tests/**/*.ts',
51+
'tests/**/*.tsx'
52+
],
53+
rules: {
54+
'no-unused-expressions': 'off'
55+
}
56+
},
57+
{
58+
files: [ 'demo*/**/*.ts', 'demo*/**/*.tsx' ],
59+
rules: {
60+
'ckeditor5-rules/license-header': 'off'
61+
}
62+
},
63+
{
64+
files: [ '**/tests/**/*.ts', '**/tests/**/*.tsx' ],
65+
rules: {
66+
'@typescript-eslint/no-unused-expressions': 'off'
67+
}
68+
}
69+
]
70+
};

.gitattributes

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
* text=auto
2+
3+
*.htaccess eol=lf
4+
*.cgi eol=lf
5+
*.sh eol=lf
6+
7+
*.css text
8+
*.htm text
9+
*.html text
10+
*.js text
11+
*.json text
12+
*.php text
13+
*.txt text
14+
*.md text
15+
16+
*.png -text
17+
*.gif -text
18+
*.jpg -text

0 commit comments

Comments
 (0)