@eeacms/volto-widget-toggle 2.2.4 → 2.2.7

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/CHANGELOG.md CHANGED
@@ -4,8 +4,26 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [2.2.7](https://github.com/eea/volto-widget-toggle/compare/2.2.6...2.2.7)
8
+
9
+
10
+ #### [2.2.6](https://github.com/eea/volto-widget-toggle/compare/2.2.5...2.2.6)
11
+
12
+ > 3 January 2022
13
+
14
+ - Release [`#8`](https://github.com/eea/volto-widget-toggle/pull/8)
15
+
16
+ #### [2.2.5](https://github.com/eea/volto-widget-toggle/compare/2.2.4...2.2.5)
17
+
18
+ > 16 December 2021
19
+
20
+ - Add SonarQube badges [`#7`](https://github.com/eea/volto-widget-toggle/pull/7)
21
+
7
22
  #### [2.2.4](https://github.com/eea/volto-widget-toggle/compare/2.2.3...2.2.4)
8
23
 
24
+ > 10 December 2021
25
+
26
+ - Develop [`#6`](https://github.com/eea/volto-widget-toggle/pull/6)
9
27
  - Correct Cypress tests [`#5`](https://github.com/eea/volto-widget-toggle/pull/5)
10
28
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [`2bd2039`](https://github.com/eea/volto-widget-toggle/commit/2bd203979963ee5cb15592470e1d341d1bd65291)
11
29
 
package/Jenkinsfile CHANGED
@@ -4,8 +4,9 @@ pipeline {
4
4
  environment {
5
5
  GIT_NAME = "volto-widget-toggle"
6
6
  NAMESPACE = "@eeacms"
7
- SONARQUBE_TAGS = "volto.eea.europa.eu,forest.eea.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,biodiversity.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu"
7
+ SONARQUBE_TAGS = "volto.eea.europa.eu,forest.eea.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,biodiversity.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,circularity.eea.europa.eu"
8
8
  DEPENDENCIES = ""
9
+ VOLTO = "alpha"
9
10
  }
10
11
 
11
12
  stages {
@@ -31,8 +32,8 @@ pipeline {
31
32
  when {
32
33
  allOf {
33
34
  environment name: 'CHANGE_ID', value: ''
34
- not { branch 'master' }
35
35
  not { changelog '.*^Automated release [0-9\\.]+$' }
36
+ not { branch 'master' }
36
37
  }
37
38
  }
38
39
  steps {
@@ -63,7 +64,10 @@ pipeline {
63
64
  when {
64
65
  allOf {
65
66
  environment name: 'CHANGE_ID', value: ''
66
- not { changelog '.*^Automated release [0-9\\.]+$' }
67
+ anyOf {
68
+ not { changelog '.*^Automated release [0-9\\.]+$' }
69
+ branch 'master'
70
+ }
67
71
  }
68
72
  }
69
73
  steps {
@@ -108,7 +112,10 @@ pipeline {
108
112
  when {
109
113
  allOf {
110
114
  environment name: 'CHANGE_ID', value: ''
111
- not { changelog '.*^Automated release [0-9\\.]+$' }
115
+ anyOf {
116
+ not { changelog '.*^Automated release [0-9\\.]+$' }
117
+ branch 'master'
118
+ }
112
119
  }
113
120
  }
114
121
  steps {
@@ -118,8 +125,8 @@ pipeline {
118
125
  node(label: 'docker') {
119
126
  script {
120
127
  try {
121
- sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
122
- sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress'''
128
+ sh '''docker pull eeacms/plone-backend; docker run --rm -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend'''
129
+ sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=development -e VOLTO="$VOLTO" plone/volto-addon-ci cypress'''
123
130
  } finally {
124
131
  try {
125
132
  sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
@@ -136,7 +143,8 @@ pipeline {
136
143
  reportName: 'CypressCoverage',
137
144
  reportTitles: 'Integration Tests Code Coverage'])
138
145
  }
139
- archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true
146
+ sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
147
+ archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
140
148
  stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
141
149
  }
142
150
  finally {
@@ -159,12 +167,16 @@ pipeline {
159
167
 
160
168
  stage('Report to SonarQube') {
161
169
  when {
170
+ allOf {
162
171
  environment name: 'CHANGE_ID', value: ''
163
172
  anyOf {
164
173
  branch 'master'
165
- branch 'develop'
174
+ allOf {
175
+ branch 'develop'
176
+ not { changelog '.*^Automated release [0-9\\.]+$' }
177
+ }
166
178
  }
167
- not { changelog '.*^Automated release [0-9\\.]+$' }
179
+ }
168
180
  }
169
181
  steps {
170
182
  node(label: 'swarm') {
@@ -173,10 +185,10 @@ pipeline {
173
185
  unstash "xunit-reports"
174
186
  unstash "cypress-coverage"
175
187
  def scannerHome = tool 'SonarQubeScanner';
176
- def nodeJS = tool 'NodeJS11';
188
+ def nodeJS = tool 'NodeJS';
177
189
  withSonarQubeEnv('Sonarqube') {
178
190
  sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
179
- sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
191
+ sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
180
192
  sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
181
193
  }
182
194
  }
package/README.md CHANGED
@@ -1,7 +1,19 @@
1
1
  # volto-widget-toggle
2
+
2
3
  [![Releases](https://img.shields.io/github/v/release/eea/volto-widget-toggle)](https://github.com/eea/volto-widget-toggle/releases)
4
+
3
5
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-widget-toggle%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-widget-toggle/job/master/display/redirect)
6
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-master)
7
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-master)
8
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-master)
9
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-master)
10
+
4
11
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-widget-toggle%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-widget-toggle/job/develop/display/redirect)
12
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-develop)
13
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-develop)
14
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-develop)
15
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-toggle-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-toggle-develop)
16
+
5
17
 
6
18
  [Volto](https://github.com/plone/volto) add-on: Replace any checkbox with a nice toggle button within edit forms
7
19
 
@@ -44,6 +56,81 @@
44
56
 
45
57
  1. Happy editing!
46
58
 
59
+ ## Release
60
+
61
+ ### Automatic release using Jenkins
62
+
63
+ * The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory.
64
+ * It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
65
+ * The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the Readme.md badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage.
66
+ * Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool.
67
+ * As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready.
68
+ * The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
69
+ * You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation.
70
+ * Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
71
+
72
+ ### Manual release from the develop branch ( beta release )
73
+
74
+ #### Installation and configuration of release-it
75
+
76
+ You need to first install the [release-it](https://github.com/release-it/release-it) client.
77
+
78
+ ```
79
+ npm install -g release-it
80
+ ```
81
+
82
+ Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
83
+
84
+ Release-it is a tool that automates 4 important steps in the release process:
85
+
86
+ 1. Version increase in `package.json` ( increased from the current version in `package.json`)
87
+ 2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
88
+ 3. GitHub release on the commit with the changelog and package.json modification on the develop branch
89
+ 4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
90
+
91
+ To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
92
+
93
+ ```
94
+ export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
95
+ ```
96
+
97
+ To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
98
+
99
+ ```
100
+ echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
101
+ ```
102
+
103
+ #### Using release-it tool
104
+
105
+ There are 3 yarn scripts that can be run to do the release
106
+
107
+ ##### yarn release-beta
108
+
109
+ Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
110
+
111
+ ```
112
+ ? Select increment (next version):
113
+ ❯ prepatch (0.1.1-beta.0)
114
+ preminor (0.2.0-beta.0)
115
+ premajor (1.0.0-beta.0)
116
+ Other, please specify...
117
+ ```
118
+
119
+ ##### yarn release-major-beta
120
+
121
+ Same as `yarn release-beta`, but with premajor version pre-selected.
122
+
123
+ ##### yarn release
124
+
125
+ Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
126
+
127
+ #### Important notes
128
+
129
+ > Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
130
+
131
+ > Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version).
132
+
133
+
47
134
  ## How to contribute
48
135
 
49
136
  See [DEVELOP.md](https://github.com/eea/volto-widget-toggle/blob/master/DEVELOP.md).
@@ -27,7 +27,7 @@ coverage-end */
27
27
  export const setupBeforeEach = () => {
28
28
  cy.autologin();
29
29
  cy.createContent({
30
- contentType: 'Folder',
30
+ contentType: 'Document',
31
31
  contentId: 'cypress',
32
32
  contentTitle: 'Cypress',
33
33
  });
package/cypress.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "baseUrl": "http://localhost:3000",
3
3
  "viewportWidth": 1280,
4
- "defaultCommandTimeout": 15000,
4
+ "defaultCommandTimeout": 8888,
5
+ "chromeWebSecurity": false,
5
6
  "reporter": "junit",
6
7
  "video": true,
8
+ "retries": {
9
+ "runMode": 8,
10
+ "openMode": 0
11
+ },
7
12
  "reporterOptions": {
8
13
  "mochaFile": "cypress/reports/cypress-[hash].xml",
9
14
  "jenkinsMode": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-widget-toggle",
3
- "version": "2.2.4",
3
+ "version": "2.2.7",
4
4
  "description": "volto-widget-toggle: Volto add-on to replace checkboxes with toggle buttons",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -25,6 +25,8 @@
25
25
  },
26
26
  "scripts": {
27
27
  "release": "release-it",
28
+ "release-major-beta": "release-it major --preRelease=beta",
29
+ "release-beta": "release-it --preRelease=beta",
28
30
  "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
29
31
  "stylelint": "../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'",
30
32
  "stylelint:overrides": "../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'",