feat: refs #6695 add setup and e2e testing
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
d673d30248
commit
884ad672b1
|
@ -0,0 +1,4 @@
|
||||||
|
FROM mariadb:10.11.6
|
||||||
|
ENV TZ Europe/Madrid
|
||||||
|
COPY --from=mariadb-with-data /data /var/lib/mysql
|
||||||
|
CMD ["mysqld"]
|
|
@ -1,59 +1,26 @@
|
||||||
FROM node:lts-bookworm
|
FROM node:lts-bookworm
|
||||||
# ENV SHELL bash
|
ENV SHELL bash
|
||||||
# ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
# ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
# RUN npm install -g pnpm@8.15.1 && \
|
RUN npm install -g pnpm@8.15.1 && \
|
||||||
# pnpm setup && \
|
pnpm setup && \
|
||||||
# pnpm install -g @quasar/cli@2.2.1
|
pnpm install -g @quasar/cli@2.2.1
|
||||||
|
|
||||||
# RUN apt-get -y --fix-missing update && \
|
RUN apt-get -y --fix-missing update && \
|
||||||
# apt-get -y --fix-missing upgrade && \
|
apt-get -y --fix-missing upgrade && \
|
||||||
# apt-get -y --no-install-recommends install \
|
apt-get -y --no-install-recommends install \
|
||||||
# apt-utils \
|
apt-utils \
|
||||||
# libgtk2.0-0 \
|
libgtk2.0-0 \
|
||||||
# libgtk-3-0 \
|
libgtk-3-0 \
|
||||||
# libgbm-dev \
|
libgbm-dev \
|
||||||
# libnotify-dev \
|
libnotify-dev \
|
||||||
# libnss3 \
|
libnss3 \
|
||||||
# libxss1 \
|
libxss1 \
|
||||||
# libasound2 \
|
libasound2 \
|
||||||
# libxtst6 \
|
libxtst6 \
|
||||||
# xauth \
|
xauth \
|
||||||
# xvfb \
|
xvfb \
|
||||||
# chromium \
|
chromium \
|
||||||
# && apt-get clean \
|
&& apt-get clean \
|
||||||
# && rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# WORKDIR /app
|
|
||||||
|
|
||||||
# COPY \
|
|
||||||
# package.json \
|
|
||||||
# .npmrc \
|
|
||||||
# pnpm-lock.yaml \
|
|
||||||
# ./
|
|
||||||
|
|
||||||
# # RUN if [ ! -d "node_modules" ]; then \
|
|
||||||
# # pnpm install; \
|
|
||||||
# # fi && \
|
|
||||||
# # pnpm install cypress && \
|
|
||||||
# # npx cypress install
|
|
||||||
|
|
||||||
# RUN pnpm install --prefer-offline && \
|
|
||||||
# pnpm install cypress && \
|
|
||||||
# npx cypress install
|
|
||||||
|
|
||||||
# COPY \
|
|
||||||
# quasar.config.js \
|
|
||||||
# index.html \
|
|
||||||
# jsconfig.json \
|
|
||||||
# quasar.extensions.json \
|
|
||||||
# # .eslintignore \
|
|
||||||
# # .eslintrc.js \
|
|
||||||
# postcss.config.js \
|
|
||||||
# cypress.config.js \
|
|
||||||
# ./
|
|
||||||
|
|
||||||
# COPY src src
|
|
||||||
# COPY test/cypress test/cypress
|
|
||||||
# COPY public public
|
|
||||||
|
|
||||||
|
|
|
@ -99,15 +99,17 @@ pipeline {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
|
env.NETWORK = "${PROJECT_NAME}-${env.BRANCH_NAME}-${env.BUILD_ID}"
|
||||||
cleanDockerE2E()
|
cleanDockerE2E()
|
||||||
def repoFolder = "salix"
|
// def repoFolder = "salix"
|
||||||
if (fileExists(repoFolder)) {
|
// if (fileExists(repoFolder)) {
|
||||||
dir(repoFolder) {
|
// dir(repoFolder) {
|
||||||
sh 'git pull'
|
// sh 'git pull'
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
sh "git clone https://gitea.verdnatura.es/verdnatura/salix.git"
|
// sh "git clone https://gitea.verdnatura.es/verdnatura/salix.git"
|
||||||
}
|
// }
|
||||||
|
sh "pnpm exec cypress install"
|
||||||
}
|
}
|
||||||
// sh 'rm -rf salix'
|
// sh 'rm -rf salix'
|
||||||
// sh 'git clone dev https://gitea.verdnatura.es/verdnatura/salix.git'
|
// sh 'git clone dev https://gitea.verdnatura.es/verdnatura/salix.git'
|
||||||
|
@ -117,33 +119,25 @@ pipeline {
|
||||||
parallel{
|
parallel{
|
||||||
stage('Database') {
|
stage('Database') {
|
||||||
steps {
|
steps {
|
||||||
sh 'cd salix && pnpm i --prefer-offline @verdnatura/myt && npx myt run -t -d'
|
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up -d db"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Backend') {
|
stage('Backend') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker build -f ./salix/back/Dockerfile -t back ./salix'
|
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up -d back"
|
||||||
sh 'docker run -d --name salix_e2e --net=host -v $(pwd)/test/cypress/storage:/salix/storage back'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Frontend') {
|
stage('Frontend') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker build -f ./Dockerfile.e2e -t front .'
|
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up -d front"
|
||||||
// sh 'docker-compose -f docker-compose.e2e.yml up -d --build front'
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// stage('Build Cypress') {
|
|
||||||
// steps {
|
|
||||||
// sh 'docker-compose -f docker-compose.e2e.yml build e2e'
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Run E2E') {
|
stage('Run E2E') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
sh 'docker-compose -f docker-compose.e2e.yml up e2e'
|
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up e2e"
|
||||||
def containerId = sh(script: "docker-compose -f docker-compose.e2e.yml ps -q e2e", returnStdout: true).trim()
|
def containerId = sh(script: "docker-compose -f docker-compose.e2e.yml ps -q e2e", returnStdout: true).trim()
|
||||||
if (containerId) {
|
if (containerId) {
|
||||||
def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim()
|
def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim()
|
||||||
|
@ -204,8 +198,8 @@ pipeline {
|
||||||
|
|
||||||
def cleanDockerE2E() {
|
def cleanDockerE2E() {
|
||||||
script {
|
script {
|
||||||
sh 'docker rm -f vn-database || true'
|
// sh 'docker rm -f vn-database || true'
|
||||||
sh 'docker rm -f salix_e2e || true'
|
// sh 'docker rm -f salix_e2e || true'
|
||||||
sh 'docker-compose -f docker-compose.e2e.yml down || true'
|
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml down || true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,13 @@ import { defineConfig } from 'cypress';
|
||||||
// https://docs.cypress.io/app/references/configuration
|
// https://docs.cypress.io/app/references/configuration
|
||||||
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
||||||
|
|
||||||
|
// const baseUrl = `http://${process.env.NETWORK ? 'front' : 'localhost'}:9000`;
|
||||||
|
const baseUrl = `http://front:9000`;
|
||||||
|
console.log('process.env.NETWORK: ', process.env.NETWORK);
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
baseUrl: 'http://127.0.0.1:9000/',
|
baseUrl,
|
||||||
experimentalStudio: false, // Desactivado para evitar tiempos de espera innecesarios
|
experimentalStudio: false, // Desactivado para evitar tiempos de espera innecesarios
|
||||||
defaultCommandTimeout: 10000,
|
defaultCommandTimeout: 10000,
|
||||||
requestTimeout: 10000,
|
requestTimeout: 10000,
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
npx myt run -t
|
||||||
|
docker exec -it vn-database sh
|
||||||
|
cp -r /var/lib/mysql /data
|
||||||
|
exit
|
||||||
|
docker commit vn-database vn_db
|
||||||
|
|
||||||
|
# FROM mariadb:latest
|
||||||
|
# COPY --from=vn_db /data /var/lib/mysql
|
||||||
|
# CMD ["mysqld"]
|
||||||
|
|
||||||
|
docker build -t vn_db .
|
|
@ -1,20 +1,57 @@
|
||||||
version: '3.7'
|
version: '3.7'
|
||||||
services:
|
services:
|
||||||
front:
|
back:
|
||||||
# command: pnpx quasar dev
|
# image: registry.verdnatura.es/salix-back:${VERSION:?}
|
||||||
# command: npx quasar serve --history --proxy ./proxy.mjs --hostname 127.0.0.1 --port 9000
|
image: back_try
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: ./Dockerfile.e2e
|
|
||||||
network_mode: host
|
|
||||||
e2e:
|
|
||||||
command: pnpx cypress run --browser chromium
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: ./Dockerfile.e2e
|
|
||||||
network_mode: host
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./node_modules:/app/node_modules
|
- ./test/cypress/storage:/salix/storage
|
||||||
|
- ./test/cypress/back/datasources.json:/salix/loopback/server/datasources.json
|
||||||
|
ports:
|
||||||
|
- '3000:3000'
|
||||||
|
front:
|
||||||
|
image: alexmorenovn/vndev:latest
|
||||||
|
command: quasar dev
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
working_dir: /app
|
||||||
|
# ports:
|
||||||
|
# - '9000:9000'
|
||||||
|
e2e:
|
||||||
|
image: alexmorenovn/vndev:latest
|
||||||
|
# command: pnpm exec cypress run --browser chromium
|
||||||
|
command: sh -c "pnpm exec cypress install && pnpm exec cypress run --browser chromium"
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
working_dir: /app
|
||||||
|
db:
|
||||||
|
image: alexmorenovn/vn_db:latest
|
||||||
|
ports:
|
||||||
|
- '3306:3306'
|
||||||
|
|
||||||
|
# e2e:
|
||||||
|
# command: npx cypress run --browser chromium
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: ./Dockerfile.e2e
|
||||||
|
# volumes:
|
||||||
|
# - .:/app
|
||||||
|
# working_dir: /app
|
||||||
|
|
||||||
|
# front:
|
||||||
|
# # command: pnpx quasar dev
|
||||||
|
# # command: npx quasar serve --history --proxy ./proxy.mjs --hostname 127.0.0.1 --port 9000
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: ./Dockerfile.e2e
|
||||||
|
# network_mode: host
|
||||||
|
# e2e:
|
||||||
|
# command: pnpx cypress run --browser chromium
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: ./Dockerfile.e2e
|
||||||
|
# network_mode: host
|
||||||
|
# volumes:
|
||||||
|
# - ./node_modules:/app/node_modules
|
||||||
# db:
|
# db:
|
||||||
# image: db
|
# image: db
|
||||||
# command: npx myt run -t --ci -d -n front_default
|
# command: npx myt run -t --ci -d -n front_default
|
||||||
|
|
11
e2e.sh
11
e2e.sh
|
@ -1,6 +1,5 @@
|
||||||
cd salix && pnpm i --prefer-offline @verdnatura/myt && npx myt run -t -d
|
# Con un comando docker de usar y tirar instalar los node_modules + pnpm exec cypress install
|
||||||
cd .. && docker build -f ./salix/back/Dockerfile -t back ./salix
|
docker-compose -p lilium-e2e -f docker-compose.e2e.yml up -d back
|
||||||
docker run -d --name salix_e2e --net=host -v $(pwd)/test/cypress/storage:/salix/storage back
|
docker-compose -p lilium-e2e -f docker-compose.e2e.yml up -d db
|
||||||
quasar build
|
docker-compose -p lilium-e2e -f docker-compose.e2e.yml up -d front
|
||||||
docker-compose -f docker-compose.e2e.yml up -d --build front
|
docker-compose -p lilium-e2e -f docker-compose.e2e.yml up e2e
|
||||||
docker-compose -f docker-compose.e2e.yml up --build e2e
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
import { configure } from 'quasar/wrappers';
|
import { configure } from 'quasar/wrappers';
|
||||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
const target = `http://${process.env.NETWORK || 'localhost'}:3000`;
|
||||||
|
|
||||||
export default configure(function (/* ctx */) {
|
export default configure(function (/* ctx */) {
|
||||||
return {
|
return {
|
||||||
|
@ -109,7 +110,7 @@ export default configure(function (/* ctx */) {
|
||||||
},
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://127.0.0.1:3000',
|
target: target,
|
||||||
logLevel: 'debug',
|
logLevel: 'debug',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: false,
|
secure: false,
|
||||||
|
|
|
@ -0,0 +1,149 @@
|
||||||
|
{
|
||||||
|
"db": {
|
||||||
|
"connector": "memory",
|
||||||
|
"timezone": "local"
|
||||||
|
},
|
||||||
|
"vn": {
|
||||||
|
"connector": "vn-mysql",
|
||||||
|
"database": "vn",
|
||||||
|
"debug": false,
|
||||||
|
"host": "db",
|
||||||
|
"port": "3306",
|
||||||
|
"username": "root",
|
||||||
|
"password": "root",
|
||||||
|
"connectionLimit": 100,
|
||||||
|
"queueLimit": 100,
|
||||||
|
"multipleStatements": true,
|
||||||
|
"legacyUtcDateProcessing": false,
|
||||||
|
"timezone": "local",
|
||||||
|
"connectTimeout": 40000,
|
||||||
|
"acquireTimeout": 90000,
|
||||||
|
"waitForConnections": true,
|
||||||
|
"maxIdleTime": 60000,
|
||||||
|
"idleTimeout": 60000
|
||||||
|
},
|
||||||
|
"osticket": {
|
||||||
|
"connector": "memory",
|
||||||
|
"timezone": "local"
|
||||||
|
},
|
||||||
|
"tempStorage": {
|
||||||
|
"name": "tempStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/tmp",
|
||||||
|
"maxFileSize": "262144000",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"application/x-7z-compressed",
|
||||||
|
"application/x-zip-compressed",
|
||||||
|
"application/x-rar-compressed",
|
||||||
|
"application/octet-stream",
|
||||||
|
"application/pdf",
|
||||||
|
"application/zip",
|
||||||
|
"application/rar",
|
||||||
|
"multipart/x-zip",
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
|
"video/mp4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dmsStorage": {
|
||||||
|
"name": "dmsStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/dms",
|
||||||
|
"maxFileSize": "262144000",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"application/x-7z-compressed",
|
||||||
|
"application/x-zip-compressed",
|
||||||
|
"application/x-rar-compressed",
|
||||||
|
"application/octet-stream",
|
||||||
|
"application/pdf",
|
||||||
|
"application/zip",
|
||||||
|
"application/rar",
|
||||||
|
"multipart/x-zip",
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"imageStorage": {
|
||||||
|
"name": "imageStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/image",
|
||||||
|
"maxFileSize": "52428800",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"invoiceStorage": {
|
||||||
|
"name": "invoiceStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/pdfs/invoice",
|
||||||
|
"maxFileSize": "52428800",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"application/octet-stream",
|
||||||
|
"application/pdf"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"claimStorage": {
|
||||||
|
"name": "claimStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/dms",
|
||||||
|
"maxFileSize": "31457280",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
|
"video/mp4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"entryStorage": {
|
||||||
|
"name": "entryStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/dms",
|
||||||
|
"maxFileSize": "31457280",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
|
"video/mp4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"supplierStorage": {
|
||||||
|
"name": "supplierStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/dms",
|
||||||
|
"maxFileSize": "31457280",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
|
"video/mp4",
|
||||||
|
"application/pdf"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"accessStorage": {
|
||||||
|
"name": "accessStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/access",
|
||||||
|
"maxFileSize": "524288000",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"application/x-7z-compressed"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue