mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 01:22:54 +00:00
feat: docker publishing
This commit is contained in:
@@ -3,9 +3,9 @@
|
|||||||
"changelog": "@changesets/cli/changelog",
|
"changelog": "@changesets/cli/changelog",
|
||||||
"commit": false,
|
"commit": false,
|
||||||
"fixed": [],
|
"fixed": [],
|
||||||
"linked": [],
|
"linked": [["@openstapps/*"]],
|
||||||
"access": "restricted",
|
"access": "restricted",
|
||||||
"baseBranch": "main",
|
"baseBranch": "master",
|
||||||
"updateInternalDependencies": "patch",
|
"updateInternalDependencies": "patch",
|
||||||
"ignore": []
|
"ignore": []
|
||||||
}
|
}
|
||||||
|
|||||||
114
.gitlab-ci.yml
114
.gitlab-ci.yml
@@ -1,10 +1,22 @@
|
|||||||
image: registry.gitlab.com/openstapps/projectmanagement/builder:v18
|
# `rules: if $CI_PIPELINE_SOURCE == 'merge_request_event'` seems to convert the whole
|
||||||
include: '/backend/backend/.gitlab-ci.yml'
|
# workflow into a merge request pipeline, effectively removing all the jobs.
|
||||||
|
# To work around that, add:
|
||||||
#variables:
|
# ```
|
||||||
# GIT_CLEAN_FLAGS: -ffdx -e www/
|
# rules:
|
||||||
|
# when: on_success
|
||||||
|
# ```
|
||||||
|
# To your pipeline.
|
||||||
|
# https://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html#use-rules-to-add-jobs
|
||||||
|
include:
|
||||||
|
- local: /backend/backend/.gitlab-ci.yml
|
||||||
|
- local: /frontend/app/.gitlab-ci.yml
|
||||||
|
- local: /.gitlab/publishing.gitlab-ci.yml
|
||||||
|
rules:
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
|
when: never
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
image: registry.gitlab.com/openstapps/projectmanagement/builder:v18
|
||||||
tags:
|
tags:
|
||||||
- performance
|
- performance
|
||||||
interruptible: true
|
interruptible: true
|
||||||
@@ -22,10 +34,11 @@ default:
|
|||||||
policy: pull
|
policy: pull
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- version
|
||||||
- build
|
- build
|
||||||
- images
|
|
||||||
- test
|
- test
|
||||||
- deploy
|
- review
|
||||||
|
- publish
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
@@ -38,28 +51,15 @@ build:
|
|||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- www
|
- 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:
|
cache:
|
||||||
<<: *pnpm_cache
|
<<: *pnpm_cache
|
||||||
policy: pull-push
|
policy: pull-push
|
||||||
|
rules:
|
||||||
|
- when: on_success
|
||||||
|
|
||||||
unit:
|
unit:
|
||||||
stage: test
|
stage: test
|
||||||
|
needs: ['build']
|
||||||
script:
|
script:
|
||||||
- pnpm config set recursive-install false
|
- pnpm config set recursive-install false
|
||||||
- pnpm i --prefer-offline
|
- pnpm i --prefer-offline
|
||||||
@@ -77,71 +77,5 @@ unit:
|
|||||||
coverage_report:
|
coverage_report:
|
||||||
coverage_format: cobertura
|
coverage_format: cobertura
|
||||||
path: coverage.xml
|
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
|
|
||||||
# variables:
|
|
||||||
# DOCKER_DRIVER: overlay2
|
|
||||||
# services:
|
|
||||||
# - docker:dind
|
|
||||||
# script:
|
|
||||||
# - pnpm install
|
|
||||||
# - pnpm run test:integration
|
|
||||||
# tags:
|
|
||||||
# - gitlab-org-docker
|
|
||||||
|
|
||||||
review:
|
|
||||||
stage: deploy
|
|
||||||
dependencies:
|
|
||||||
- build
|
|
||||||
script:
|
|
||||||
# TODO: - .gitlab/ci/enableGitlabReviewToolbar.sh www/index.html "$CI_PROJECT_ID" "$CI_OPEN_MERGE_REQUESTS"
|
|
||||||
- cp www/index.html www/200.html
|
|
||||||
- pnpm dlx surge -p ./www -d https://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh/
|
|
||||||
environment:
|
|
||||||
name: review/$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_NAME
|
|
||||||
url: https://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh/
|
|
||||||
on_stop: stop_review
|
|
||||||
rules:
|
rules:
|
||||||
- if: ($CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_REF_NAME != "main" && $CI_MERGE_REQUEST_EVENT_TYPE != "merge_train" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web"))
|
- when: on_success
|
||||||
|
|
||||||
stop_review:
|
|
||||||
stage: deploy
|
|
||||||
script:
|
|
||||||
- pnpm dlx surge teardown $CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh
|
|
||||||
when: manual
|
|
||||||
environment:
|
|
||||||
name: review/$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_NAME
|
|
||||||
action: stop
|
|
||||||
rules:
|
|
||||||
- if: ($CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_REF_NAME != "main" && $CI_MERGE_REQUEST_EVENT_TYPE != "merge_train" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web"))
|
|
||||||
|
|
||||||
# TODO!!
|
|
||||||
# pages:docs:
|
|
||||||
# stage: deploy
|
|
||||||
# script:
|
|
||||||
# - pnpm install
|
|
||||||
# - pnpm run docs
|
|
||||||
# - mv docs public
|
|
||||||
# artifacts:
|
|
||||||
# paths:
|
|
||||||
# - public
|
|
||||||
|
|||||||
70
.gitlab/publishing.gitlab-ci.yml
Normal file
70
.gitlab/publishing.gitlab-ci.yml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
deploy:
|
||||||
|
stage: publish
|
||||||
|
needs: ['build']
|
||||||
|
script:
|
||||||
|
- pnpm install
|
||||||
|
- pnpm run deploy
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- ./.deploy
|
||||||
|
rules:
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
|
when: manual
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
|
||||||
|
publish images:
|
||||||
|
stage: publish
|
||||||
|
inherit:
|
||||||
|
default:
|
||||||
|
- tags
|
||||||
|
needs: ['deploy']
|
||||||
|
image:
|
||||||
|
name: gcr.io/kaniko-project/executor:v1.9.0-debug
|
||||||
|
entrypoint: [""]
|
||||||
|
script:
|
||||||
|
- /kaniko/executor
|
||||||
|
--context "${CI_PROJECT_DIR}/${DEPLOY_DIR}"
|
||||||
|
--dockerfile "${CI_PROJECT_DIR}/${DEPLOY_DIR}/Dockerfile"
|
||||||
|
--destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG}"
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
variables:
|
||||||
|
DOCKER_TAG: $CI_COMMIT_TAG
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
|
variables:
|
||||||
|
DOCKER_TAG: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
||||||
|
parallel:
|
||||||
|
matrix:
|
||||||
|
- DEPLOY_DIR: backend/database
|
||||||
|
IMAGE_NAME: database
|
||||||
|
- DEPLOY_DIR: .deploy/backend
|
||||||
|
IMAGE_NAME: backend
|
||||||
|
- DEPLOY_DIR: .deploy/proxy
|
||||||
|
IMAGE_NAME: proxy
|
||||||
|
|
||||||
|
publish:
|
||||||
|
stage: publish
|
||||||
|
needs: ['deploy']
|
||||||
|
script:
|
||||||
|
- pnpm install --prefer-offline
|
||||||
|
- pnpm build
|
||||||
|
- pnpm changeset version $PUBLISH_TYPE
|
||||||
|
- pnpm changeset publish
|
||||||
|
rules:
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
|
variables:
|
||||||
|
PUBLISH_TYPE: --snapshot $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
||||||
|
|
||||||
|
pages:docs:
|
||||||
|
stage: publish
|
||||||
|
needs: ['deploy']
|
||||||
|
script:
|
||||||
|
- pnpm install --prefer-offline
|
||||||
|
- pnpm run docs
|
||||||
|
- mv docs public
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: on_success
|
||||||
@@ -36,19 +36,6 @@ const config = {
|
|||||||
packages: ['@openstapps/es-mapping-generator'],
|
packages: ['@openstapps/es-mapping-generator'],
|
||||||
isIgnored: true,
|
isIgnored: true,
|
||||||
},
|
},
|
||||||
/*{
|
|
||||||
label: 'App Special Dependencies',
|
|
||||||
dependencies: ['typescript'],
|
|
||||||
packages: ['@openstapps/app'],
|
|
||||||
isIgnored: true,
|
|
||||||
},*/
|
|
||||||
{
|
|
||||||
label: 'Should have the same version',
|
|
||||||
dependencies: ['**'],
|
|
||||||
dependencyTypes: ['workspace'],
|
|
||||||
packages: ['**'],
|
|
||||||
pinVersion: '3.0.0',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Packages should use workspace version',
|
label: 'Packages should use workspace version',
|
||||||
dependencies: ['@openstapps/**'],
|
dependencies: ['@openstapps/**'],
|
||||||
@@ -56,12 +43,6 @@ const config = {
|
|||||||
packages: ['**'],
|
packages: ['**'],
|
||||||
pinVersion: 'workspace:*',
|
pinVersion: 'workspace:*',
|
||||||
},
|
},
|
||||||
/*{
|
|
||||||
label: 'Packages should be synced to app',
|
|
||||||
dependencies: ['typescript', 'ts-node'],
|
|
||||||
packages: ['**'],
|
|
||||||
snapTo: ['@openstapps/app'],
|
|
||||||
},*/
|
|
||||||
{
|
{
|
||||||
label: 'App may have some dependency exceptions',
|
label: 'App may have some dependency exceptions',
|
||||||
dependencies: ['typescript', '@typescript-eslint/**', 'eslint**'],
|
dependencies: ['typescript', '@typescript-eslint/**', 'eslint**'],
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
integration:backend:
|
integration:
|
||||||
image: registry.gitlab.com/openstapps/projectmanagement/builder:v18
|
image: registry.gitlab.com/openstapps/projectmanagement/builder:v18
|
||||||
stage: test
|
stage: test
|
||||||
|
needs: ['build']
|
||||||
variables:
|
variables:
|
||||||
DOCKER_DRIVER: overlay2
|
DOCKER_DRIVER: overlay2
|
||||||
WAIT_FOR_SERVICES_TIMEOUT: 1
|
WAIT_FOR_SERVICES_TIMEOUT: 1
|
||||||
@@ -8,10 +9,8 @@ integration:backend:
|
|||||||
- name: registry.gitlab.com/openstapps/database:latest
|
- name: registry.gitlab.com/openstapps/database:latest
|
||||||
alias: elasticsearch
|
alias: elasticsearch
|
||||||
script:
|
script:
|
||||||
- pnpm --filter=@openstapps/backend --filter=@openstapps/api-cli install --prefer-offline
|
- pnpm --filter=@openstapps/backend install --prefer-offline
|
||||||
- pnpm test:integration
|
- pnpm test:integration:backend
|
||||||
tags:
|
|
||||||
- performance
|
|
||||||
artifacts:
|
artifacts:
|
||||||
when: always
|
when: always
|
||||||
paths:
|
paths:
|
||||||
@@ -19,3 +18,5 @@ integration:backend:
|
|||||||
reports:
|
reports:
|
||||||
junit:
|
junit:
|
||||||
- backend/backend/coverage/integration-report-junit.xml
|
- backend/backend/coverage/integration-report-junit.xml
|
||||||
|
rules:
|
||||||
|
- when: on_success
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
services:
|
|
||||||
backend:
|
|
||||||
build:
|
|
||||||
dockerfile: ./Dockerfile
|
|
||||||
context: ../../.deploy/backend
|
|
||||||
ports:
|
|
||||||
- '3000:3000'
|
|
||||||
environment:
|
|
||||||
STAPPS_LOG_LEVEL: '31'
|
|
||||||
STAPPS_EXIT_LEVEL: '8'
|
|
||||||
NODE_CONFIG_ENV: 'elasticsearch'
|
|
||||||
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
|
|
||||||
ports:
|
|
||||||
- '9200:9200'
|
|
||||||
|
|
||||||
api-cli:
|
|
||||||
build:
|
|
||||||
dockerfile: ../../packages/api-cli/Dockerfile
|
|
||||||
context: ../../.deploy/api-cli
|
|
||||||
environment:
|
|
||||||
STAPPS_LOG_LEVEL: '31'
|
|
||||||
STAPPS_EXIT_LEVEL: '8'
|
|
||||||
volumes:
|
|
||||||
- ./node_modules/@openstapps/core/test/resources:/@openstapps/core/test/resources:ro
|
|
||||||
command: e2e http://backend:3000 --waiton tcp:backend:3000 --samples /@openstapps/core/test/resources/indexable
|
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsup-node",
|
"build": "tsup-node",
|
||||||
|
"build:docker": "docker build -t openstapps:backend ../../.deploy/backend",
|
||||||
"deploy": "pnpm --prod --filter=@openstapps/backend deploy ../../.deploy/backend",
|
"deploy": "pnpm --prod --filter=@openstapps/backend deploy ../../.deploy/backend",
|
||||||
"dev": "tsup --watch --onSuccess \"pnpm run start\"",
|
"dev": "tsup --watch --onSuccess \"pnpm run start\"",
|
||||||
"format": "prettier . -c --ignore-path ../../.gitignore",
|
"format": "prettier . -c --ignore-path ../../.gitignore",
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsup-node --dts",
|
"build": "tsup-node --dts",
|
||||||
|
"build:docker": "docker build -t openstapps:proxy ../../.deploy/proxy",
|
||||||
|
"deploy": "pnpm --prod --filter=@openstapps/proxy deploy ../../.deploy/proxy",
|
||||||
"format": "prettier . -c --ignore-path ../../.gitignore",
|
"format": "prettier . -c --ignore-path ../../.gitignore",
|
||||||
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
|
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
|
||||||
"lint": "eslint --ext .ts src/",
|
"lint": "eslint --ext .ts src/",
|
||||||
|
|||||||
@@ -1,226 +1,60 @@
|
|||||||
image: registry.gitlab.com/openstapps/app
|
e2e:
|
||||||
|
image: cypress/browsers:latest # https://hub.docker.com/r/cypress/browsers/tags/
|
||||||
before_script:
|
|
||||||
- npm ci
|
|
||||||
|
|
||||||
default:
|
|
||||||
tags:
|
|
||||||
- performance
|
|
||||||
interruptible: true
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- setup
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
- publish
|
|
||||||
- deploy
|
|
||||||
- ui test
|
|
||||||
|
|
||||||
setup:
|
|
||||||
image: registry.gitlab.com/openstapps/projectmanagement/builder
|
|
||||||
stage: setup
|
|
||||||
only:
|
|
||||||
- schedules
|
|
||||||
variables:
|
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
script:
|
|
||||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
|
|
||||||
- docker build -t registry.gitlab.com/openstapps/app .
|
|
||||||
- docker push registry.gitlab.com/openstapps/app
|
|
||||||
cache: {} # disable irrelevant cache for this job
|
|
||||||
before_script: [] # do not run irrelevant before script for this job
|
|
||||||
tags:
|
|
||||||
- dind
|
|
||||||
interruptible: false
|
|
||||||
|
|
||||||
build:
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
- npm run build
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- www
|
|
||||||
except:
|
|
||||||
- schedules
|
|
||||||
|
|
||||||
scheduled-build:
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
- npm run build
|
|
||||||
only:
|
|
||||||
- schedules
|
|
||||||
|
|
||||||
lint:
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
- npm run lint
|
|
||||||
|
|
||||||
format:
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
- npm run format:check
|
|
||||||
|
|
||||||
unit:
|
|
||||||
stage: test
|
stage: test
|
||||||
|
before_script:
|
||||||
|
- corepack enable
|
||||||
|
- corepack prepare pnpm@latest-8 --activate
|
||||||
|
- !reference [default, before_script]
|
||||||
script:
|
script:
|
||||||
- npm run check-icons
|
- pnpm --filter=@openstapps/app install --prefer-offline
|
||||||
- npm run test -- --watch=false --no-progress --code-coverage
|
- pnpm --filter=@openstapps/app exec cypress install
|
||||||
coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/'
|
- pnpm test:integration:app
|
||||||
artifacts:
|
artifacts:
|
||||||
|
when: always
|
||||||
paths:
|
paths:
|
||||||
- coverage
|
- frontend/app/cypress/videos
|
||||||
|
- frontend/app/cypress/screenshots
|
||||||
|
- frontend/app/coverage/integration-report-junit.xml
|
||||||
reports:
|
reports:
|
||||||
coverage_report:
|
junit:
|
||||||
coverage_format: cobertura
|
- frontend/app/coverage/integration-report-junit.xml
|
||||||
path: coverage/cobertura-coverage.xml
|
parallel:
|
||||||
|
matrix:
|
||||||
.e2e-chrome:
|
- BROWSER: chrome
|
||||||
image: registry.gitlab.com/openstapps/projectmanagement/cypress
|
- BROWSER: firefox
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npm run e2e -- --watch=false --headless=true --browser=chrome
|
|
||||||
artifacts:
|
|
||||||
when: on_failure
|
|
||||||
paths:
|
|
||||||
- cypress/videos
|
|
||||||
- cypress/screenshots
|
|
||||||
|
|
||||||
.e2e-firefox:
|
|
||||||
image: registry.gitlab.com/openstapps/projectmanagement/cypress
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npm run e2e -- --watch=false --headless=true --browser=firefox
|
|
||||||
artifacts:
|
|
||||||
when: on_failure
|
|
||||||
paths:
|
|
||||||
- cypress/videos
|
|
||||||
- cypress/screenshots
|
|
||||||
|
|
||||||
ui-chrome:
|
|
||||||
extends: .e2e-chrome
|
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
- when: on_success
|
||||||
when: never
|
|
||||||
- if: ($CI_COMMIT_REF_NAME == "develop" || $CI_COMMIT_REF_NAME == "main")
|
|
||||||
when: always
|
|
||||||
allow_failure: false
|
|
||||||
- if: ($CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_REF_NAME != "main")
|
|
||||||
when: never
|
|
||||||
|
|
||||||
ui-firefox:
|
|
||||||
extends: .e2e-firefox
|
|
||||||
rules:
|
|
||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
||||||
when: never
|
|
||||||
- if: ($CI_COMMIT_REF_NAME == "develop" || $CI_COMMIT_REF_NAME == "main")
|
|
||||||
when: always
|
|
||||||
allow_failure: false
|
|
||||||
- if: ($CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_REF_NAME != "main")
|
|
||||||
when: never
|
|
||||||
|
|
||||||
e2e-chrome:
|
|
||||||
extends: .e2e-chrome
|
|
||||||
stage: ui test
|
|
||||||
rules:
|
|
||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
||||||
when: never
|
|
||||||
- if: ($CI_COMMIT_REF_NAME == "develop" || $CI_COMMIT_REF_NAME == "main")
|
|
||||||
when: never
|
|
||||||
- if: ($CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_REF_NAME != "main")
|
|
||||||
when: manual
|
|
||||||
allow_failure: false
|
|
||||||
|
|
||||||
e2e-firefox:
|
|
||||||
extends: .e2e-firefox
|
|
||||||
stage: ui test
|
|
||||||
rules:
|
|
||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
||||||
when: never
|
|
||||||
- if: ($CI_COMMIT_REF_NAME == "develop" || $CI_COMMIT_REF_NAME == "main")
|
|
||||||
when: never
|
|
||||||
- if: ($CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_REF_NAME != "main")
|
|
||||||
when: manual
|
|
||||||
allow_failure: false
|
|
||||||
|
|
||||||
audit:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npm audit
|
|
||||||
allow_failure: true
|
|
||||||
except:
|
|
||||||
- schedules
|
|
||||||
|
|
||||||
scheduled-audit:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npm audit --production
|
|
||||||
only:
|
|
||||||
- schedules
|
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: publish
|
|
||||||
script:
|
|
||||||
- npm run documentation
|
|
||||||
- mv docs public
|
|
||||||
only:
|
|
||||||
- main
|
|
||||||
except:
|
|
||||||
- schedules
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
|
|
||||||
review:
|
review:
|
||||||
stage: deploy
|
stage: review
|
||||||
|
needs: ['build']
|
||||||
script:
|
script:
|
||||||
- npm run build:prod
|
# pretty sure this is deprecated?
|
||||||
- .gitlab/ci/enableGitlabReviewToolbar.sh www/index.html "$CI_PROJECT_ID" "$CI_OPEN_MERGE_REQUESTS"
|
# TODO: - .gitlab/ci/enableGitlabReviewToolbar.sh www/index.html "$CI_PROJECT_ID" "$CI_OPEN_MERGE_REQUESTS"
|
||||||
- cp www/index.html www/200.html
|
- cp www/index.html www/200.html
|
||||||
- ./node_modules/.bin/surge -p ./www -d https://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh/
|
- pnpm dlx surge -p ./www -d https://$CI_PROJECT_NAME-$DEPLOY_ID.surge.sh/
|
||||||
environment:
|
environment:
|
||||||
name: review/$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_NAME
|
name: review/$DEPLOY_ID
|
||||||
url: https://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh/
|
url: https://$CI_PROJECT_NAME-$DEPLOY_ID.surge.sh/
|
||||||
on_stop: stop_review
|
on_stop: stop review
|
||||||
rules:
|
rules: &deploy-rules
|
||||||
- if: ($CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_REF_NAME != "main" && $CI_MERGE_REQUEST_EVENT_TYPE != "merge_train" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web"))
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||||
|
variables:
|
||||||
|
DEPLOY_ID: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
||||||
|
- if: $CI_COMMIT_BRANCH == 'main'
|
||||||
|
variables:
|
||||||
|
DEPLOY_ID: production
|
||||||
|
- if: $CI_COMMIT_BRANCH == 'develop'
|
||||||
|
variables:
|
||||||
|
DEPLOY_ID: staging
|
||||||
|
|
||||||
stop_review:
|
stop review:
|
||||||
stage: deploy
|
stage: review
|
||||||
|
needs: ['review']
|
||||||
script:
|
script:
|
||||||
- ./node_modules/.bin/surge teardown $CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh
|
- pnpm dlx surge teardown $CI_PROJECT_NAME-$DEPLOY_ID.surge.sh
|
||||||
when: manual
|
|
||||||
environment:
|
environment:
|
||||||
name: review/$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_NAME
|
name: review/$DEPLOY_ID
|
||||||
action: stop
|
action: stop
|
||||||
rules:
|
when: manual
|
||||||
- if: ($CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_REF_NAME != "main" && $CI_MERGE_REQUEST_EVENT_TYPE != "merge_train" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web"))
|
rules: *deploy-rules
|
||||||
|
|
||||||
staging:
|
|
||||||
stage: deploy
|
|
||||||
script:
|
|
||||||
- npm run build:prod
|
|
||||||
- cp www/index.html www/200.html
|
|
||||||
- ./node_modules/.bin/surge -p ./www -d https://$CI_PROJECT_PATH_SLUG-staging.surge.sh/
|
|
||||||
environment:
|
|
||||||
name: staging
|
|
||||||
url: https://$CI_PROJECT_PATH_SLUG-staging.surge.sh/
|
|
||||||
only:
|
|
||||||
- develop
|
|
||||||
except:
|
|
||||||
- schedules
|
|
||||||
|
|
||||||
production_demo:
|
|
||||||
stage: deploy
|
|
||||||
script:
|
|
||||||
- npm run build:prod
|
|
||||||
- cp www/index.html www/200.html
|
|
||||||
- ./node_modules/.bin/surge -p ./www -d https://$CI_PROJECT_PATH_SLUG.surge.sh/
|
|
||||||
environment:
|
|
||||||
name: production
|
|
||||||
url: https://$CI_PROJECT_PATH_SLUG.surge.sh/
|
|
||||||
only:
|
|
||||||
- main
|
|
||||||
except:
|
|
||||||
- schedules
|
|
||||||
|
|||||||
30
frontend/app/.gitlab-ci.yml.old
Normal file
30
frontend/app/.gitlab-ci.yml.old
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
build:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- npm run build
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- www
|
||||||
|
except:
|
||||||
|
- schedules
|
||||||
|
|
||||||
|
scheduled-build:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- npm run build
|
||||||
|
only:
|
||||||
|
- schedules
|
||||||
|
|
||||||
|
unit:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npm run check-icons
|
||||||
|
- npm run test -- --watch=false --no-progress --code-coverage
|
||||||
|
coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/'
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- coverage
|
||||||
|
reports:
|
||||||
|
coverage_report:
|
||||||
|
coverage_format: cobertura
|
||||||
|
path: coverage/cobertura-coverage.xml
|
||||||
@@ -17,6 +17,10 @@ import {defineConfig} from 'cypress';
|
|||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
|
reporter: 'junit',
|
||||||
|
reporterOptions: {
|
||||||
|
mochaFile: 'coverage/integration-report-junit-[hash].xml',
|
||||||
|
},
|
||||||
baseUrl: 'http://localhost:4200',
|
baseUrl: 'http://localhost:4200',
|
||||||
supportFile: 'cypress/support/index.ts',
|
supportFile: 'cypress/support/index.ts',
|
||||||
videosFolder: 'cypress/videos',
|
videosFolder: 'cypress/videos',
|
||||||
|
|||||||
11
frontend/app/integration-test.sh
Normal file
11
frontend/app/integration-test.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
rm coverage/integration-report-junit-*.xml
|
||||||
|
|
||||||
|
ng e2e --watch=false --headless=true --browser="$BROWSER"
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
|
jrm coverage/integration-report-junit.xml coverage/integration-report-junit-*.xml
|
||||||
|
rm coverage/integration-report-junit-*.xml
|
||||||
|
|
||||||
|
exit $exit_code
|
||||||
@@ -46,7 +46,8 @@
|
|||||||
"start": "ionic serve",
|
"start": "ionic serve",
|
||||||
"start:external": "ionic serve --external",
|
"start:external": "ionic serve --external",
|
||||||
"start:prod": "ionic serve --prod",
|
"start:prod": "ionic serve --prod",
|
||||||
"test": "ng test"
|
"test": "ng test",
|
||||||
|
"test:integration": "sh integration-test.sh"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "13.3.11",
|
"@angular/animations": "13.3.11",
|
||||||
@@ -153,6 +154,7 @@
|
|||||||
"jasmine-core": "4.5.0",
|
"jasmine-core": "4.5.0",
|
||||||
"jasmine-spec-reporter": "7.0.0",
|
"jasmine-spec-reporter": "7.0.0",
|
||||||
"jetifier": "2.0.0",
|
"jetifier": "2.0.0",
|
||||||
|
"junit-report-merger": "6.0.2",
|
||||||
"karma": "6.4.1",
|
"karma": "6.4.1",
|
||||||
"karma-chrome-launcher": "3.1.1",
|
"karma-chrome-launcher": "3.1.1",
|
||||||
"karma-coverage-istanbul-reporter": "3.0.3",
|
"karma-coverage-istanbul-reporter": "3.0.3",
|
||||||
|
|||||||
@@ -3,25 +3,27 @@
|
|||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "dotenv -c -- turbo run build",
|
"build": "dotenv -c -- turbo run build",
|
||||||
"build:docker-workspace": "docker build -t openstapps:workspace .",
|
|
||||||
"build:full": "dotenv -c -- turbo run syncpack build lint format --summarize",
|
"build:full": "dotenv -c -- turbo run syncpack build lint format --summarize",
|
||||||
"build:full:skip": "dotenv -c -- turbo-ignore --task='build lint format'",
|
"build:full:skip": "dotenv -c -- turbo-ignore --task='build lint format'",
|
||||||
|
"deploy": "dotenv -c -- turbo run deploy --concurrency=1",
|
||||||
"dev": "dotenv -c -- turbo run dev",
|
"dev": "dotenv -c -- turbo run dev",
|
||||||
"docs": "dotenv -c -- turbo run docs && typedoc",
|
"docs": "dotenv -c -- turbo run docs && typedoc",
|
||||||
"format": "dotenv -c -- turbo run format",
|
"format": "dotenv -c -- turbo run format",
|
||||||
"format:fix": "dotenv -c -- turbo run format:fix",
|
"format:fix": "dotenv -c -- turbo run format:fix",
|
||||||
"lint": "dotenv -c -- turbo run lint",
|
"lint": "dotenv -c -- turbo run lint",
|
||||||
"lint:fix": "dotenv -c -- turbo run lint:fix",
|
"lint:fix": "dotenv -c -- turbo run lint:fix",
|
||||||
"publish-packages": "dotenv -c -- turbo run build format lint test && changeset version && changeset publish",
|
|
||||||
"syncpack": "syncpack list-mismatches && syncpack lint-semver-ranges",
|
"syncpack": "syncpack list-mismatches && syncpack lint-semver-ranges",
|
||||||
"syncpack:fix": "syncpack format && syncpack fix-mismatches",
|
"syncpack:fix": "syncpack format && syncpack fix-mismatches",
|
||||||
"test": "trap 'node coverage.mjs' EXIT && dotenv -c -- turbo run test --filter=!@openstapps/app",
|
"test": "trap 'node coverage.mjs' EXIT && dotenv -c -- turbo run test --filter=!@openstapps/app",
|
||||||
"test:integration": "dotenv -c -- turbo run test:integration",
|
"test:integration": "dotenv -c -- turbo run test:integration",
|
||||||
|
"test:integration:app": "dotenv -c -- turbo run test:integration --filter=@openstapps/app",
|
||||||
|
"test:integration:backend": "dotenv -c -- turbo run test:integration --filter=@openstapps/backend",
|
||||||
"test:skip": "dotenv -c -- turbo-ignore --task='test' --filter=!@openstapps/app",
|
"test:skip": "dotenv -c -- turbo-ignore --task='test' --filter=!@openstapps/app",
|
||||||
"turboify-pipeline": "node deploy.mjs backend,api-cli,database && pnpm build:full && pnpm test && pnpm run docs"
|
"turboify-pipeline": "node deploy.mjs backend,api-cli,database && pnpm build:full && pnpm test && pnpm run docs"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@changesets/cli": "2.26.1",
|
"@changesets/cli": "2.26.1",
|
||||||
|
"@changesets/types": "5.2.1",
|
||||||
"cobertura-merge": "1.0.4",
|
"cobertura-merge": "1.0.4",
|
||||||
"deepmerge": "4.3.1",
|
"deepmerge": "4.3.1",
|
||||||
"dotenv-cli": "7.2.1",
|
"dotenv-cli": "7.2.1",
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
FROM registry.gitlab.com/openstapps/projectmanagement/node:v18
|
|
||||||
|
|
||||||
USER node
|
|
||||||
ENV NODE_ENV=production
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY --chown=node:node . .
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
ENTRYPOINT ["node", "app.js"]
|
|
||||||
@@ -26,7 +26,6 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsup-node",
|
"build": "tsup-node",
|
||||||
"deploy": "pnpm --prod --filter=@openstapps/api-cli deploy ../../.deploy/api-cli",
|
|
||||||
"format": "prettier . -c --ignore-path ../../.gitignore",
|
"format": "prettier . -c --ignore-path ../../.gitignore",
|
||||||
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
|
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
|
||||||
"lint": "tsc --noEmit && eslint --ext .ts src/",
|
"lint": "tsc --noEmit && eslint --ext .ts src/",
|
||||||
|
|||||||
6
pnpm-lock.yaml
generated
6
pnpm-lock.yaml
generated
@@ -11,6 +11,9 @@ importers:
|
|||||||
'@changesets/cli':
|
'@changesets/cli':
|
||||||
specifier: 2.26.1
|
specifier: 2.26.1
|
||||||
version: 2.26.1
|
version: 2.26.1
|
||||||
|
'@changesets/types':
|
||||||
|
specifier: 5.2.1
|
||||||
|
version: 5.2.1
|
||||||
cobertura-merge:
|
cobertura-merge:
|
||||||
specifier: 1.0.4
|
specifier: 1.0.4
|
||||||
version: 1.0.4
|
version: 1.0.4
|
||||||
@@ -1021,6 +1024,9 @@ importers:
|
|||||||
jetifier:
|
jetifier:
|
||||||
specifier: 2.0.0
|
specifier: 2.0.0
|
||||||
version: 2.0.0
|
version: 2.0.0
|
||||||
|
junit-report-merger:
|
||||||
|
specifier: 6.0.2
|
||||||
|
version: 6.0.2
|
||||||
karma:
|
karma:
|
||||||
specifier: 6.4.1
|
specifier: 6.4.1
|
||||||
version: 6.4.1
|
version: 6.4.1
|
||||||
|
|||||||
@@ -5,12 +5,9 @@
|
|||||||
"outputs": ["lib/**", "www/**", ".angular/**"],
|
"outputs": ["lib/**", "www/**", ".angular/**"],
|
||||||
"cache": true
|
"cache": true
|
||||||
},
|
},
|
||||||
"build:docker": {
|
|
||||||
"dependsOn": ["//#build:docker-workspace"],
|
|
||||||
"cache": false
|
|
||||||
},
|
|
||||||
"deploy": {
|
"deploy": {
|
||||||
"dependsOn": ["build", "^deploy"]
|
"dependsOn": ["build", "^deploy"],
|
||||||
|
"cache": false
|
||||||
},
|
},
|
||||||
"docs": {
|
"docs": {
|
||||||
"dependsOn": ["build", "^docs"],
|
"dependsOn": ["build", "^docs"],
|
||||||
|
|||||||
Reference in New Issue
Block a user