@ckeditor/ckeditor5-dev-ci 38.3.1 → 38.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/allocate-swap-memory.sh +21 -0
- package/bin/install-latest-chrome.sh +13 -0
- package/lib/data/bots.json +2 -1
- package/lib/data/members.json +2 -1
- package/lib/format-message.js +41 -18
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -2,11 +2,11 @@ CKEditor 5 CI utilities
|
|
|
2
2
|
=======================
|
|
3
3
|
|
|
4
4
|
[](https://www.npmjs.com/package/@ckeditor/ckeditor5-dev-ci)
|
|
5
|
-
[](https://app.circleci.com/pipelines/github/ckeditor/ckeditor5-dev?branch=master)
|
|
6
6
|
|
|
7
7
|
Utils for [CKEditor 5](https://ckeditor.com) CI builds.
|
|
8
8
|
|
|
9
|
-
Contains tools for sending Slack notifications by Travis.
|
|
9
|
+
Contains tools for sending Slack notifications by Travis or Circle CI.
|
|
10
10
|
|
|
11
11
|
More information about development tools packages can be found at the following URL: <https://github.com/ckeditor/ckeditor5-dev>.
|
|
12
12
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
|
+
# For licensing, see LICENSE.md.
|
|
5
|
+
|
|
6
|
+
echo "Allocating swap memory to prevent running out of RAM."
|
|
7
|
+
|
|
8
|
+
# Remove existing swap so that allocating new swap does not throw.
|
|
9
|
+
sudo swapoff -a
|
|
10
|
+
|
|
11
|
+
# Create a 4 gigabyte swapfile.
|
|
12
|
+
sudo fallocate -l 4G /swapfile
|
|
13
|
+
|
|
14
|
+
# Secure the swapfile by restricting access to root.
|
|
15
|
+
sudo chmod 600 /swapfile
|
|
16
|
+
|
|
17
|
+
# Mark the file as a swap space.
|
|
18
|
+
sudo mkswap /swapfile
|
|
19
|
+
|
|
20
|
+
# Enable the swap.
|
|
21
|
+
sudo swapon /swapfile
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
|
+
# For licensing, see LICENSE.md.
|
|
5
|
+
|
|
6
|
+
echo "Installing the latest Chrome."
|
|
7
|
+
|
|
8
|
+
sudo apt-get update
|
|
9
|
+
sudo apt-get install lsb-release libappindicator3-1
|
|
10
|
+
curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
11
|
+
sudo dpkg -i google-chrome.deb
|
|
12
|
+
sudo sed -i 's|HERE/chrome"|HERE/chrome" --no-sandbox|g' /opt/google/chrome/google-chrome
|
|
13
|
+
rm google-chrome.deb
|
package/lib/data/bots.json
CHANGED
package/lib/data/members.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"DawidKossowski": "U0401V31S9M",
|
|
9
9
|
"dufipl": "U02SG0U25GS",
|
|
10
10
|
"Dumluregn": "UGG2JE7JR",
|
|
11
|
-
"filipsobol
|
|
11
|
+
"filipsobol": "U04GZ96MKCN",
|
|
12
12
|
"FilipTokarski": "URSK5KV9V",
|
|
13
13
|
"godai78": "U017DJLU7NX",
|
|
14
14
|
"gorzelinski": "U04DJ7BKSKU",
|
|
@@ -30,5 +30,6 @@
|
|
|
30
30
|
"pszczesniak": "U04167FKV88",
|
|
31
31
|
"Reinmar": "U03UQRP0C",
|
|
32
32
|
"scofalik": "U05611ZMM",
|
|
33
|
+
"Witoso": "U04S02SUZS5",
|
|
33
34
|
"wwalc": "U03UQQ8PY"
|
|
34
35
|
}
|
package/lib/format-message.js
CHANGED
|
@@ -8,26 +8,26 @@
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
10
|
const fetch = require( 'node-fetch' );
|
|
11
|
-
|
|
12
11
|
const bots = require( './data/bots.json' );
|
|
13
12
|
const members = require( './data/members.json' );
|
|
14
13
|
|
|
15
14
|
const REPOSITORY_REGEXP = /github\.com\/([^/]+)\/([^/]+)/;
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {String}
|
|
20
|
-
* @param {String}
|
|
21
|
-
* @param {String}
|
|
22
|
-
* @param {String}
|
|
23
|
-
* @param {String}
|
|
24
|
-
* @param {String}
|
|
25
|
-
* @param {String}
|
|
26
|
-
* @param {String}
|
|
27
|
-
* @param {String}
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {Number}
|
|
30
|
-
* @param {
|
|
17
|
+
* @param {Object} options
|
|
18
|
+
* @param {String} options.slackMessageUsername
|
|
19
|
+
* @param {String} options.iconUrl
|
|
20
|
+
* @param {String} options.repositoryOwner
|
|
21
|
+
* @param {String} options.repositoryName
|
|
22
|
+
* @param {String} options.branch
|
|
23
|
+
* @param {String} options.buildTitle
|
|
24
|
+
* @param {String} options.buildUrl
|
|
25
|
+
* @param {String} options.buildId
|
|
26
|
+
* @param {String} options.githubToken
|
|
27
|
+
* @param {String} options.triggeringCommitUrl
|
|
28
|
+
* @param {Number} options.startTime
|
|
29
|
+
* @param {Number} options.endTime
|
|
30
|
+
* @param {Boolean} options.shouldHideAuthor
|
|
31
31
|
*/
|
|
32
32
|
module.exports = async function formatMessage( options ) {
|
|
33
33
|
const commitDetails = await getCommitDetails( options.triggeringCommitUrl, options.githubToken );
|
|
@@ -75,24 +75,47 @@ module.exports = async function formatMessage( options ) {
|
|
|
75
75
|
* @returns {String}
|
|
76
76
|
*/
|
|
77
77
|
function getNotifierMessage( options ) {
|
|
78
|
-
const slackAccount = members[ options.githubAccount ] || null;
|
|
79
|
-
|
|
80
78
|
if ( options.shouldHideAuthor ) {
|
|
81
79
|
return '_The author of the commit was hidden. <https://github.com/ckeditor/ckeditor5/issues/9252|Read more about why.>_';
|
|
82
80
|
}
|
|
83
81
|
|
|
82
|
+
const slackAccount = findSlackAccount( options.githubAccount );
|
|
83
|
+
const botActionMessage = '_Automated stuff happened on one of the branches. Got time to have a look at it, anyone?_';
|
|
84
|
+
|
|
84
85
|
if ( bots.includes( options.githubAccount ) ) {
|
|
85
|
-
return
|
|
86
|
+
return botActionMessage;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
// If the author of the commit could not be obtained, let's ping the entire team.
|
|
89
90
|
if ( !slackAccount ) {
|
|
91
|
+
if ( bots.includes( options.commitAuthor ) ) {
|
|
92
|
+
return botActionMessage;
|
|
93
|
+
}
|
|
94
|
+
|
|
90
95
|
return `<!channel> (${ options.commitAuthor }), could you take a look?`;
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
return `<@${ slackAccount }>, could you take a look?`;
|
|
94
99
|
}
|
|
95
100
|
|
|
101
|
+
/**
|
|
102
|
+
* @param {String|null} githubAccount
|
|
103
|
+
* @returns {String|null}
|
|
104
|
+
*/
|
|
105
|
+
function findSlackAccount( githubAccount ) {
|
|
106
|
+
if ( !githubAccount ) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
for ( const [ key, value ] of Object.entries( members ) ) {
|
|
111
|
+
if ( key.toLowerCase() === githubAccount.toLowerCase() ) {
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
96
119
|
/**
|
|
97
120
|
* Returns string representing amount of time passed between two timestamps.
|
|
98
121
|
* Timestamps should be in seconds instead of milliseconds.
|
|
@@ -142,7 +165,7 @@ function getExecutionTime( startTime, endTime ) {
|
|
|
142
165
|
*/
|
|
143
166
|
function getFormattedMessage( commitMessage, triggeringCommitUrl ) {
|
|
144
167
|
if ( !commitMessage ) {
|
|
145
|
-
return '
|
|
168
|
+
return '_Unavailable._';
|
|
146
169
|
}
|
|
147
170
|
|
|
148
171
|
const [ , repoOwner, repoName ] = triggeringCommitUrl.match( REPOSITORY_REGEXP );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-dev-ci",
|
|
3
|
-
"version": "38.
|
|
3
|
+
"version": "38.4.1",
|
|
4
4
|
"description": "Utils used on various Continuous Integration services.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"dependencies": {
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"bin": {
|
|
20
20
|
"ckeditor5-dev-ci-notify-travis-status": "bin/notify-travis-status.js",
|
|
21
21
|
"ckeditor5-dev-ci-notify-circle-status": "bin/notify-circle-status.js",
|
|
22
|
-
"ckeditor5-dev-ci-circle-workflow-notifier": "bin/circle-workflow-notifier.js"
|
|
22
|
+
"ckeditor5-dev-ci-circle-workflow-notifier": "bin/circle-workflow-notifier.js",
|
|
23
|
+
"ckeditor5-dev-ci-allocate-swap-memory": "bin/allocate-swap-memory.sh",
|
|
24
|
+
"ckeditor5-dev-ci-install-latest-chrome": "bin/install-latest-chrome.sh"
|
|
23
25
|
},
|
|
24
26
|
"author": "CKSource (http://cksource.com/)",
|
|
25
27
|
"license": "GPL-2.0-or-later",
|