Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.gitlab-ci.yml 5.25 KiB
variables:
  CCACHE_COMPILERCHECK: content
  CCACHE_DIR: "${CI_PROJECT_DIR}/.ccache"
  # prevent configure tzdata hanging apt install commands
  DEBIAN_FRONTEND: noninteractive

include:
  - template: 'Workflows/Branch-Pipelines.gitlab-ci.yml'

stages:
  - prepare
  - build

.build-synapse-image:
  stage: prepare
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  rules:
    - if: $CI_COMMIT_BRANCH
      changes:
        - .ci/synapse/Dockerfile
        - .ci/synapse/setup-synapse.sh
        - .ci/synapse/service/synapse/*
        - .ci/synapse/service/postgresql/*
        - .gitlab-ci.yml
  script:
    - mkdir -p /kaniko/.docker
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --whitelist-var-run=false --context $CI_PROJECT_DIR/.ci/synapse --dockerfile $CI_PROJECT_DIR/.ci/synapse/Dockerfile --destination $CI_REGISTRY_IMAGE/synapse-${M_ARCH}:latest

build synapse amd64:
  extends: .build-synapse-image
  tags: [docker]
  variables:
    M_ARCH: x86_64

build synapse arm64:
  extends: .build-synapse-image
  tags: [docker-arm64]
  variables:
    M_ARCH: aarch64

.build-linux:
  stage: build
  image: ubuntu:18.04
  services:
    - name: $CI_REGISTRY_IMAGE/synapse-${M_ARCH}:latest
      alias: synapse
  variables:
    CXX: g++-7
    CC: gcc-7
    TRAVIS_OS_NAME: linux
  before_script:
    - apt-get update
    - apt-get install -y software-properties-common
    - add-apt-repository ppa:ubuntu-toolchain-r/test -y
    - apt-get update && apt-get -y install --no-install-recommends ${CXX} ${CC} build-essential ninja-build libssl-dev git ccache curl lcov
    # need recommended deps for wget
    - apt-get -y install wget
    - wget https://github.com/Kitware/CMake/releases/download/v3.20.0-rc4/cmake-3.20.0-rc4-linux-${M_ARCH}.sh && sh cmake-3.20.0-rc4-linux-${M_ARCH}.sh  --skip-license  --prefix=/usr/local
    - /usr/sbin/update-ccache-symlinks
    - update-alternatives --install /usr/bin/gcc gcc "/usr/bin/${CC}" 10
    - update-alternatives --install /usr/bin/g++ g++ "/usr/bin/${CXX}" 10
    - update-alternatives --set gcc "/usr/bin/${CC}"
    - update-alternatives --set g++ "/usr/bin/${CXX}"
    - rm -rf ../.hunter && mv .hunter ../.hunter || true
  script:
    - curl -s -f -k https://synapse:8008/_matrix/client/versions
    - export PATH="/usr/lib/ccache:${PATH}"