2020-10-15 14:46:14 +00:00
|
|
|
|
|
|
|
stages:
|
|
|
|
- test
|
2020-10-15 17:54:03 +00:00
|
|
|
- release
|
2020-10-15 14:46:14 +00:00
|
|
|
|
2021-02-16 13:12:49 +00:00
|
|
|
# Build Send, run npm tests
|
2020-10-15 14:46:14 +00:00
|
|
|
test:
|
|
|
|
stage: test
|
2022-09-12 10:51:03 +00:00
|
|
|
image: "node:15-slim"
|
|
|
|
only:
|
|
|
|
- api
|
|
|
|
- branches
|
|
|
|
- chat
|
|
|
|
- merge_requests
|
|
|
|
- pushes
|
|
|
|
- schedules
|
|
|
|
- tags
|
|
|
|
- triggers
|
|
|
|
- web
|
|
|
|
before_script:
|
|
|
|
# Install dependencies
|
|
|
|
- apt-get update
|
|
|
|
- apt-get install -y git python3 build-essential libxtst6
|
|
|
|
|
|
|
|
# Prepare Chrome for puppeteer
|
|
|
|
- apt-get install -y wget gnupg
|
|
|
|
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
|
|
|
- sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
|
|
|
|
- apt-get update
|
|
|
|
- apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 --no-install-recommends
|
2020-10-15 14:46:14 +00:00
|
|
|
script:
|
|
|
|
- npm ci
|
|
|
|
- npm run lint
|
|
|
|
- npm test
|
2020-10-15 17:16:49 +00:00
|
|
|
|
2020-10-15 17:54:03 +00:00
|
|
|
release-docker:
|
|
|
|
stage: release
|
|
|
|
image: docker:latest
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
only:
|
2022-09-12 10:51:03 +00:00
|
|
|
- api
|
|
|
|
- branches
|
|
|
|
- chat
|
|
|
|
- merge_requests
|
|
|
|
- pushes
|
|
|
|
- schedules
|
|
|
|
- tags
|
|
|
|
- triggers
|
|
|
|
- web
|
2020-10-15 17:54:03 +00:00
|
|
|
script:
|
2022-09-12 10:51:03 +00:00
|
|
|
- docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
|
2022-10-25 17:08:27 +00:00
|
|
|
- docker buildx create --name sendBuilder
|
|
|
|
- docker buildx use sendBuilder
|
2022-09-12 10:51:03 +00:00
|
|
|
- |
|
|
|
|
if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then
|
|
|
|
IMAGE_NAMES="$CI_REGISTRY_IMAGE/mr:$CI_MERGE_REQUEST_IID"
|
|
|
|
elif [ "$CI_COMMIT_TAG" != "" ]; then
|
|
|
|
IMAGE_NAMES="$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG $CI_REGISTRY_IMAGE:latest"
|
|
|
|
else
|
|
|
|
IMAGE_NAMES="$CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH:$CI_COMMIT_SHORT_SHA"
|
|
|
|
fi
|
|
|
|
- |
|
|
|
|
for image in $IMAGE_NAMES; do
|
2022-10-25 17:08:27 +00:00
|
|
|
docker buildx build --platform linux/amd64,linux/arm64 -t $image . --push
|
2022-09-12 10:51:03 +00:00
|
|
|
done
|
|
|
|
- |
|
|
|
|
echo "Container image pushed. You can pull it with";
|
|
|
|
for image in $IMAGE_NAMES; do
|
|
|
|
echo "docker pull $image"
|
|
|
|
done
|