2024-02-01 11:23:23 +01:00
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- deploy
|
|
|
|
|
|
|
|
testCommit:
|
|
|
|
stage: test
|
2024-05-09 20:20:49 +02:00
|
|
|
image: node:iron
|
2024-02-01 11:23:23 +01:00
|
|
|
services:
|
|
|
|
- postgres:15
|
|
|
|
- redis
|
|
|
|
variables:
|
|
|
|
POSTGRES_PASSWORD: ci
|
|
|
|
script:
|
2024-06-15 14:17:44 +02:00
|
|
|
- apt-get update && apt-get install -y git wget curl build-essential python3 ffmpeg
|
2024-02-01 11:23:23 +01:00
|
|
|
- cp .config/ci.yml .config/default.yml
|
2024-06-15 14:17:44 +02:00
|
|
|
- cp .config/ci.yml .config/test.yml
|
2024-02-01 11:23:23 +01:00
|
|
|
- corepack enable
|
|
|
|
- corepack prepare pnpm@latest --activate
|
|
|
|
- git submodule update --init
|
|
|
|
- pnpm install --frozen-lockfile
|
|
|
|
- pnpm run build
|
|
|
|
- pnpm run migrate
|
2024-06-15 14:17:44 +02:00
|
|
|
- pnpm run --filter='!megalodon' test
|
2024-05-02 18:05:44 +02:00
|
|
|
- pnpm run --filter=backend lint
|
|
|
|
- pnpm run --filter=frontend eslint
|
2024-02-01 11:23:23 +01:00
|
|
|
cache:
|
|
|
|
key: test
|
|
|
|
policy: pull-push
|
|
|
|
when: on_success
|
|
|
|
paths:
|
|
|
|
- node_modules/
|
|
|
|
- packages/*/node_modules/
|
|
|
|
only:
|
|
|
|
- develop
|
2024-02-01 13:49:02 +01:00
|
|
|
- merge_requests
|
2024-02-01 11:23:23 +01:00
|
|
|
- stable
|
|
|
|
|
|
|
|
getImageTag:
|
|
|
|
stage: deploy
|
|
|
|
image: ubuntu:latest
|
|
|
|
script:
|
|
|
|
- apt-get update && apt-get install -y jq
|
|
|
|
- |
|
|
|
|
if test -n "$CI_COMMIT_TAG"; then
|
|
|
|
tag="$CI_COMMIT_TAG"
|
|
|
|
elif test "$CI_COMMIT_BRANCH" == "stable"; then
|
|
|
|
tag="latest"
|
|
|
|
elif test "$CI_COMMIT_BRANCH" == "develop"; then
|
|
|
|
tag="develop"
|
|
|
|
else
|
|
|
|
tag="$CI_COMMIT_BRANCH"
|
2024-02-01 14:55:44 +01:00
|
|
|
fi
|
|
|
|
version=$(cat package.json | jq -r '.version')
|
2024-02-01 11:23:23 +01:00
|
|
|
- echo "REGISTRY_PUSH_TAG=$tag" >> build.env
|
|
|
|
- echo "REGISTRY_PUSH_VERSION=$version" >> build.env
|
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
dotenv: build.env
|
|
|
|
only:
|
|
|
|
- stable
|
|
|
|
- develop
|
|
|
|
- tags
|
2024-03-02 18:28:34 +01:00
|
|
|
|
2024-02-01 11:23:23 +01:00
|
|
|
buildDocker:
|
|
|
|
stage: deploy
|
2024-02-01 16:45:42 +01:00
|
|
|
needs:
|
|
|
|
- job: getImageTag
|
|
|
|
artifacts: true
|
2024-02-01 11:23:23 +01:00
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- ARCH: amd64
|
|
|
|
- ARCH: arm64
|
|
|
|
tags:
|
|
|
|
- ${ARCH}
|
|
|
|
image:
|
|
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
|
|
entrypoint: [""]
|
|
|
|
script:
|
|
|
|
- >-
|
|
|
|
/kaniko/executor
|
|
|
|
--context "${CI_PROJECT_DIR}"
|
|
|
|
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
|
2024-02-01 16:59:14 +01:00
|
|
|
--destination "${CI_REGISTRY_IMAGE}:${REGISTRY_PUSH_VERSION}-${ARCH}"
|
2024-02-01 11:23:23 +01:00
|
|
|
only:
|
|
|
|
- stable
|
|
|
|
- develop
|
|
|
|
- tags
|
2024-03-02 18:28:34 +01:00
|
|
|
|
2024-02-01 11:23:23 +01:00
|
|
|
mergeManifests:
|
|
|
|
stage: deploy
|
|
|
|
needs:
|
|
|
|
- job: buildDocker
|
|
|
|
artifacts: false
|
|
|
|
- job: getImageTag
|
|
|
|
artifacts: true
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
image:
|
|
|
|
name: mplatform/manifest-tool:alpine
|
|
|
|
entrypoint: [""]
|
|
|
|
script:
|
|
|
|
- >-
|
2024-02-01 15:15:10 +01:00
|
|
|
manifest-tool
|
|
|
|
--username=${CI_REGISTRY_USER}
|
|
|
|
--password=${CI_REGISTRY_PASSWORD}
|
|
|
|
push from-args
|
|
|
|
--platforms linux/amd64,linux/arm64
|
|
|
|
--tags ${REGISTRY_PUSH_VERSION}
|
2024-02-01 16:59:14 +01:00
|
|
|
--template ${CI_REGISTRY_IMAGE}:${REGISTRY_PUSH_VERSION}-ARCH
|
2024-02-01 15:15:10 +01:00
|
|
|
--target ${CI_REGISTRY_IMAGE}:${REGISTRY_PUSH_TAG}
|
2024-02-01 11:23:23 +01:00
|
|
|
only:
|
|
|
|
- stable
|
|
|
|
- develop
|
2024-02-01 16:45:42 +01:00
|
|
|
- tags
|