Skip to content

Commit

Permalink
Merge pull request #15 from eea/develop
Browse files Browse the repository at this point in the history
Add SonarQube badges
  • Loading branch information
avoinea authored Dec 18, 2021
2 parents ba5ccbb + 3e62d79 commit 30dec0f
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [4.3.3](https://github.com/eea/volto-group-block/compare/4.3.2...4.3.3)

- Add SonarQube badges [`bd17cc7`](https://github.com/eea/volto-group-block/commit/bd17cc7542d94a1338f4d47e167704cdd082e452)

#### [4.3.2](https://github.com/eea/volto-group-block/compare/4.3.1...4.3.2)

> 10 December 2021
- Develop [`#14`](https://github.com/eea/volto-group-block/pull/14)
- Correct Cypress tests [`#13`](https://github.com/eea/volto-group-block/pull/13)
- Refs #142010 - Optimize Volto-addons gitflow pipelines [`bc36cf5`](https://github.com/eea/volto-group-block/commit/bc36cf58c39e2b43c2fbf5189df6ddefc1260857)

Expand Down
22 changes: 16 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline {
environment {
GIT_NAME = "volto-group-block"
NAMESPACE = "@eeacms"
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"
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"
DEPENDENCIES = ""
}

Expand All @@ -31,8 +31,8 @@ pipeline {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
not { branch 'master' }
not { changelog '.*^Automated release [0-9\\.]+$' }
not { branch 'master' }
}
}
steps {
Expand Down Expand Up @@ -63,7 +63,10 @@ pipeline {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
not { changelog '.*^Automated release [0-9\\.]+$' }
anyOf {
not { changelog '.*^Automated release [0-9\\.]+$' }
branch 'master'
}
}
}
steps {
Expand Down Expand Up @@ -108,7 +111,10 @@ pipeline {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
not { changelog '.*^Automated release [0-9\\.]+$' }
anyOf {
not { changelog '.*^Automated release [0-9\\.]+$' }
branch 'master'
}
}
}
steps {
Expand Down Expand Up @@ -159,12 +165,16 @@ pipeline {

stage('Report to SonarQube') {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
anyOf {
branch 'master'
branch 'develop'
allOf {
branch 'develop'
not { changelog '.*^Automated release [0-9\\.]+$' }
}
}
not { changelog '.*^Automated release [0-9\\.]+$' }
}
}
steps {
node(label: 'swarm') {
Expand Down
87 changes: 87 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# volto-group-block

[![Releases](https://img.shields.io/github/v/release/eea/volto-group-block)](https://github.com/eea/volto-group-block/releases)

[![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-group-block%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-group-block/job/master/display/redirect)
[![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-group-block-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-group-block-master)
[![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-group-block-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-group-block-master)
[![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-group-block-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-group-block-master)
[![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-group-block-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-group-block-master)

[![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-group-block%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-group-block/job/develop/display/redirect)
[![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-group-block-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-group-block-develop)
[![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-group-block-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-group-block-develop)
[![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-group-block-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-group-block-develop)
[![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-group-block-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-group-block-develop)


[Volto](https://github.com/plone/volto) add-on to group blocks in sections and filter available blocks per content-type per section

Expand Down Expand Up @@ -72,6 +84,81 @@

1. Happy editing!

## Release

### Automatic release using Jenkins

* 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.
* It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
* 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.
* 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.
* 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.
* The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
* 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.
* Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.

### Manual release from the develop branch ( beta release )

#### Installation and configuration of release-it

You need to first install the [release-it](https://github.com/release-it/release-it) client.

```
npm install -g release-it
```

Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.

Release-it is a tool that automates 4 important steps in the release process:

1. Version increase in `package.json` ( increased from the current version in `package.json`)
2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
3. GitHub release on the commit with the changelog and package.json modification on the develop branch
4. NPM release ( by default it's disabled, but can be enabled in the configuration file )

To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)

```
export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
```

To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :

```
echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
```

#### Using release-it tool

There are 3 yarn scripts that can be run to do the release

##### yarn release-beta

Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).

```
? Select increment (next version):
❯ prepatch (0.1.1-beta.0)
preminor (0.2.0-beta.0)
premajor (1.0.0-beta.0)
Other, please specify...
```
##### yarn release-major-beta
Same as `yarn release-beta`, but with premajor version pre-selected.
##### yarn release
Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
#### Important notes
> 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.
> 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).
## How to contribute
See [DEVELOP.md](https://github.com/eea/volto-group-block/blob/master/DEVELOP.md).
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-group-block",
"version": "4.3.2",
"version": "4.3.3",
"description": "volto-group-block: Volto block to be used to group other blocks",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand All @@ -25,6 +25,8 @@
},
"scripts": {
"release": "release-it",
"release-major-beta": "release-it major --preRelease=beta",
"release-beta": "release-it --preRelease=beta",
"bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
"stylelint": "../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'",
"stylelint:overrides": "../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'",
Expand Down

0 comments on commit 30dec0f

Please sign in to comment.