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
|
||||
# ENV SHELL bash
|
||||
# ENV PNPM_HOME="/pnpm"
|
||||
# ENV PATH="$PNPM_HOME:$PATH"
|
||||
# RUN npm install -g pnpm@8.15.1 && \
|
||||
# pnpm setup && \
|
||||
# pnpm install -g @quasar/cli@2.2.1
|
||||
ENV SHELL bash
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN npm install -g pnpm@8.15.1 && \
|
||||
pnpm setup && \
|
||||
pnpm install -g @quasar/cli@2.2.1
|
||||
|
||||
# RUN apt-get -y --fix-missing update && \
|
||||
# apt-get -y --fix-missing upgrade && \
|
||||
# apt-get -y --no-install-recommends install \
|
||||
# apt-utils \
|
||||
# libgtk2.0-0 \
|
||||
# libgtk-3-0 \
|
||||
# libgbm-dev \
|
||||
# libnotify-dev \
|
||||
# libnss3 \
|
||||
# libxss1 \
|
||||
# libasound2 \
|
||||
# libxtst6 \
|
||||
# xauth \
|
||||
# xvfb \
|
||||
# chromium \
|
||||
# && apt-get clean \
|
||||
# && 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
|
||||
RUN apt-get -y --fix-missing update && \
|
||||
apt-get -y --fix-missing upgrade && \
|
||||
apt-get -y --no-install-recommends install \
|
||||
apt-utils \
|
||||
libgtk2.0-0 \
|
||||
libgtk-3-0 \
|
||||
libgbm-dev \
|
||||
libnotify-dev \
|
||||
libnss3 \
|
||||
libxss1 \
|
||||
libasound2 \
|
||||
libxtst6 \
|
||||
xauth \
|
||||
xvfb \
|
||||
chromium \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
|
@ -99,15 +99,17 @@ pipeline {
|
|||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||
env.NETWORK = "${PROJECT_NAME}-${env.BRANCH_NAME}-${env.BUILD_ID}"
|
||||
cleanDockerE2E()
|
||||
def repoFolder = "salix"
|
||||
if (fileExists(repoFolder)) {
|
||||
dir(repoFolder) {
|
||||
sh 'git pull'
|
||||
}
|
||||
} else {
|
||||
sh "git clone https://gitea.verdnatura.es/verdnatura/salix.git"
|
||||
}
|
||||
// def repoFolder = "salix"
|
||||
// if (fileExists(repoFolder)) {
|
||||
// dir(repoFolder) {
|
||||
// sh 'git pull'
|
||||
// }
|
||||
// } else {
|
||||
// sh "git clone https://gitea.verdnatura.es/verdnatura/salix.git"
|
||||
// }
|
||||
sh "pnpm exec cypress install"
|
||||
}
|
||||
// sh 'rm -rf salix'
|
||||
// sh 'git clone dev https://gitea.verdnatura.es/verdnatura/salix.git'
|
||||
|
@ -117,33 +119,25 @@ pipeline {
|
|||
parallel{
|
||||
stage('Database') {
|
||||
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') {
|
||||
steps {
|
||||
sh 'docker build -f ./salix/back/Dockerfile -t back ./salix'
|
||||
sh 'docker run -d --name salix_e2e --net=host -v $(pwd)/test/cypress/storage:/salix/storage back'
|
||||
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up -d back"
|
||||
}
|
||||
}
|
||||
stage('Frontend') {
|
||||
steps {
|
||||
sh 'docker build -f ./Dockerfile.e2e -t front .'
|
||||
// sh 'docker-compose -f docker-compose.e2e.yml up -d --build front'
|
||||
|
||||
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up -d front"
|
||||
}
|
||||
}
|
||||
// stage('Build Cypress') {
|
||||
// steps {
|
||||
// sh 'docker-compose -f docker-compose.e2e.yml build e2e'
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
stage('Run E2E') {
|
||||
steps {
|
||||
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()
|
||||
if (containerId) {
|
||||
def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim()
|
||||
|
@ -204,8 +198,8 @@ pipeline {
|
|||
|
||||
def cleanDockerE2E() {
|
||||
script {
|
||||
sh 'docker rm -f vn-database || true'
|
||||
sh 'docker rm -f salix_e2e || true'
|
||||
sh 'docker-compose -f docker-compose.e2e.yml down || true'
|
||||
// sh 'docker rm -f vn-database || true'
|
||||
// sh 'docker rm -f salix_e2e || 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://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({
|
||||
e2e: {
|
||||
baseUrl: 'http://127.0.0.1:9000/',
|
||||
baseUrl,
|
||||
experimentalStudio: false, // Desactivado para evitar tiempos de espera innecesarios
|
||||
defaultCommandTimeout: 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'
|
||||
services:
|
||||
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
|
||||
back:
|
||||
# image: registry.verdnatura.es/salix-back:${VERSION:?}
|
||||
image: back_try
|
||||
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:
|
||||
# image: db
|
||||
# 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
|
||||
cd .. && docker build -f ./salix/back/Dockerfile -t back ./salix
|
||||
docker run -d --name salix_e2e --net=host -v $(pwd)/test/cypress/storage:/salix/storage back
|
||||
quasar build
|
||||
docker-compose -f docker-compose.e2e.yml up -d --build front
|
||||
docker-compose -f docker-compose.e2e.yml up --build e2e
|
||||
# Con un comando docker de usar y tirar instalar los node_modules + pnpm exec cypress install
|
||||
docker-compose -p lilium-e2e -f docker-compose.e2e.yml up -d back
|
||||
docker-compose -p lilium-e2e -f docker-compose.e2e.yml up -d db
|
||||
docker-compose -p lilium-e2e -f docker-compose.e2e.yml up -d front
|
||||
docker-compose -p lilium-e2e -f docker-compose.e2e.yml up e2e
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
import { configure } from 'quasar/wrappers';
|
||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
||||
import path from 'path';
|
||||
const target = `http://${process.env.NETWORK || 'localhost'}:3000`;
|
||||
|
||||
export default configure(function (/* ctx */) {
|
||||
return {
|
||||
|
@ -109,7 +110,7 @@ export default configure(function (/* ctx */) {
|
|||
},
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:3000',
|
||||
target: target,
|
||||
logLevel: 'debug',
|
||||
changeOrigin: true,
|
||||
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