Skip to content

Commit

Permalink
Merge pull request #31 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
claudiaifrim authored Aug 30, 2023
2 parents c43b4eb + 6684a55 commit a9f8503
Show file tree
Hide file tree
Showing 16 changed files with 389 additions and 88 deletions.
1 change: 0 additions & 1 deletion .i18n.babel.config.js

This file was deleted.

18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,25 @@ 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).

### [5.1.2](https://github.com/eea/volto-widget-temporal-coverage/compare/5.1.1...5.1.2) - 20 June 2023
### [5.1.3](https://github.com/eea/volto-widget-temporal-coverage/compare/5.1.2...5.1.3) - 30 August 2023

#### :house: Internal changes

- chore: Remove i18n.js script [Alin Voinea - [`9322f26`](https://github.com/eea/volto-widget-temporal-coverage/commit/9322f26c79826cb2c62308a6e357f881e1c29975)]

#### :house: Documentation changes

- docs: add demo gif - refs #253277 [ana-oprea - [`36161fe`](https://github.com/eea/volto-widget-temporal-coverage/commit/36161fe73d8622ea827c01b162c7b830010b0452)]
- docs: Cleanup Makefile, update DEVELOP documentation, i18n - refs #254894 [valentinab25 - [`ca96f9e`](https://github.com/eea/volto-widget-temporal-coverage/commit/ca96f9ec6378bf0838b47dc7e500d9ebdd3cae88)]

#### :hammer_and_wrench: Others

- test: Provide a compare function to avoid sorting elements alphabetically. [Alin Voinea - [`363df13`](https://github.com/eea/volto-widget-temporal-coverage/commit/363df1399a8a59efc4081d575a608ac9b2bf5d37)]
- test: Fix eslint and yarn i18n [Alin Voinea - [`3a7ac5d`](https://github.com/eea/volto-widget-temporal-coverage/commit/3a7ac5d534ec3ddeb0df9ee09eb124f10d9d553d)]
- test: Fix eslint and yarn i18n [Alin Voinea - [`c061cd8`](https://github.com/eea/volto-widget-temporal-coverage/commit/c061cd896e5f09b28d07aad22d0aebe50c783908)]
- i18n: Add en [Alin Voinea - [`b57b664`](https://github.com/eea/volto-widget-temporal-coverage/commit/b57b6643d857506247a4ef55df720d163c464caf)]
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`1a33e8d`](https://github.com/eea/volto-widget-temporal-coverage/commit/1a33e8d4556d342fa355b86249d3ec50cf7848da)]
### [5.1.2](https://github.com/eea/volto-widget-temporal-coverage/compare/5.1.1...5.1.2) - 20 June 2023

### [5.1.1](https://github.com/eea/volto-widget-temporal-coverage/compare/5.1.0...5.1.1) - 12 June 2023

#### :rocket: New Features
Expand Down
56 changes: 56 additions & 0 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

## Develop

1. Make sure you have `docker` and `docker compose` installed and running on your machine:

```Bash
git clone https://github.com/eea/volto-widget-temporal-coverage.git
cd volto-widget-temporal-coverage
git checkout -b bugfix-123456 develop
make
make start
```

1. Wait for `Volto started at 0.0.0.0:3000` meesage

1. Go to http://localhost:3000

1. Happy hacking!

```Bash
cd src/addons/volto-widget-temporal-coverage/
```

### Or add @eeacms/volto-widget-temporal-coverage to your Volto project

Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)

1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
Expand Down Expand Up @@ -49,3 +71,37 @@ Before starting make sure your development environment is properly set. See [Vol
1. Happy hacking!

cd src/addons/volto-widget-temporal-coverage/

## Cypress

To run cypress locally, first make sure you don't have any Volto/Plone running on ports `8080` and `3000`.
You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend
project where you added `volto-widget-temporal-coverage` to `mrs.developer.json`

Go to:

```BASH
cd src/addons/volto-widget-temporal-coverage/
```

Start:

```Bash
make
make start
```

This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-widget-temporal-coverage` block installed.

Open Cypress Interface:

```Bash
make cypress-open
```

Or run it:

```Bash
make cypress-run
```
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# syntax=docker/dockerfile:1
ARG VOLTO_VERSION
FROM plone/frontend-builder:${VOLTO_VERSION}

ARG ADDON_NAME
ARG ADDON_PATH

COPY --chown=node:node ./ /app/src/addons/${ADDON_PATH}/

RUN /setupAddon
RUN yarn install

ENTRYPOINT ["yarn"]
CMD ["start"]
25 changes: 25 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,31 @@ pipeline {
}
}

stage('SonarQube compare to master') {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
branch 'develop'
not { changelog '.*^Automated release [0-9\\.]+$' }
}
}
steps {
node(label: 'docker') {
script {
sh '''docker pull eeacms/gitflow'''
sh '''echo "Error" > checkresult.txt'''
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh '''set -o pipefail; docker run -i --rm --name="$BUILD_TAG-gitflow-sn" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /checkSonarqubemaster.sh | grep -v "Found script" | tee checkresult.txt'''
}

publishChecks name: 'SonarQube', title: 'Sonarqube Code Quality Check', summary: "Quality check on the SonarQube metrics from branch develop, comparing it with the ones from master branch. No bugs are allowed",
text: readFile(file: 'checkresult.txt'), conclusion: "${currentBuild.currentResult}",
detailsURL: "${env.BUILD_URL}display/redirect"
}
}
}
}

stage('Pull Request') {
when {
not {
Expand Down
134 changes: 84 additions & 50 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,54 +1,95 @@
SHELL=/bin/bash
##############################################################################
# Run:
# make
# make start
#
# Go to:
#
# http://localhost:3000
#
# Cypress:
#
# make cypress-open
#
##############################################################################
# SETUP MAKE
#
## Defensive settings for make: https://tech.davis-hansson.com/p/make/
SHELL:=bash
.ONESHELL:
# for Makefile debugging purposes add -x to the .SHELLFLAGS
.SHELLFLAGS:=-eu -o pipefail -O inherit_errexit -c
.SILENT:
.DELETE_ON_ERROR:
MAKEFLAGS+=--warn-undefined-variables
MAKEFLAGS+=--no-builtin-rules

# Colors
# OK=Green, warn=yellow, error=red
ifeq ($(TERM),)
# no colors if not in terminal
MARK_COLOR=
OK_COLOR=
WARN_COLOR=
ERROR_COLOR=
NO_COLOR=
else
MARK_COLOR=`tput setaf 6`
OK_COLOR=`tput setaf 2`
WARN_COLOR=`tput setaf 3`
ERROR_COLOR=`tput setaf 1`
NO_COLOR=`tput sgr0`
endif

##############################################################################
# SETTINGS AND VARIABLE
DIR=$(shell basename $$(pwd))
ADDON ?= "@eeacms/volto-widget-temporal-coverage"

# We like colors
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
YELLOW=`tput setaf 3`
NODE_MODULES?="../../../node_modules"
PLONE_VERSION?=6
VOLTO_VERSION?=16
ADDON_PATH="${DIR}"
ADDON_NAME="@eeacms/${ADDON_PATH}"
DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose

# Top-level targets
.PHONY: all
all: clean install

.PHONY: clean
clean: ## Cleanup development environment
${DOCKER_COMPOSE} down --volumes --remove-orphans

.PHONY: install
install: ## Build and install development environment
echo "Running: ${DOCKER_COMPOSE} build"
${DOCKER_COMPOSE} pull
${DOCKER_COMPOSE} build

.PHONY: start
start: ## Start development environment
echo "Running: ${DOCKER_COMPOSE} up"
${DOCKER_COMPOSE} up

.PHONY: shell
shell: ## Start a shell in the frontend container
echo "Running: ${DOCKER_COMPOSE} run frontend bash"
${DOCKER_COMPOSE} run --entrypoint=bash frontend

ifeq ($(wildcard ./project),)
NODE_MODULES = "../../../node_modules"
else
NODE_MODULES = "./project/node_modules"
endif
.PHONY: cypress-open
cypress-open: ## Open cypress integration tests
NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open

project:
npm install -g yo
npm install -g @plone/generator-volto
npm install -g mrs-developer
yo @plone/volto project --addon ${ADDON} --workspace "src/addons/${DIR}" --no-interactive
ln -sf $$(pwd) project/src/addons/
cp .project.eslintrc.js .eslintrc.js
cd project && yarn
@echo "-------------------"
@echo "$(GREEN)Volto project is ready!$(RESET)"
@echo "$(RED)Now run: cd project && yarn start$(RESET)"

all: project

.PHONY: start-test-backend
start-test-backend: ## Start Test Plone Backend
@echo "$(GREEN)==> Start Test Plone Backend$(RESET)"
docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e SITE=plone -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING

.PHONY: start-backend-docker
start-backend-docker: ## Starts a Docker-based backend
@echo "$(GREEN)==> Start Docker-based Plone Backend$(RESET)"
docker run -it --rm --name=plone -p 8080:8080 -e SITE=Plone -e ADDONS="kitconcept.volto" -e ZCML="kitconcept.volto.cors" plone
.PHONY: cypress-run
cypress-run: ## Run cypress integration tests
NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run

.PHONY: test
test: ## Run jest tests
docker pull plone/volto-addon-ci:alpha
docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" -e CI="true" plone/volto-addon-ci:alpha
${DOCKER_COMPOSE} run -e CI=1 frontend test

.PHONY: test-update
test-update: ## Update jest tests snapshots
docker pull plone/volto-addon-ci:alpha
docker run -it --rm -e NAMESPACE="@eeacms" -e GIT_NAME="${DIR}" -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/${DIR}" -e CI="true" plone/volto-addon-ci:alpha yarn test src/addons/${DIR}/src --watchAll=false -u
${DOCKER_COMPOSE} run -e CI=1 frontend test -u

.PHONY: stylelint
stylelint: ## Stylelint
Expand Down Expand Up @@ -84,14 +125,7 @@ i18n: ## i18n
rm -rf build/messages
NODE_ENV=development $(NODE_MODULES)/.bin/i18n --addon

.PHONY: cypress-run
cypress-run: ## Run cypress integration tests
NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run

.PHONY: cypress-open
cypress-open: ## Open cypress integration tests
NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open

.PHONY: help
help: ## Show this help.
help: ## Show this help.
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
head -n 14 Makefile
55 changes: 36 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,58 @@
[![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-temporal-coverage-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-temporal-coverage-develop)
[![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-widget-temporal-coverage-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-widget-temporal-coverage-develop)

[Volto](https://github.com/plone/volto) Widget: Temporal Coverage
[Volto](https://github.com/plone/volto) add-on

## Features

![Widget Temporal coverage](https://github.com/eea/volto-widget-temporal-coverage/raw/docs/docs/volto-widget-temporal-coverage.gif)
![Widget Temporal coverage](https://raw.githubusercontent.com/eea/volto-widget-temporal-coverage/master/docs/volto-widget-temporal-coverage.gif)

## Getting started

1. Create new volto project if you don't already have one:
### Try volto-widget-temporal-coverage with Docker

```
$ npm install -g yo @plone/generator-volto
$ yo @plone/volto my-volto-project --addon @eeacms/volto-widget-temporal-coverage
git clone https://github.com/eea/volto-widget-temporal-coverage.git
cd volto-widget-temporal-coverage
make
make start

$ cd my-volto-project
$ yarn add -W @eeacms/volto-widget-temporal-coverage
```
Go to http://localhost:3000

1. If you already have a volto project, just update `package.json`:
### Add volto-widget-temporal-coverage to your Volto project

```JSON
"addons": [
"@eeacms/volto-widget-temporal-coverage"
],
1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone

"dependencies": {
"@eeacms/volto-widget-temporal-coverage": "^2.0.0"
}
```Bash
docker compose up backend
```

1. Start Volto frontend

- If you already have a volto project, just update `package.json`:

```JSON
"addons": [
"@eeacms/volto-widget-temporal-coverage"
],

"dependencies": {
"@eeacms/volto-widget-temporal-coverage": "*"
}
```

- If not, create one:

```
npm install -g yo @plone/generator-volto
yo @plone/volto my-volto-project --canary --addon @eeacms/volto-widget-temporal-coverage
cd my-volto-project
```

1. Install new add-ons and restart Volto:

```
$ yarn
$ yarn start
yarn
yarn start
```

1. Go to http://localhost:3000
Expand Down
Loading

0 comments on commit a9f8503

Please sign in to comment.