.gitlab-ci.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. stages:
  2. - test
  3. - release
  4. # Build Send, run npm tests
  5. test:
  6. stage: test
  7. image: "node:16-slim"
  8. only:
  9. - api
  10. - branches
  11. - chat
  12. - merge_requests
  13. - pushes
  14. - schedules
  15. - tags
  16. - triggers
  17. - web
  18. before_script:
  19. # Install dependencies
  20. - apt-get update
  21. - apt-get install -y git python3 build-essential libxtst6
  22. # Prepare Chrome for puppeteer
  23. - apt-get install -y wget gnupg
  24. - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
  25. - sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
  26. - apt-get update
  27. - apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils
  28. - 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
  29. script:
  30. - npm ci
  31. - npm run lint
  32. - npm test
  33. release-docker:
  34. stage: release
  35. image: docker:latest
  36. services:
  37. - docker:dind
  38. only:
  39. - api
  40. - branches
  41. - chat
  42. - merge_requests
  43. - pushes
  44. - schedules
  45. - tags
  46. - triggers
  47. - web
  48. script:
  49. - docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
  50. - docker buildx create --name sendBuilder
  51. - docker buildx use sendBuilder
  52. - |
  53. if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then
  54. IMAGE_NAMES="$CI_REGISTRY_IMAGE/mr:$CI_MERGE_REQUEST_IID"
  55. elif [ "$CI_COMMIT_TAG" != "" ]; then
  56. IMAGE_NAMES="$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG $CI_REGISTRY_IMAGE:latest"
  57. else
  58. IMAGE_NAMES="$CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH:$CI_COMMIT_SHORT_SHA"
  59. fi
  60. - |
  61. for image in $IMAGE_NAMES; do
  62. docker buildx build --platform linux/amd64,linux/arm64 -t $image . --push
  63. done
  64. - |
  65. echo "Container image pushed. You can pull it with";
  66. for image in $IMAGE_NAMES; do
  67. echo "docker pull $image"
  68. done