Skip to content

Commit

Permalink
Merge pull request #83 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tedw87 authored Feb 6, 2025
2 parents 20bec91 + a850f5a commit 03f8a17
Show file tree
Hide file tree
Showing 17 changed files with 2,949 additions and 1,394 deletions.
58 changes: 31 additions & 27 deletions .bundlewatch.config.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
{
"files": [
{
"path": "build/public/static/js/*.js",
"maxSize": "50kB"
},
{
"path": "build/public/static/js/d3*.js",
"maxSize": "103kB"
},
{
"path": "build/public/static/js/draft-js*.js",
"maxSize": "125kB"
},
{
"path": "build/public/static/js/prettier-standalone*.js",
"maxSize": "140kB"
},
{
"path": "build/public/static/js/react-sortable*.js",
"maxSize": "70kB"
},
{
"path": "build/public/static/js/client*.js",
"maxSize": "1.2MB"
}
]
}
"files": [
{
"path": "build/public/static/js/*.js",
"maxSize": "50kB"
},
{
"path": "build/public/static/js/sanitize-*.js",
"maxSize": "85kB"
},
{
"path": "build/public/static/js/d3*.js",
"maxSize": "103kB"
},
{
"path": "build/public/static/js/draft-js*.js",
"maxSize": "120kB"
},
{
"path": "build/public/static/js/react-sortable*.js",
"maxSize": "70kB"
},
{
"path": "build/public/static/js/client*.js",
"maxSize": "1.3MB"
},
{
"path": "build/public/static/js/rehype-prism-plus*.js",
"maxSize": "250kB"
}
]
}
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ omelette
bootstrap
cypress*.json
docker-compose.yml
Dockerfile
Jenkinsfile
start_.sh
start_.sh
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
src/addons/**/node_modules
src/addons/**/cypress
src/addons/**/build
src/addons/**/build
13 changes: 11 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const addonAliases = Object.keys(reg.packages).map((o) => [
reg.packages[o].modulePath,
]);

module.exports = {
const addonExtenders = reg.getEslintExtenders().map((m) => require(m));

const defaultConfig = {
extends: `${voltoPath}/.eslintrc`,
settings: {
'import/resolver': {
Expand All @@ -40,11 +42,18 @@ module.exports = {
['@root', `${__dirname}/src`],
['~', `${__dirname}/src`],
],
extensions: ['.js', '.jsx', '.json'],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
'babel-plugin-root-import': {
rootPathSuffix: 'src',
},
},
},
};

const config = addonExtenders.reduce(
(acc, extender) => extender.modify(acc),
defaultConfig,
);

module.exports = config;
6 changes: 3 additions & 3 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defaultSemverRangePrefix: ""

defaultSemverRangePrefix: ''
nodeLinker: node-modules

enableImmutableInstalls: false
checksumBehavior: update
yarnPath: .yarn/releases/yarn-3.2.3.cjs
136 changes: 120 additions & 16 deletions CHANGELOG.md

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-slim
FROM node:18-bullseye-slim

COPY . /app/
WORKDIR /app/
Expand All @@ -16,17 +16,21 @@ RUN runDeps="openssl ca-certificates patch gosu git make tmux locales-all" \
&& find /app/ -not -user node -exec chown node {} \+ \
&& corepack enable

# Build
USER node

ARG MAX_OLD_SPACE_SIZE=16384
ENV NODE_OPTIONS=--max_old_space_size=$MAX_OLD_SPACE_SIZE

RUN yarn \
&& yarn build \
&& rm -rf /home/node/.cache \
&& rm -rf /home/node/.yarn \
&& rm -rf /home/node/.npm \
&& rm -rf /app/.yarn/cache
&& yarn build \
&& rm -rf /home/node/.cache \
&& rm -rf /home/node/.yarn \
&& rm -rf /home/node/.npm \
&& rm -rf /app/.yarn/cache

USER root

EXPOSE 3000 3001

ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["yarn", "start:prod"]
CMD ["yarn", "start:prod"]
203 changes: 129 additions & 74 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,85 +10,137 @@ pipeline {
SONARQUBE_TAG = 'climate-advisory-board.europa.eu'
}

agent any
agent any

stages {

stage('Integration tests') {
parallel {

stage("Cypress") {
// stage('Integration tests') {
// parallel {
// stage('Run Cypress: @eeacms/volto-*') {
// when {
// allOf {
// environment name: 'CHANGE_ID', value: ''
// not { branch 'master' }
// not { changelog '.*^Automated release [0-9\\.]+$' }
// not { buildingTag() }
// }
// }
// steps {
// node(label: 'docker') {
// script {
// try {
// sh '''docker pull eeacms/eea-website-backend; docker run --rm -d --name="$BUILD_TAG-plone-eeacms" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/eea-website-backend'''
// sh '''docker pull eeacms/volto-project-ci; docker run -i --name="$BUILD_TAG-cypress-eeacms" --link $BUILD_TAG-plone-eeacms:plone -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" eeacms/volto-project-ci --config-file cypress.eeacms.json'''
// } finally {
// try {
// sh '''rm -rf cypress-reports cypress-results'''
// sh '''mkdir -p cypress-reports cypress-results'''
// sh '''docker cp $BUILD_TAG-cypress-eeacms:/opt/frontend/my-volto-project/cypress/videos cypress-reports/'''
// sh '''docker cp $BUILD_TAG-cypress-eeacms:/opt/frontend/my-volto-project/cypress/reports cypress-results/'''
// 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#^node_modules/volto-slate/##g' | sed 's#^node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
// archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
// }
// finally {
// catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
// junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
// }
// sh script: "docker stop $BUILD_TAG-plone-eeacms", returnStatus: true
// sh script: "docker rm -v $BUILD_TAG-plone-eeacms", returnStatus: true
// sh script: "docker rm -v $BUILD_TAG-cypress-eeacms", returnStatus: true
// }
// }
// }
// }
// }
// }

// stage('Run Cypress: volto-slate') {
// when {
// allOf {
// environment name: 'CHANGE_ID', value: ''
// not { branch 'master' }
// not { changelog '.*^Automated release [0-9\\.]+$' }
// not { buildingTag() }
// }
// }
// steps {
// node(label: 'docker') {
// script {
// try {
// sh '''docker pull eeacms/eea-website-backend; docker run --rm -d --name="$BUILD_TAG-plone-slate" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/eea-website-backend'''
// sh '''docker pull eeacms/volto-project-ci; docker run -i --name="$BUILD_TAG-cypress-slate" --link $BUILD_TAG-plone-slate:plone -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" eeacms/volto-project-ci --config-file cypress.slate.json'''
// } finally {
// try {
// sh '''rm -rf cypress-reports cypress-results'''
// sh '''mkdir -p cypress-reports cypress-results'''
// sh '''docker cp $BUILD_TAG-cypress-slate:/opt/frontend/my-volto-project/cypress/videos cypress-reports/'''
// sh '''docker cp $BUILD_TAG-cypress-slate:/opt/frontend/my-volto-project/cypress/reports cypress-results/'''
// 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#^node_modules/volto-slate/##g' | sed 's#^node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
// archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
// }
// finally {
// catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
// junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
// }
// sh script: "docker stop $BUILD_TAG-plone-slate", returnStatus: true
// sh script: "docker rm -v $BUILD_TAG-plone-slate", returnStatus: true
// sh script: "docker rm -v $BUILD_TAG-cypress-slate", returnStatus: true
// }
// }
// }
// }
// }
// }

// stage("Docker test build") {
// when {
// allOf {
// not { changelog '.*^Automated release [0-9\\.]+$' }
// not { environment name: 'CHANGE_ID', value: '' }
// environment name: 'CHANGE_TARGET', value: 'master'
// }
// }
// environment {
// IMAGE_NAME = BUILD_TAG.toLowerCase()
// }
// steps {
// node(label: 'docker-host') {
// script {
// checkout scm
// try {
// dockerImage = docker.build("${IMAGE_NAME}", "--no-cache .")
// } finally {
// sh script: "docker rmi ${IMAGE_NAME}", returnStatus: true
// }
// }
// }
// }
// }


// }
// }

stage('Bundlewatch') {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
anyOf {
not { changelog '.*^Automated release [0-9\\.]+$' }
branch 'master'
}
}
branch 'develop'
not { changelog '.*^Automated release [0-9\\.]+$' }
}
steps {
node(label: 'docker') {
script {
try {
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'''
sh '''docker pull eeacms/volto-project-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" eeacms/volto-project-ci'''
} finally {
try {
sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
sh '''mkdir -p cypress-reports cypress-results cypress-coverage'''
sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/cypress/videos cypress-reports/'''
sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/cypress/reports cypress-results/'''
coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/coverage cypress-coverage/''', returnStatus: true
if ( coverage == 0 ) {
publishHTML (target : [allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'cypress-coverage/coverage/lcov-report',
reportFiles: 'index.html',
reportName: 'CypressCoverage',
reportTitles: 'Integration Tests Code Coverage'])
}
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'''
archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
}
finally {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
}
sh script: "docker stop $BUILD_TAG-plone", returnStatus: true
sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true
sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true
}
}
}
}
node(label: 'docker-big-jobs') {
script {
checkout scm
env.NODEJS_HOME = "${tool 'NodeJS'}"
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
env.CI=false
sh "yarn config set -H enableImmutableInstalls false"
sh "yarn"
sh "make develop"
sh "make install"
sh "make build"
sh "make bundlewatch"
}
}

stage('Bundlewatch') {
when {
not { changelog '.*^Automated release [0-9\\.]+$' }
branch 'develop'
}
steps {
node(label: 'docker-big-jobs') {
script {
checkout scm
env.NODEJS_HOME = "${tool 'NodeJS'}"
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
env.CI=false
sh "yarn config set -H enableImmutableInstalls false"
sh "yarn"
sh "make develop"
sh "make install"
sh "make build"
sh "make bundlewatch"
}
}
}
}
}
}

Expand Down Expand Up @@ -135,10 +187,13 @@ pipeline {

stage('Build & Push ( on tag )') {
when {
buildingTag()
anyOf {
buildingTag()
branch 'volto-17'
}
}
steps{
node(label: 'docker-host') {
node(label: 'docker-big-jobs') {
script {
checkout scm
if (env.BRANCH_NAME == 'master') {
Expand Down Expand Up @@ -239,4 +294,4 @@ pipeline {
}
}
}
}
}
Loading

0 comments on commit 03f8a17

Please sign in to comment.