mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2025-12-13 01:36:22 +00:00
169 lines
4.3 KiB
YAML
169 lines
4.3 KiB
YAML
image: registry.gitlab.com/openstapps/projectmanagement/node
|
|
|
|
default:
|
|
tags:
|
|
- performance
|
|
|
|
stages:
|
|
- build
|
|
- test
|
|
- audit
|
|
- publish
|
|
- deploy
|
|
|
|
build:
|
|
stage: build
|
|
script:
|
|
- npm ci
|
|
- npm run build
|
|
artifacts:
|
|
expire_in: 1 day
|
|
untracked: true
|
|
paths:
|
|
- node_modules/
|
|
|
|
unit:
|
|
stage: test
|
|
dependencies:
|
|
- build
|
|
script:
|
|
- npm run test-unit
|
|
coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/'
|
|
artifacts:
|
|
expire_in: 6 month
|
|
reports:
|
|
coverage_report:
|
|
coverage_format: cobertura
|
|
path: coverage/cobertura-coverage.xml
|
|
|
|
integration:
|
|
image: registry.gitlab.com/openstapps/projectmanagement/builder
|
|
stage: test
|
|
dependencies:
|
|
- build
|
|
variables:
|
|
DOCKER_DRIVER: overlay2
|
|
services:
|
|
- docker:dind
|
|
script:
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
- docker-compose -f integration-test.yml pull && docker-compose -f integration-test.yml up --abort-on-container-exit --exit-code-from apicli
|
|
tags:
|
|
- gitlab-org-docker
|
|
|
|
audit:
|
|
stage: audit
|
|
dependencies:
|
|
- build
|
|
script:
|
|
- npm audit --production
|
|
|
|
pages:
|
|
stage: deploy
|
|
script:
|
|
- npm run documentation
|
|
- mv docs/openapi public
|
|
only:
|
|
- master
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
|
|
ci:
|
|
stage: test
|
|
dependencies:
|
|
- build
|
|
script:
|
|
- .gitlab/ci/testCIScripts.sh
|
|
|
|
# Anchor templates for publishing the image in the docker registry
|
|
# Automatically publishing for versions in tags (eg v1.0.0 as 1.0.0), master and develop
|
|
# Manual publishing for all other branches
|
|
.publish_template_auto: &publish_template_auto
|
|
image: registry.gitlab.com/openstapps/projectmanagement/builder
|
|
stage: publish
|
|
dependencies:
|
|
- build
|
|
variables:
|
|
DOCKER_DRIVER: overlay2
|
|
services:
|
|
- docker:dind
|
|
script:
|
|
- echo "YOU SHOULD OVERRIDE THIS SECTION"
|
|
- exit 1
|
|
only:
|
|
- master
|
|
tags:
|
|
- secrecy
|
|
|
|
.publish_template_manual: &publish_template_manual
|
|
image: registry.gitlab.com/openstapps/projectmanagement/builder
|
|
stage: publish
|
|
dependencies:
|
|
- build
|
|
variables:
|
|
DOCKER_DRIVER: overlay2
|
|
services:
|
|
- docker:dind
|
|
script:
|
|
- export CORE_VERSION=$(openstapps-projectmanagement get-used-version @openstapps/core)
|
|
- export IMAGETAG_BASE=$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME
|
|
- export IMAGETAG_CORE_VERSION=$IMAGETAG_BASE:core-$CORE_VERSION
|
|
- export IMAGETAG_LATEST=$IMAGETAG_BASE:latest
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
- docker build -t $IMAGETAG_LATEST -t $IMAGETAG_CORE_VERSION .
|
|
- docker push $IMAGETAG_BASE
|
|
except:
|
|
- /(^v[0-9]+\.[0-9]+\.[0-9]+$|^master$|^develop$)/
|
|
only:
|
|
- branches
|
|
when: manual
|
|
tags:
|
|
- secrecy
|
|
|
|
.publish_version_template: &publish_version_template
|
|
script:
|
|
- export CORE_VERSION=$(openstapps-projectmanagement get-used-version @openstapps/core)
|
|
- export VERSION=$(echo -n "$CI_COMMIT_REF_NAME" | cut -c 2-)
|
|
- export IMAGETAG_BASE=$CI_REGISTRY_IMAGE
|
|
- export IMAGETAG_CORE_VERSION=$IMAGETAG_BASE:core-$CORE_VERSION
|
|
- export IMAGETAG_VERSION=$IMAGETAG_BASE:$VERSION
|
|
- export IMAGETAG_LATEST=$IMAGETAG_BASE:latest
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
- docker build -t $IMAGETAG_LATEST -t $IMAGETAG_VERSION -t $IMAGETAG_CORE_VERSION .
|
|
- docker push $IMAGETAG_BASE
|
|
|
|
.publish_branch_template: &publish_branch_template
|
|
script:
|
|
- export CORE_VERSION=$(openstapps-projectmanagement get-used-version @openstapps/core)
|
|
- export IMAGETAG_BASE=$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME
|
|
- export IMAGETAG_CORE_VERSION=$IMAGETAG_BASE:core-$CORE_VERSION
|
|
- export IMAGETAG_LATEST=$IMAGETAG_BASE:latest
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
- docker build -t $IMAGETAG_LATEST -t $IMAGETAG_CORE_VERSION .
|
|
- docker push $IMAGETAG_BASE
|
|
|
|
# Jobs joining anchor templates with automatic publishing behaviour
|
|
# ! The jobname must end with ":" followed by the name for the registry branch
|
|
image:version:
|
|
<<: *publish_template_auto
|
|
<<: *publish_version_template
|
|
only:
|
|
- /^v[0-9]+\.[0-9]+\.[0-9]+$/
|
|
|
|
image:master:
|
|
<<: *publish_template_auto
|
|
<<: *publish_branch_template
|
|
only:
|
|
- master
|
|
|
|
image:develop:
|
|
<<: *publish_template_auto
|
|
<<: *publish_branch_template
|
|
only:
|
|
- develop
|
|
|
|
# Jobs joining anchor templates with manual publishing behaviour
|
|
image:branch:
|
|
<<: *publish_template_manual
|