From 5b4d2bd16cc15da0fdcd8869e44d41d6e8a79e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Fri, 16 Jun 2023 11:40:23 +0200 Subject: [PATCH] refactor: app deployment --- .c8rc.json | 2 +- .dockerignore | 7 - .gitignore | 1 + .gitlab-ci.yml | 67 +++-- .gitlab/ci/install-for-turbo.sh | 6 + .mocharc.json | 2 + .npmrc | 3 +- Dockerfile | 12 - backend/backend/.gitlab-ci.yml | 18 +- backend/backend/Dockerfile | 6 +- backend/backend/integration-test.sh | 22 ++ backend/backend/integration-test.yml | 9 +- backend/backend/package.json | 14 +- backend/backend/turbo.json | 12 - backend/proxy/package.json | 1 + configuration/prettier-config/package.json | 5 - configuration/projectmanagement/package.json | 1 + coverage.mjs | 10 +- examples/minimal-connector/package.json | 1 + frontend/app/angular.json | 2 +- frontend/app/package.json | 9 +- package.json | 8 +- packages/api-cli/Dockerfile | 4 +- packages/api-cli/package.json | 6 +- packages/api-cli/src/app.ts | 7 +- packages/api-cli/src/e2e.ts | 155 ++++++++---- packages/api-cli/test/e2e.spec.ts | 12 +- packages/api-cli/turbo.json | 9 + packages/api-plugin/package.json | 3 +- packages/api/package.json | 1 + packages/collection-utils/package.json | 1 + packages/core-tools/package.json | 1 + packages/core/package.json | 1 + packages/easy-ast/package.json | 1 + packages/es-mapping-generator/package.json | 1 + packages/gitlab-api/.gitignore | 91 ------- packages/logger/package.json | 1 + pnpm-lock.yaml | 244 +++++++++++++++++-- turbo.json | 13 +- 39 files changed, 523 insertions(+), 246 deletions(-) delete mode 100644 .dockerignore create mode 100644 .gitlab/ci/install-for-turbo.sh delete mode 100644 Dockerfile create mode 100755 backend/backend/integration-test.sh delete mode 100644 backend/backend/turbo.json create mode 100644 packages/api-cli/turbo.json delete mode 100644 packages/gitlab-api/.gitignore diff --git a/.c8rc.json b/.c8rc.json index 00d36aa2..d35b55ab 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,5 +1,5 @@ { "all": true, "src": "./src", - "reporter": ["text", "text-summary", "cobertura", "html"] + "reporter": ["text", "text-summary", "cobertura"] } diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index ee035658..00000000 --- a/.dockerignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/docs -**/coverage -**/.turbo -**/.idea -**/.vscode -**/.env* diff --git a/.gitignore b/.gitignore index bd5ea30a..d4c7b811 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ www/ .docs.json coverage.xml +report-junit.xml .deploy/ # Directory for instrumented libs generated by jscoverage/JSCover diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 791badb0..a1a02e86 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,9 +1,13 @@ +image: registry.gitlab.com/openstapps/projectmanagement/builder:v18 include: '/backend/backend/.gitlab-ci.yml' +#variables: +# GIT_CLEAN_FLAGS: -ffdx -e www/ + default: - image: registry.gitlab.com/openstapps/projectmanagement/builder:v18 tags: - performance + interruptible: true before_script: - echo TURBO_API=$TURBO_API >> .env.local - echo TURBO_TOKEN=$TURBO_TOKEN >> .env.local @@ -12,54 +16,89 @@ default: cache: &pnpm_cache key: files: - - pnpm-lock.yaml + - pnpm-lock.yaml paths: - .pnpm-store/ - - node-modules/ policy: pull stages: - build + - images - test - deploy build: stage: build - interruptible: true script: - - pnpm install + - pnpm config set recursive-install false + - pnpm i --prefer-offline + - pnpm build:full:skip || pnpm i -r --prefer-offline - pnpm build:full - mv frontend/app/www www artifacts: paths: - www + - ./**/.turbo/ + - ./backend/backend/lib + - ./backend/proxy/lib + - ./configuration/projectmanagement/lib + - ./examples/minimal-connector/lib + - ./examples/minimal-plugin/lib + - ./packages/api-cli/lib + - ./packages/api-plugin/lib + - ./packages/api/lib + - ./packages/collection-utils/lib + - ./packages/core-tools/lib + - ./packages/core/lib + - ./packages/easy-ast/lib + - ./packages/es-mapping-generator/lib + - ./packages/gitlab-api/lib + - ./packages/logger/lib cache: <<: *pnpm_cache policy: pull-push - # rules: - # - if: $CI_COMMIT_BRANCH == "develop" - # when: never - # - if: $CI_COMMIT_BRANCH == "master" - # when: never - # - when: always unit: stage: test - interruptible: true script: - - pnpm install + - pnpm config set recursive-install false + - pnpm i --prefer-offline + - pnpm test:skip || pnpm i -r --prefer-offline - pnpm test coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/' artifacts: + when: always + paths: + - report-junit.xml + - coverage.xml reports: + junit: + - report-junit.xml coverage_report: coverage_format: cobertura path: coverage.xml +image:database: + stage: images + image: + name: gcr.io/kaniko-project/executor:v1.9.0-debug + entrypoint: [""] + before_script: [] + cache: [] + script: + - /kaniko/executor + --context "${CI_PROJECT_DIR}/backend/database" + --dockerfile "${CI_PROJECT_DIR}/backend/database/Dockerfile" + --destination "${CI_REGISTRY_IMAGE}/database:${CI_COMMIT_BRANCH}" + only: + refs: + - branches + changes: + - backend/database/**/* + # TODO!! # integration: # stage: test -# interruptible: true # variables: # DOCKER_DRIVER: overlay2 # services: diff --git a/.gitlab/ci/install-for-turbo.sh b/.gitlab/ci/install-for-turbo.sh new file mode 100644 index 00000000..0db7286d --- /dev/null +++ b/.gitlab/ci/install-for-turbo.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +if pnpm dlx turbo-ignore "$@" +then + pnpm config --location=project set recursive-install false +fi diff --git a/.mocharc.json b/.mocharc.json index f9f45ca2..18b3af50 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -1,5 +1,7 @@ { "extension": ["ts"], "node-option": ["loader=ts-node/esm"], + "reporter": "mocha-junit-reporter", + "reporter-option": ["mochaFile=coverage/report-junit.xml"], "spec": ["test/**/*.spec.ts"] } diff --git a/.npmrc b/.npmrc index f87a0443..8002f2a9 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ -auto-install-peers=true \ No newline at end of file +auto-install-peers=true +recursive-install=false diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 6335660c..00000000 --- a/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM registry.gitlab.com/openstapps/projectmanagement/node:v18 as workspace - -USER root -RUN apk add --update python3 py3-pip make g++ gcompat - -WORKDIR /build -COPY pnpm-lock.yaml ./ -RUN pnpm fetch --prod - -ADD . ./ - -RUN pnpm install -r --offline --prod diff --git a/backend/backend/.gitlab-ci.yml b/backend/backend/.gitlab-ci.yml index 017bfe99..26b597e6 100644 --- a/backend/backend/.gitlab-ci.yml +++ b/backend/backend/.gitlab-ci.yml @@ -1,15 +1,21 @@ integration:backend: image: registry.gitlab.com/openstapps/projectmanagement/builder:v18 stage: test - dependencies: - - build variables: DOCKER_DRIVER: overlay2 + WAIT_FOR_SERVICES_TIMEOUT: 1 services: - - docker:dind + - name: registry.gitlab.com/openstapps/database:latest + alias: elasticsearch script: - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - - pnpm install --offline + - pnpm --filter=@openstapps/backend --filter=@openstapps/api-cli install --prefer-offline - pnpm test:integration tags: - - secrecy + - performance + artifacts: + when: always + paths: + - backend/backend/coverage/integration-report-junit.xml + reports: + junit: + - backend/backend/coverage/integration-report-junit.xml diff --git a/backend/backend/Dockerfile b/backend/backend/Dockerfile index cfda96a2..66ce16c5 100644 --- a/backend/backend/Dockerfile +++ b/backend/backend/Dockerfile @@ -1,10 +1,12 @@ FROM registry.gitlab.com/openstapps/projectmanagement/node:v18 +USER root +RUN apk add --update python3 py3-pip make g++ gcompat + USER node +ADD --chown=node:node . /app ENV NODE_ENV=production WORKDIR /app -COPY --chown=node:node --from=pruned pruned . - EXPOSE 3000 ENTRYPOINT ["node", "app.js"] diff --git a/backend/backend/integration-test.sh b/backend/backend/integration-test.sh new file mode 100755 index 00000000..2b39b4d6 --- /dev/null +++ b/backend/backend/integration-test.sh @@ -0,0 +1,22 @@ +ES_HOST="elasticsearch" +BACKEND_HOST="localhost" +if [ -z $GITLAB_CI ]; then + ES_HOST=localhost +fi + +( STAPPS_LOG_LEVEL=31 STAPPS_EXIT_LEVEL=8 NODE_CONFIG_ENV=elasticsearch NODE_ENV=integration-test ALLOW_NO_TRANSPORT=true ES_ADDR=http://$ES_HOST:9200 node app.js ) & backend_pid=$! +( openstapps-api e2e http://$BACKEND_HOST:3000 --reportPath coverage/integration-report-junit.xml --waiton tcp:$BACKEND_HOST:3000 --samples node_modules/@openstapps/core/test/resources/indexable ) & api_cli_pid=$! + +## Check output codes +# api-cli output defines passing the test +# backend should not exit early + +wait $api_cli_pid +api_cli_exit=$? +wait $backend_pid +backend_exit=$? + +if [ "$api_cli_exit" -eq "0" ]; then + echo "FINISHED"; + exit; +fi diff --git a/backend/backend/integration-test.yml b/backend/backend/integration-test.yml index 240ae620..4e196d30 100644 --- a/backend/backend/integration-test.yml +++ b/backend/backend/integration-test.yml @@ -1,7 +1,9 @@ version: '3' services: backend: - build: . + build: + dockerfile: ./Dockerfile + context: ../../.deploy/backend ports: - '3000:3000' environment: @@ -11,6 +13,7 @@ services: NODE_ENV: 'integration-test' ALLOW_NO_TRANSPORT: 'true' ES_ADDR: 'http://elasticsearch:9200' + command: wait-for http://elasticsearch:9200 -t 120 -- node app.js elasticsearch: build: ../database @@ -18,7 +21,9 @@ services: - '9200:9200' api-cli: - build: ../../packages/api-cli + build: + dockerfile: ../../packages/api-cli/Dockerfile + context: ../../.deploy/api-cli environment: STAPPS_LOG_LEVEL: '31' STAPPS_EXIT_LEVEL: '8' diff --git a/backend/backend/package.json b/backend/backend/package.json index f2395320..00ae2b11 100644 --- a/backend/backend/package.json +++ b/backend/backend/package.json @@ -21,21 +21,22 @@ "app.js", "lib", "config", + "Dockerfile", "README.md", "ROUTES.md" ], "scripts": { "build": "tsup-node", + "deploy": "pnpm --prod --filter=@openstapps/backend deploy ../../.deploy/backend", "dev": "tsup --watch --onSuccess \"pnpm run start\"", "format": "prettier . -c --ignore-path ../../.gitignore", "format:fix": "prettier --write . --ignore-path ../../.gitignore", "lint": "tsc --noEmit && eslint --ext .ts src/", "lint:fix": "eslint --fix --ext .ts src/", - "prune:integration": "pnpm --filter=backend --prod deploy pruned && pnpm --filter=api-cli --prod deploy ../../packages/api-cli/pruned", "start": "cross-env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true node app.js", "start:debug": "cross-env STAPPS_LOG_LEVEL=31 NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true node app.js", "test": "pnpm run test:unit", - "test:integration": "pnpm prune:integration && docker-compose -f integration-test.yml up --abort-on-container-exit --exit-code-from api-cli", + "test:integration": "sh integration-test.sh", "test:unit": "cross-env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true STAPPS_LOG_LEVEL=0 mocha --exit" }, "dependencies": { @@ -71,6 +72,7 @@ "uuid": "8.3.2" }, "devDependencies": { + "@openstapps/api-cli": "workspace:*", "@openstapps/eslint-config": "workspace:*", "@openstapps/prettier-config": "workspace:*", "@openstapps/tsconfig": "workspace:*", @@ -89,6 +91,7 @@ "cross-env": "7.0.3", "get-port": "5.1.1", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "mocked-env": "1.3.5", "redoc-cli": "0.13.20", "sinon": "15.0.4", @@ -118,12 +121,5 @@ "overrides": [ "test" ] - }, - "pnpm": { - "peerDependencyRules": { - "allowedVersions": { - "rxjs": "7.x" - } - } } } diff --git a/backend/backend/turbo.json b/backend/backend/turbo.json deleted file mode 100644 index 9705a8e4..00000000 --- a/backend/backend/turbo.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": ["//"], - "pipeline": { - "TODO:test:integration": { - "dependsOn": [ - "@openstapps/database#build:docker", - "@openstapps/backend#build:docker", - "@openstapps/api-cli#build:docker" - ] - } - } -} diff --git a/backend/proxy/package.json b/backend/proxy/package.json index 935ee609..578cac57 100644 --- a/backend/proxy/package.json +++ b/backend/proxy/package.json @@ -68,6 +68,7 @@ "c8": "7.14.0", "chai": "4.3.7", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "sinon": "15.0.4", "sinon-chai": "3.7.0", "ts-node": "10.9.1", diff --git a/configuration/prettier-config/package.json b/configuration/prettier-config/package.json index 2edc83da..6f9a173b 100644 --- a/configuration/prettier-config/package.json +++ b/configuration/prettier-config/package.json @@ -15,11 +15,6 @@ "README.md" ], "scripts": { - "changelog": "npx conventional-changelog-cli -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'", - "postversion": "npm run changelog", - "prepublishOnly": "npm test", - "preversion": "npm run prepublishOnly", - "push": "git push && git push origin \"v$npm_package_version\"", "test": "npx prettier --config index.json --check \"test/*.js\"" }, "peerDependencies": { diff --git a/configuration/projectmanagement/package.json b/configuration/projectmanagement/package.json index bb986a15..298ce67c 100644 --- a/configuration/projectmanagement/package.json +++ b/configuration/projectmanagement/package.json @@ -58,6 +58,7 @@ "chai": "4.3.7", "chai-as-promised": "7.1.1", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "ts-node": "10.9.1", "tsup": "6.7.0", "typescript": "4.9.5" diff --git a/coverage.mjs b/coverage.mjs index cb8f2bcd..7e09ac6a 100755 --- a/coverage.mjs +++ b/coverage.mjs @@ -2,8 +2,16 @@ import {promisify} from 'node:util'; import {glob} from 'glob'; import {exec} from 'node:child_process'; +import {mergeFiles} from 'junit-report-merger'; const files = await glob('./*/*/coverage/cobertura-coverage.xml'); const args = files.map(it => `${it.split('/', 2)[1]}='${it}'`); -console.log(await promisify(exec)(`cobertura-merge -o ./coverage.xml ${args.join(' ')}`)); +console.log( + 'Collecting coverage...', + await promisify(exec)(`cobertura-merge -o ./coverage.xml ${args.join(' ')}`), +); + +const reportFiles = await glob('./*/*/coverage/report-junit.xml'); +console.log('Collecting reports...', reportFiles); +await mergeFiles('./report-junit.xml', reportFiles); diff --git a/examples/minimal-connector/package.json b/examples/minimal-connector/package.json index 3c883df4..46be1327 100644 --- a/examples/minimal-connector/package.json +++ b/examples/minimal-connector/package.json @@ -48,6 +48,7 @@ "chai-as-promised": "7.1.1", "conventional-changelog-cli": "2.2.2", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "nock": "13.3.1", "ts-node": "10.9.1", "tsup": "6.7.0", diff --git a/frontend/app/angular.json b/frontend/app/angular.json index eee85d1f..7db07c51 100644 --- a/frontend/app/angular.json +++ b/frontend/app/angular.json @@ -1,5 +1,5 @@ { - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json", "version": 1, "defaultProject": "app", "newProjectRoot": "projects", diff --git a/frontend/app/package.json b/frontend/app/package.json index 26641787..84d571e8 100644 --- a/frontend/app/package.json +++ b/frontend/app/package.json @@ -14,10 +14,10 @@ ], "scripts": { "analyze": "webpack-bundle-analyzer www/stats.json", - "build": "ng build --configuration=production", + "build:prod": "ng build --configuration=production", "build:analyze": "npm run build:stats && npm run analyze", "build:android": "ionic capacitor build android --no-open && cd android && ./gradlew clean assembleDebug && cd ..", - "build:dev": "ng build", + "build": "ng build", "build:stats": "ng build --configuration=production --stats-json", "changelog": "conventional-changelog -p angular -i src/assets/about/CHANGELOG.md -s -r 0", "check-icons": "ts-node scripts/check-icon-correctness.ts", @@ -38,13 +38,14 @@ "minify-icons": "ts-node scripts/minify-icon-font.ts", "ng": "ng", "postinstall": "jetify || echo \"skipping jetify in production mode\"", + "preview": "http-server www --p 8101 -o", "push": "git push && git push origin \"v$npm_package_version\"", "resources:android": "cordova-res android --skip-config --copy", "resources:ios": "cordova-res ios --skip-config --copy", "run:android": "ionic capacitor run android --livereload --external", "start": "ionic serve", "start:external": "ionic serve --external", - "start:prod": "ionic serve -- --configuration=production", + "start:prod": "ionic serve --prod", "test": "ng test" }, "dependencies": { @@ -78,7 +79,6 @@ "@hugotomazi/capacitor-navigation-bar": "2.0.0", "@ionic-native/core": "5.36.0", "@ionic/angular": "6.3.9", - "@ionic/core": "6.6.1", "@ionic/storage-angular": "3.0.6", "@ngx-translate/core": "14.0.0", "@ngx-translate/http-loader": "7.0.0", @@ -148,6 +148,7 @@ "eslint-plugin-unicorn": "45.0.2", "fontkit": "2.0.2", "glob": "10.2.7", + "http-server": "14.1.1", "is-docker": "2.2.1", "jasmine-core": "4.5.0", "jasmine-spec-reporter": "7.0.0", diff --git a/package.json b/package.json index ee0f51dd..47907187 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "scripts": { "build": "dotenv -c -- turbo run build", "build:docker-workspace": "docker build -t openstapps:workspace .", - "build:full": "dotenv -c -- turbo run syncpack build lint format", + "build:full": "dotenv -c -- turbo run syncpack build lint format --summarize", + "build:full:skip": "dotenv -c -- turbo-ignore --task='build lint format'", "dev": "dotenv -c -- turbo run dev", "docs": "dotenv -c -- turbo run docs && typedoc", "format": "dotenv -c -- turbo run format", @@ -14,7 +15,8 @@ "publish-packages": "dotenv -c -- turbo run build format lint test && changeset version && changeset publish", "syncpack": "syncpack list-mismatches && syncpack lint-semver-ranges", "syncpack:fix": "syncpack format && syncpack fix-mismatches", - "test": "dotenv -c -- turbo run test --filter=!@openstapps/app && node coverage.mjs", + "test": "trap 'node coverage.mjs' EXIT && dotenv -c -- turbo run test --filter=!@openstapps/app", + "test:skip": "dotenv -c -- turbo-ignore --task='test' --filter=!@openstapps/app", "test:integration": "dotenv -c -- turbo run test:integration", "turboify-pipeline": "node deploy.mjs backend,api-cli,database && pnpm build:full && pnpm test && pnpm run docs" }, @@ -24,8 +26,10 @@ "deepmerge": "4.3.1", "dotenv-cli": "7.2.1", "glob": "10.2.7", + "junit-report-merger": "6.0.2", "syncpack": "10.5.1", "turbo": "1.10.3", + "turbo-ignore": "1.10.6", "typedoc": "0.24.8", "typescript": "4.9.5" } diff --git a/packages/api-cli/Dockerfile b/packages/api-cli/Dockerfile index 7ae85f02..2a474bc6 100644 --- a/packages/api-cli/Dockerfile +++ b/packages/api-cli/Dockerfile @@ -4,7 +4,7 @@ USER node ENV NODE_ENV=production WORKDIR /app -COPY --chown=node:node pruned . +COPY --chown=node:node . . +EXPOSE 3000 ENTRYPOINT ["node", "app.js"] -CMD ["--help"] diff --git a/packages/api-cli/package.json b/packages/api-cli/package.json index ba50b908..4ec79abd 100644 --- a/packages/api-cli/package.json +++ b/packages/api-cli/package.json @@ -21,11 +21,12 @@ "files": [ "app.js", "lib", + "Dockerfile", "README.md" ], "scripts": { "build": "tsup-node", - "build:docker": "docker build -t openstapps:api-cli .", + "deploy": "pnpm --prod --filter=@openstapps/api-cli deploy ../../.deploy/api-cli", "format": "prettier . -c --ignore-path ../../.gitignore", "format:fix": "prettier --write . --ignore-path ../../.gitignore", "lint": "tsc --noEmit && eslint --ext .ts src/", @@ -41,6 +42,7 @@ "@types/cli-progress": "3.11.0", "@types/express": "4.17.17", "@types/fs-extra": "9.0.13", + "@types/junit-report-builder": "3.0.0", "@types/json-schema": "7.0.11", "@types/mocha": "10.0.1", "@types/node": "18.15.3", @@ -48,6 +50,7 @@ "cli-progress": "3.12.0", "commander": "10.0.0", "fs-extra": "10.1.0", + "junit-report-builder": "3.0.1", "wait-on": "6.0.1" }, "devDependencies": { @@ -61,6 +64,7 @@ "chai-as-promised": "7.1.1", "chai-spies": "1.0.0", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "nock": "13.3.1", "ts-node": "10.9.1", "tsup": "6.7.0", diff --git a/packages/api-cli/src/app.ts b/packages/api-cli/src/app.ts index 0ea5a458..e4f8d3bd 100644 --- a/packages/api-cli/src/app.ts +++ b/packages/api-cli/src/app.ts @@ -53,6 +53,7 @@ commander './node_modules/@openstapps/core/test/resources/indexable', ) .option('-w --waiton [resource]', 'wait-on resource parameter see "www.npmjs.com/wait-on"') + .option('-r --reportPath [reportPath]', 'JUnit Report Path') // eslint-disable-next-line unicorn/prevent-abbreviations .action(async (to, e2eCommand) => { let toURL = ''; @@ -73,7 +74,11 @@ commander }); Logger.info(`Resource became available`); } - await e2eRun(client, {to: toURL, samplesLocation: e2eCommand.samples}); + await e2eRun(client, { + to: toURL, + samplesLocation: e2eCommand.samples, + reportLocation: e2eCommand.reportPath, + }); Logger.ok('Done'); } catch (error) { await Logger.error(error); diff --git a/packages/api-cli/src/e2e.ts b/packages/api-cli/src/e2e.ts index 26b35668..734d06d7 100644 --- a/packages/api-cli/src/e2e.ts +++ b/packages/api-cli/src/e2e.ts @@ -21,10 +21,29 @@ import {readdir, readFile} from 'fs'; import path from 'path'; import {promisify} from 'util'; import {ConnectorClient, HttpClientInterface} from '@openstapps/api'; +import junit from 'junit-report-builder'; const localItemMap: Map = new Map(); const remoteItemMap: Map = new Map(); +async function runTest(name: string, scope: () => Promise, suite: junit.TestSuite, errors: string[]) { + const testCase = suite.testCase().name(name); + process.stdout.addListener('data', testCase.standardOutput); + process.stderr.addListener('data', testCase.standardError); + + const start = performance.now(); + await scope().catch(async error => { + await Logger.error(error); + testCase.failure(error.message); + errors.push(error.message); + }); + process.stdout.removeListener('data', testCase.standardOutput); + process.stderr.removeListener('data', testCase.standardError); + + const end = performance.now(); + testCase.time((end - start) / 1000); +} + /** * Options to set up indexing core test files to backend */ @@ -38,34 +57,54 @@ export interface E2EOptions { * URL of the backend to index to */ to: string; + + /** + * Location of the report + */ + reportLocation?: string; } /** * Function that can be used for integration tests. * Adds all the SCThings that getItemsFromSamples() returns to the backend. - * Afterwards retrieves the items from backend and checks for differences with original ones. + * Afterward, retrieves the items from backend and checks for differences with original ones. */ -export async function e2eRun(client: HttpClientInterface, options: E2EOptions): Promise { +export async function e2eRun(client: HttpClientInterface, options: E2EOptions): Promise { localItemMap.clear(); remoteItemMap.clear(); + const builder = junit.newBuilder(); + const errors: string[] = []; const api = new ConnectorClient(client, options.to); try { - await indexSamples(api, options); + const indexSuite = builder.testSuite().name('e2e index'); + await indexSamples(api, options, indexSuite, errors); Logger.info(`All samples have been indexed via the backend`); - await retrieveItems(api); + const retrieveSuite = builder.testSuite().name('e2e retrieve'); + await retrieveItems(api, retrieveSuite, errors); Logger.info(`All samples have been retrieved from the backend`); - compareItems(); + + const compareSuite = builder.testSuite().name('e2e compare'); + await compareItems(compareSuite, errors); } catch (error) { throw error; } + + if (options.reportLocation) { + builder.writeTo(options.reportLocation); + } + await (errors.length > 0 + ? Logger.error(`\n${errors.length} failed test cases`) + : Logger.ok('All tests passed.')); + + return errors; } /** - * Retieves all samples previously index using the api + * Retrieves all samples previously index using the api */ -async function retrieveItems(api: ConnectorClient): Promise { +async function retrieveItems(api: ConnectorClient, suite: junit.TestSuite, errors: string[]): Promise { const singleItemSearchRequest: SCSearchRequest = { filter: { arguments: { @@ -76,61 +115,83 @@ async function retrieveItems(api: ConnectorClient): Promise { }, }; for (const uid of localItemMap.keys()) { - singleItemSearchRequest.filter!.arguments.value = uid; - const searchResonse = await api.search(singleItemSearchRequest); - if (searchResonse.data.length !== 1) { - throw new Error( - `Search for single SCThing with uid: ${uid} returned ${searchResonse.data.length} results`, - ); - } - remoteItemMap.set(uid, searchResonse.data[0]); + await runTest( + `Should find ${uid}`, + async () => { + singleItemSearchRequest.filter!.arguments.value = uid; + const searchResponse = await api.search(singleItemSearchRequest); + if (searchResponse.data.length !== 1) { + throw new Error( + `Search for single SCThing with uid: ${uid} returned ${searchResponse.data.length} results`, + ); + } + remoteItemMap.set(uid, searchResponse.data[0]); + }, + suite, + errors, + ); } } /** * Compares all samples (local and remote) with the same uid and throws if they're not deep equal */ -function compareItems() { +async function compareItems(suite: junit.TestSuite, errors: string[]) { for (const localThing of localItemMap.values()) { - /* istanbul ignore next retrieveItems will throw before*/ - if (!remoteItemMap.has(localThing.uid)) { - throw new Error(`Did not retrieve expected SCThing with uid: ${localThing.uid}`); - } - const remoteThing = remoteItemMap.get(localThing.uid); - deepStrictEqual(remoteThing, localThing, `Unexpected difference between original and retrieved sample`); + await runTest( + `Should be the same for ${localThing.uid}`, + async () => { + /* istanbul ignore next retrieveItems will throw before*/ + if (!remoteItemMap.has(localThing.uid)) { + throw new Error(`Did not retrieve expected SCThing with uid: ${localThing.uid}`); + } + const remoteThing = remoteItemMap.get(localThing.uid); + deepStrictEqual( + remoteThing, + localThing, + `Unexpected difference between original and retrieved sample`, + ); + }, + suite, + errors, + ); } - Logger.info( - `All samples retrieved from the backend are the same (deep equal) as the original ones submitted`, - ); + Logger.info(`All samples retrieved from the backend have been compared`); } /** * Function to add all the SCThings that getItemsFromSamples() returns to the backend */ -async function indexSamples(api: ConnectorClient, options: E2EOptions): Promise { - try { - const items = await getItemsFromSamples(options.samplesLocation); +async function indexSamples( + api: ConnectorClient, + options: E2EOptions, + suite: junit.TestSuite, + errors: string[], +): Promise { + const items = await getItemsFromSamples(options.samplesLocation); - if (items.length === 0) { - throw new Error('Could not index samples. None were retrieved from the file system.'); - } + if (items.length === 0) { + throw new Error('Could not index samples. None were retrieved from the file system.'); + } - // sort items by type - const itemMap: Map = new Map(); - for (const item of items) { - if (!itemMap.has(item.type)) { - itemMap.set(item.type, []); - } - const itemsOfSameType = itemMap.get(item.type) as SCThings[]; - itemsOfSameType.push(item); - itemMap.set(item.type, itemsOfSameType); - localItemMap.set(item.uid, item); + // sort items by type + const itemMap: Map = new Map(); + for (const item of items) { + if (!itemMap.has(item.type)) { + itemMap.set(item.type, []); } - // add items depending on their type property with one type per bulk - for (const type of itemMap.keys()) { - await api.index(itemMap.get(type) as SCThings[], 'stapps-core-sample-data'); - } - } catch (error) { - throw error; + const itemsOfSameType = itemMap.get(item.type) as SCThings[]; + itemsOfSameType.push(item); + itemMap.set(item.type, itemsOfSameType); + localItemMap.set(item.uid, item); + } + // add items depending on their type property with one type per bulk + for (const type of itemMap.keys()) { + await runTest( + `Should index ${type}`, + async () => api.index(itemMap.get(type) as SCThings[], 'stapps-core-sample-data'), + suite, + errors, + ); } } diff --git a/packages/api-cli/test/e2e.spec.ts b/packages/api-cli/test/e2e.spec.ts index 6a2b65ca..2c1b520a 100644 --- a/packages/api-cli/test/e2e.spec.ts +++ b/packages/api-cli/test/e2e.spec.ts @@ -29,7 +29,7 @@ import chaiAsPromised from 'chai-as-promised'; import chaiSpies from 'chai-spies'; import {existsSync, mkdirSync, rmdirSync, unlinkSync} from 'fs'; import {createFileSync} from 'fs-extra'; -import {ApiError, HttpClient, HttpClientRequest, HttpClientResponse} from '@openstapps/api'; +import {HttpClient, HttpClientRequest, HttpClientResponse} from '@openstapps/api'; import {RecursivePartial} from './copy.spec.js'; import {expect} from 'chai'; import path from 'path'; @@ -147,7 +147,7 @@ describe('e2e Connector', function () { await e2eRun(httpClient, { to: 'http://localhost', samplesLocation: './node_modules/@openstapps/core/test/resources', - }); + }).should.eventually.have.length(0); failOnLookup = true; failOnCompare = false; @@ -155,7 +155,9 @@ describe('e2e Connector', function () { await e2eRun(httpClient, { to: 'http://localhost', samplesLocation: './node_modules/@openstapps/core/test/resources', - }).should.be.rejectedWith('Search for single SCThing with uid'); + }).should.eventually.include( + 'Search for single SCThing with uid: 184b717a-d020-46f5-995c-03023670cc62 returned 0 results', + ); failOnLookup = false; failOnCompare = true; @@ -163,7 +165,7 @@ describe('e2e Connector', function () { await e2eRun(httpClient, { to: 'http://localhost', samplesLocation: './node_modules/@openstapps/core/test/resources', - }).should.be.rejectedWith('Unexpected difference'); + }).should.eventually.include('Unexpected difference between original and retrieved sample'); }); it('should fail to index', async function () { @@ -180,7 +182,7 @@ describe('e2e Connector', function () { return e2eRun(httpClient, { to: 'http://localhost', samplesLocation: './node_modules/@openstapps/core/test/resources', - }).should.be.rejectedWith(ApiError); + }).should.eventually.include(''); }); it('should fail to index directory without data', async function () { diff --git a/packages/api-cli/turbo.json b/packages/api-cli/turbo.json new file mode 100644 index 00000000..b5ceabf6 --- /dev/null +++ b/packages/api-cli/turbo.json @@ -0,0 +1,9 @@ +{ + "extends": ["//"], + "pipeline": { + "deploy": { + "dependsOn": ["@openstapps/api-cli#build"], + "outputs": [".deploy/api-cli"] + } + } +} diff --git a/packages/api-plugin/package.json b/packages/api-plugin/package.json index a154d553..eb7c2db6 100644 --- a/packages/api-plugin/package.json +++ b/packages/api-plugin/package.json @@ -28,7 +28,7 @@ "format:fix": "prettier --write . --ignore-path ../../.gitignore", "lint": "eslint --ext .ts src/", "lint:fix": "eslint --fix --ext .ts src/", - "test": "c8 mocha" + "test": "c8 mocha --exit" }, "dependencies": { "@openstapps/api": "workspace:*", @@ -58,6 +58,7 @@ "chai-spies": "1.0.0", "conventional-changelog-cli": "2.2.2", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "nock": "13.3.1", "ts-node": "10.9.1", "tsup": "6.7.0", diff --git a/packages/api/package.json b/packages/api/package.json index a697d03f..29f26902 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -51,6 +51,7 @@ "conventional-changelog-cli": "2.2.2", "date-fns": "2.30.0", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "traverse": "0.6.7", "ts-node": "10.9.1", "tsup": "6.7.0", diff --git a/packages/collection-utils/package.json b/packages/collection-utils/package.json index 1e9301cb..8c71a335 100644 --- a/packages/collection-utils/package.json +++ b/packages/collection-utils/package.json @@ -26,6 +26,7 @@ "c8": "7.14.0", "chai": "4.3.7", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "ts-node": "10.9.1", "tsup": "6.7.0", "typedoc": "0.24.8", diff --git a/packages/core-tools/package.json b/packages/core-tools/package.json index a44d0a5d..f4c4887a 100644 --- a/packages/core-tools/package.json +++ b/packages/core-tools/package.json @@ -79,6 +79,7 @@ "c8": "7.14.0", "chai": "4.3.7", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "nock": "13.3.1", "ts-node": "10.9.1", "tsup": "6.7.0", diff --git a/packages/core/package.json b/packages/core/package.json index 88395c76..e81f01c2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -67,6 +67,7 @@ "chai": "4.3.7", "conditional-type-checks": "1.0.6", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "source-map-support": "0.5.21", "surge": "0.23.1", "ts-node": "10.9.1", diff --git a/packages/easy-ast/package.json b/packages/easy-ast/package.json index 99a4dcf5..36dab21a 100644 --- a/packages/easy-ast/package.json +++ b/packages/easy-ast/package.json @@ -37,6 +37,7 @@ "c8": "7.14.0", "chai": "4.3.7", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "ts-node": "10.9.1", "tsup": "6.7.0", "typedoc": "0.24.8" diff --git a/packages/es-mapping-generator/package.json b/packages/es-mapping-generator/package.json index dd6eb5d0..a2711e3d 100644 --- a/packages/es-mapping-generator/package.json +++ b/packages/es-mapping-generator/package.json @@ -43,6 +43,7 @@ "c8": "7.14.0", "chai": "4.3.7", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "nock": "13.3.1", "rimraf": "5.0.0", "ts-node": "10.9.1" diff --git a/packages/gitlab-api/.gitignore b/packages/gitlab-api/.gitignore deleted file mode 100644 index c07b9dc8..00000000 --- a/packages/gitlab-api/.gitignore +++ /dev/null @@ -1,91 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# next.js build output -.next - -# nuxt.js build output -.nuxt - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -#DynamoDB Local files -.dynamodb/ - -########## end of https://github.com/github/gitignore/blob/master/Node.gitignore - -# ignore ide files -.idea -.vscode - -# ignore lib -lib - -# ignore docs -docs diff --git a/packages/logger/package.json b/packages/logger/package.json index 1f5990f2..0cb58259 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -46,6 +46,7 @@ "chai-as-promised": "7.1.1", "chai-spies": "1.0.0", "mocha": "10.2.0", + "mocha-junit-reporter": "2.2.0", "ts-node": "10.9.1", "tsup": "6.7.0", "typedoc": "0.24.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ac2ce35b..de8f1a1c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.1' +lockfileVersion: '6.0' settings: autoInstallPeers: true @@ -23,12 +23,18 @@ importers: glob: specifier: 10.2.7 version: 10.2.7 + junit-report-merger: + specifier: 6.0.2 + version: 6.0.2 syncpack: specifier: 10.5.1 version: 10.5.1 turbo: specifier: 1.10.3 version: 1.10.3 + turbo-ignore: + specifier: 1.10.6 + version: 1.10.6 typedoc: specifier: 0.24.8 version: 0.24.8(typescript@4.9.5) @@ -129,6 +135,9 @@ importers: specifier: 8.3.2 version: 8.3.2 devDependencies: + '@openstapps/api-cli': + specifier: workspace:* + version: link:../../packages/api-cli '@openstapps/eslint-config': specifier: workspace:* version: link:../../configuration/eslint-config @@ -204,6 +213,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) mocked-env: specifier: 1.3.5 version: 1.3.5 @@ -333,6 +345,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) prettier: specifier: 2.8.6 version: 2.8.6 @@ -512,6 +527,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) prettier: specifier: 2.8.6 version: 2.8.6 @@ -602,6 +620,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) nock: specifier: 13.3.1 version: 13.3.1 @@ -783,9 +804,6 @@ importers: '@ionic/angular': specifier: 6.3.9 version: 6.3.9(@angular/core@13.3.11)(@angular/forms@13.3.11)(@angular/router@13.3.11)(rxjs@7.8.0)(zone.js@0.12.0) - '@ionic/core': - specifier: 6.6.1 - version: 6.6.1 '@ionic/storage-angular': specifier: 3.0.6 version: 3.0.6(@angular/core@13.3.11)(rxjs@7.8.0) @@ -988,6 +1006,9 @@ importers: glob: specifier: 10.2.7 version: 10.2.7 + http-server: + specifier: 14.1.1 + version: 14.1.1 is-docker: specifier: 2.2.1 version: 2.2.1 @@ -1118,6 +1139,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) prettier: specifier: 2.8.6 version: 2.8.6 @@ -1169,6 +1193,9 @@ importers: '@types/json-schema': specifier: 7.0.11 version: 7.0.11 + '@types/junit-report-builder': + specifier: 3.0.0 + version: 3.0.0 '@types/mocha': specifier: 10.0.1 version: 10.0.1 @@ -1187,6 +1214,9 @@ importers: fs-extra: specifier: 10.1.0 version: 10.1.0 + junit-report-builder: + specifier: 3.0.1 + version: 3.0.1 wait-on: specifier: 6.0.1 version: 6.0.1 @@ -1221,6 +1251,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) nock: specifier: 13.3.1 version: 13.3.1 @@ -1336,6 +1369,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) nock: specifier: 13.3.1 version: 13.3.1 @@ -1405,6 +1441,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) prettier: specifier: 2.8.6 version: 2.8.6 @@ -1511,6 +1550,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) prettier: specifier: 2.8.6 version: 2.8.6 @@ -1656,6 +1698,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) nock: specifier: 13.3.1 version: 13.3.1 @@ -1738,6 +1783,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) prettier: specifier: 2.8.6 version: 2.8.6 @@ -1826,6 +1874,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) nock: specifier: 13.3.1 version: 13.3.1 @@ -1975,6 +2026,9 @@ importers: mocha: specifier: 10.2.0 version: 10.2.0 + mocha-junit-reporter: + specifier: 2.2.0 + version: 2.2.0(mocha@10.2.0) prettier: specifier: 2.8.6 version: 2.8.6 @@ -5766,14 +5820,6 @@ packages: tslib: 2.4.1 dev: false - /@ionic/core@6.6.1: - resolution: {integrity: sha512-+LMBk7kUX55rvYQ35AiAXPNzbNm3zNx9ginvuCzByguMjl+N63lpdPzIEfeRURkmq7NByD1VqpodMj5c6Oq2KQ==} - dependencies: - '@stencil/core': 2.22.3 - ionicons: 6.1.3 - tslib: 2.4.1 - dev: false - /@ionic/storage-angular@3.0.6(@angular/core@13.3.11)(rxjs@7.8.0): resolution: {integrity: sha512-ZXlIFWGU27aCxVFgZb0KFJFtWwnn6+HK6v0rMGzjN8f7oV2ewXaQ2dl1gTw/A8YoozTVPOFxwfFHCjhWLFR1Fw==} peerDependencies: @@ -5788,6 +5834,7 @@ packages: /@ionic/storage@3.0.6: resolution: {integrity: sha512-sw+zSJINIpbQCGZR9mEtb9N0WmZLuhcMVqOZJBqLuDACAMdXqG39zmp5nSVqhGI1/9X3nd0K5gVn6icyVfUnUg==} + requiresBuild: true dependencies: localforage: 1.10.0 dev: false @@ -6246,6 +6293,35 @@ packages: - debug dev: true + /@oozcitak/dom@1.15.10: + resolution: {integrity: sha512-0JT29/LaxVgRcGKvHmSrUTEvZ8BXvZhGl2LASRUgHqDTC1M5g1pLmVv56IYNyt3bG2CUjDkc67wnyZC14pbQrQ==} + engines: {node: '>=8.0'} + dependencies: + '@oozcitak/infra': 1.0.8 + '@oozcitak/url': 1.0.4 + '@oozcitak/util': 8.3.8 + dev: true + + /@oozcitak/infra@1.0.8: + resolution: {integrity: sha512-JRAUc9VR6IGHOL7OGF+yrvs0LO8SlqGnPAMqyzOuFZPSZSXI7Xf2O9+awQPSMXgIWGtgUf/dA6Hs6X6ySEaWTg==} + engines: {node: '>=6.0'} + dependencies: + '@oozcitak/util': 8.3.8 + dev: true + + /@oozcitak/url@1.0.4: + resolution: {integrity: sha512-kDcD8y+y3FCSOvnBI6HJgl00viO/nGbQoCINmQ0h98OhnGITrWR3bOGfwYCthgcrV8AnTJz8MzslTQbC3SOAmw==} + engines: {node: '>=8.0'} + dependencies: + '@oozcitak/infra': 1.0.8 + '@oozcitak/util': 8.3.8 + dev: true + + /@oozcitak/util@8.3.8: + resolution: {integrity: sha512-T8TbSnGsxo6TDBJx/Sgv/BlVJL3tshxZP7Aq5R1mSnM5OcHY2dQaxLMu2+E8u3gN0MLOzdjurqN4ZRVuzQycOQ==} + engines: {node: '>=8.0'} + dev: true + /@openid/appauth@1.3.1: resolution: {integrity: sha512-e54kpi219wES2ijPzeHe1kMnT8VKH8YeTd1GAn9BzVBmutz3tBgcG1y8a4pziNr4vNjFnuD4W446Ua7ELnNDiA==} dependencies: @@ -6719,6 +6795,10 @@ packages: resolution: {integrity: sha512-v7qlPA0VpKUlEdhghbDqRoKMxFB3h3Ch688TApBJ6v+XLDdvWCGLJIYiPKGZnS6MAOie+IorCfNYVHOPIHSWwQ==} dev: true + /@types/junit-report-builder@3.0.0: + resolution: {integrity: sha512-Rr3uts4+YVFsk7FCxzbapZQR04+4FCYVEvTvnxA6NNVnvNkA5Nx8bguU+iZrks1OMXHJJo0vWCi4+aUavRcJjw==} + dev: false + /@types/keyv@3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: @@ -8854,6 +8934,10 @@ packages: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} dev: true + /charenc@0.0.2: + resolution: {integrity: sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==} + dev: true + /check-error@1.0.2: resolution: {integrity: sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==} dev: true @@ -9154,7 +9238,6 @@ packages: /commander@10.0.0: resolution: {integrity: sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==} engines: {node: '>=14'} - dev: false /commander@10.0.1: resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} @@ -9560,6 +9643,11 @@ packages: object-assign: 4.1.1 vary: 1.1.2 + /corser@2.0.1: + resolution: {integrity: sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==} + engines: {node: '>= 0.4.0'} + dev: true + /cosmiconfig@7.1.0: resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} engines: {node: '>=10'} @@ -9656,6 +9744,10 @@ packages: shebang-command: 2.0.0 which: 2.0.2 + /crypt@0.0.2: + resolution: {integrity: sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==} + dev: true + /crypto-browserify@3.12.0: resolution: {integrity: sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==} dependencies: @@ -9901,6 +9993,11 @@ packages: engines: {node: '>=4.0'} dev: true + /date-format@4.0.3: + resolution: {integrity: sha512-7P3FyqDcfeznLZp2b+OMitV9Sz2lUnsT87WaTat9nVwqsBkTzPG3lPLNwW3en6F4pHUiWzr6vb8CLhjdK9bcxQ==} + engines: {node: '>=4.0'} + dev: false + /dateformat@3.0.3: resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==} dev: true @@ -12484,6 +12581,13 @@ packages: engines: {node: '>=14'} dev: false + /html-encoding-sniffer@3.0.0: + resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} + engines: {node: '>=12'} + dependencies: + whatwg-encoding: 2.0.0 + dev: true + /html-entities@2.3.3: resolution: {integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==} dev: true @@ -12597,6 +12701,29 @@ packages: - debug dev: true + /http-server@14.1.1: + resolution: {integrity: sha512-+cbxadF40UXd9T01zUHgA+rlo2Bg1Srer4+B4NwIHdaGxAGGv59nYRnGGDJ9LBk7alpS0US+J+bLLdQOOkJq4A==} + engines: {node: '>=12'} + hasBin: true + dependencies: + basic-auth: 2.0.1 + chalk: 4.1.2 + corser: 2.0.1 + he: 1.2.0 + html-encoding-sniffer: 3.0.0 + http-proxy: 1.18.1 + mime: 1.6.0 + minimist: 1.2.8 + opener: 1.5.2 + portfinder: 1.0.32 + secure-compare: 3.0.1 + union: 0.5.0 + url-join: 4.0.1 + transitivePeerDependencies: + - debug + - supports-color + dev: true + /http-signature@1.2.0: resolution: {integrity: sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==} engines: {node: '>=0.8', npm: '>=1.3.7'} @@ -12994,6 +13121,10 @@ packages: has-tostringtag: 1.0.0 dev: true + /is-buffer@1.1.6: + resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==} + dev: true + /is-builtin-module@3.2.1: resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} engines: {node: '>=6'} @@ -13602,6 +13733,26 @@ packages: setimmediate: 1.0.5 dev: true + /junit-report-builder@3.0.1: + resolution: {integrity: sha512-B8AZ2q24iGwPM3j/ZHc9nD0BY1rKhcnWCA1UvT8mhHfR8Vo/HTtg3ojMyo55BgctqQGZG7H8z0+g+mEUc32jgg==} + engines: {node: '>=8'} + dependencies: + date-format: 4.0.3 + lodash: 4.17.21 + make-dir: 3.1.0 + xmlbuilder: 15.1.1 + dev: false + + /junit-report-merger@6.0.2: + resolution: {integrity: sha512-Jk9PXeaJhbgo3aUNza2r24JgxYzLUtCk2kwrub8fbmDuWUdXhT/nfbM2MlU3JQiFbjVud1bzBWdzr9/GGBWfmA==} + engines: {node: '>=14'} + hasBin: true + dependencies: + commander: 10.0.0 + fast-glob: 3.2.12 + xmlbuilder2: 3.1.1 + dev: true + /just-extend@4.2.1: resolution: {integrity: sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==} dev: true @@ -14209,7 +14360,6 @@ packages: engines: {node: '>=8'} dependencies: semver: 6.3.0 - dev: true /make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} @@ -14310,6 +14460,14 @@ packages: safe-buffer: 5.2.1 dev: true + /md5@2.3.0: + resolution: {integrity: sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==} + dependencies: + charenc: 0.0.2 + crypt: 0.0.2 + is-buffer: 1.1.6 + dev: true + /media-typer@0.3.0: resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} engines: {node: '>= 0.6'} @@ -14637,6 +14795,21 @@ packages: resolution: {integrity: sha512-+o/DrHa4zykFMSKfS8Z+CPSEg5LW9tSNGTuN8o6MF1GKxlfkSHSeJn5UtgxvPkGgaouplnrLXCF+duAsmm6FHQ==} dev: true + /mocha-junit-reporter@2.2.0(mocha@10.2.0): + resolution: {integrity: sha512-W83Ddf94nfLiTBl24aS8IVyFvO8aRDLlCvb+cKb/VEaN5dEbcqu3CXiTe8MQK2DvzS7oKE1RsFTxzN302GGbDQ==} + peerDependencies: + mocha: '>=2.2.5' + dependencies: + debug: 4.3.4(supports-color@5.5.0) + md5: 2.3.0 + mkdirp: 1.0.4 + mocha: 10.2.0 + strip-ansi: 6.0.1 + xml: 1.0.1 + transitivePeerDependencies: + - supports-color + dev: true + /mocha@10.2.0: resolution: {integrity: sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==} engines: {node: '>= 14.0.0'} @@ -17456,6 +17629,10 @@ packages: get-assigned-identifiers: 1.2.0 dev: true + /secure-compare@3.0.1: + resolution: {integrity: sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw==} + dev: true + /secure-json-parse@2.7.0: resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==} dev: false @@ -17495,7 +17672,6 @@ packages: /semver@6.3.0: resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} hasBin: true - dev: true /semver@7.3.4: resolution: {integrity: sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==} @@ -19191,6 +19367,11 @@ packages: dev: true optional: true + /turbo-ignore@1.10.6: + resolution: {integrity: sha512-LVWRJU1p1+8rON1f8fweLrFUo0kOex+r3BD5NlxYdUuXpRzcC1SMgu3RSULJRZhRErNs5XwzcIuXWSQn1TySHg==} + hasBin: true + dev: true + /turbo-linux-64@1.10.3: resolution: {integrity: sha512-kvAisGKE7xHJdyMxZLvg53zvHxjqPK1UVj4757PQqtx9dnjYHSc8epmivE6niPgDHon5YqImzArCjVZJYpIGHQ==} cpu: [x64] @@ -19441,6 +19622,13 @@ packages: tiny-inflate: 1.0.3 dev: true + /union@0.5.0: + resolution: {integrity: sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==} + engines: {node: '>= 0.8.0'} + dependencies: + qs: 6.11.1 + dev: true + /unique-filename@1.1.1: resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==} dependencies: @@ -19530,6 +19718,10 @@ packages: dependencies: punycode: 2.3.0 + /url-join@4.0.1: + resolution: {integrity: sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==} + dev: true + /url-parse-as-address@1.0.0: resolution: {integrity: sha512-1WJ8YX1Kcec9wgxy8d/ATzGP1ayO6BRnd3iB6NlM+7cOnn6U8p5PKppRTCPLobh3CSdJ4d0TdPjopzyU2KcVFw==} dev: true @@ -19937,6 +20129,13 @@ packages: engines: {node: '>=0.8.0'} dev: true + /whatwg-encoding@2.0.0: + resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} + engines: {node: '>=12'} + dependencies: + iconv-lite: 0.6.3 + dev: true + /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} dependencies: @@ -20124,6 +20323,20 @@ packages: node-expat: 2.4.0 dev: true + /xml@1.0.1: + resolution: {integrity: sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==} + dev: true + + /xmlbuilder2@3.1.1: + resolution: {integrity: sha512-WCSfbfZnQDdLQLiMdGUQpMxxckeQ4oZNMNhLVkcekTu7xhD4tuUDyAPoY8CwXvBYE6LwBHd6QW2WZXlOWr1vCw==} + engines: {node: '>=12.0'} + dependencies: + '@oozcitak/dom': 1.15.10 + '@oozcitak/infra': 1.0.8 + '@oozcitak/util': 8.3.8 + js-yaml: 3.14.1 + dev: true + /xmlbuilder@11.0.1: resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==} engines: {node: '>=4.0'} @@ -20132,7 +20345,6 @@ packages: /xmlbuilder@15.1.1: resolution: {integrity: sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==} engines: {node: '>=8.0'} - dev: true /xmldoc@1.2.0: resolution: {integrity: sha512-2eN8QhjBsMW2uVj7JHLHkMytpvGHLHxKXBy4J3fAT/HujsEtM6yU84iGjpESYGHg6XwK0Vu4l+KgqQ2dv2cCqg==} diff --git a/turbo.json b/turbo.json index 6249c83c..2f45e935 100644 --- a/turbo.json +++ b/turbo.json @@ -2,12 +2,16 @@ "pipeline": { "build": { "dependsOn": ["^build"], - "outputs": ["lib/**", "www/**", ".angular/**"] + "outputs": ["lib/**", "www/**", ".angular/**"], + "cache": true }, "build:docker": { "dependsOn": ["//#build:docker-workspace"], "cache": false }, + "deploy": { + "dependsOn": ["build", "^deploy"] + }, "docs": { "dependsOn": ["build", "^docs"], "outputs": ["docs/**"] @@ -25,9 +29,12 @@ }, "test": { "dependsOn": ["build"], - "outputs": ["coverage/**"] + "outputs": ["coverage/cobertura-coverage.xml", "coverage/report-junit.xml"] + }, + "test:integration": { + "dependsOn": ["build"], + "outputs": ["coverage/integration-cobertura-coverage.xml", "coverage/integration-report-junit.xml"] }, - "test:integration": {}, "dev": { "persistent": true, "cache": false