https://github.com/ICIJ/datashare
Raw File
Tip revision: eaa7c0807bfca85a3cc0e539804a9041db3ec7de authored by Anne L'Hôte on 04 November 2019, 14:59:30 UTC
[release] 4.17.8
Tip revision: eaa7c08
config.yml
version: 2
jobs:
  build_back:
    docker:
      - image: circleci/java:8
      - image: docker.elastic.co/elasticsearch/elasticsearch:6.3.0
        environment:
          - "discovery.type=single-node"
          - "cluster.name=datashare"
          - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
        name: elasticsearch
      - image: redis:4.0.1-alpine
        name: redis
      - image: postgres:11.2
        name: postgresql
        environment:
          POSTGRES_USER: test
          POSTGRES_PASSWORD: test
          POSTGRES_DB: test


    working_directory: /tmp/datashare

    environment:
      MAVEN_OPTS: "-Xms256m -Xmx256m"

    dependencies:
      override:

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "pom.xml" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: mvn validate

      - save_cache:
          paths:
            - ~/.m2
          key: v1-dependencies-{{ checksum "pom.xml" }}

      - run: mvn test

      - run: mvn -Dmaven.test.skip=true package

      # making a datashare-dist-latest as we cannot access dist directory with a wildcard
      - run:
           name: make dist dir
           command: |
             mkdir -p datashare-dist/target/datashare-dist-latest
             cp -a datashare-dist/target/datashare-dist-*.*-all/* datashare-dist/target/datashare-dist-latest

      - persist_to_workspace:
          root: /tmp/datashare
          paths:
            - datashare-dist

  build_front:
    docker:
      - image: circleci/node:10.15.2
      - image: docker.elastic.co/elasticsearch/elasticsearch:6.3.0
        environment:
          - "discovery.type=single-node"
          - "cluster.name=datashare"
          - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
          - "http.cors.enabled=true"
          - "http.cors.allow-origin=*"
          - "http.cors.allow-methods=OPTIONS, HEAD, GET, POST, PUT, DELETE"
        name: elasticsearch
    working_directory: /tmp
    steps:
      - attach_workspace:
           at: /tmp/datashare
      - run:
           name: adds_ssh_dir
           command: |
             mkdir -p ~/.ssh
             chmod 700 ~/.ssh
      - add_ssh_keys:
          fingerprints:
            - "b3:e6:7c:f3:86:9e:e9:88:d1:cf:22:8c:97:3e:93:54"
      - run:
          name: checkout
          command: |
            ssh-keyscan github.com >> ~/.ssh/known_hosts
            git clone git@github.com:ICIJ/datashare-client.git
      - run:
          name: make install
          command: |
            cd /tmp/datashare-client
            make install
      - save_cache:
          key: dependency-cache-{{ checksum "/tmp/datashare-client/package.json" }}
          paths:
            - /tmp/datashare-client/node_modules
      - run:
          name: run tests and build dist
          command: |
            cd /tmp/datashare-client
            make unit dist
      - persist_to_workspace:
          root: /tmp/datashare-client
          paths:
            - dist

  build_docker:
    docker:
      - image: docker:17.05.0-ce-git
    working_directory: /tmp
    steps:
      - attach_workspace:
           at: /tmp/datashare
      - setup_remote_docker
      - run:
          name: Install dependencies
          command: |
            apk add --no-cache py-pip=9.0.0-r1
            pip install docker-compose==1.12.0
      - run:
          name: build and push docker image
          command: |
            cp -a /tmp/datashare/dist/ /tmp/datashare/datashare-dist/target/datashare-dist-latest/app
            docker build -t icij/datashare:${CIRCLE_TAG} /tmp/datashare/datashare-dist/target/datashare-dist-latest/
            docker login -u ${DOCKER_USER} -p ${DOCKER_PASS}
            docker push icij/datashare:${CIRCLE_TAG}

  build_installers:
    docker:
      - image: circleci/build-image
    working_directory: /tmp
    steps:
      - attach_workspace:
           at: /tmp/datashare
      - run:
          name: install dependencies
          command: |
            apt-get install -y nsis cpio jq imagemagick icnsutils
            wget http://nsis.sourceforge.net/mediawiki/images/c/c9/Inetc.zip && unzip Inetc.zip && cp Plugins/x86-ansi/INetC.dll /usr/share/nsis/Plugins/
            wget https://github.com/hogliux/bomutils/archive/0.2.tar.gz && tar -zxf 0.2.tar.gz && cd bomutils-0.2 && make && make install
            wget https://github.com/downloads/mackyle/xar/xar-1.6.1.tar.gz && tar -zxf xar-1.6.1.tar.gz && cd xar-1.6.1 && ./configure && make && make install
      - run:
          name: adds_ssh_dir
          command: |
            mkdir -p ~/.ssh
            chmod 700 ~/.ssh
      - add_ssh_keys:
          fingerprints:
          - "b3:e6:7c:f3:86:9e:e9:88:d1:cf:22:8c:97:3e:93:54"
      - run:
          name: checkout
          command: |
            ssh-keyscan github.com >> ~/.ssh/known_hosts
            git clone git@github.com:ICIJ/datashare-installer.git
      - run:
          name: build mac installer
          command: |
            cd /tmp/datashare-installer/mac
            make VERSION=${CIRCLE_TAG} dist/Datashare.pkg
      - run:
          name: build windows installer
          command: |
            cd /tmp/datashare-installer/windows
            make VERSION=${CIRCLE_TAG} dist/installDatashare.exe
      - run:
          name: build linux installer
          command: |
            cd /tmp/datashare-installer/linux
            make VERSION=${CIRCLE_TAG} dist/datashare.sh
      - run:
          name: deploy installers on github
          command: |
            cd /tmp/datashare-installer
            ./deploy.sh ${CIRCLE_TAG}

workflows:
  version: 2
  build_workflow:
    jobs:
      - build_back:
          filters:
              tags:
                  only: /.*/
      - build_front:
          requires:
            - build_back
          filters:
              tags:
                  only: /^[0-9.]*/
              branches:
                  ignore: /.*/
      - build_docker:
          requires:
            - build_front
          filters:
              tags:
                  only: /^[0-9.]*/
              branches:
                  ignore: /.*/
      - build_installers:
          requires:
            - build_docker
          filters:
              tags:
                  only: /^[0-9.]*/
              branches:
                  ignore: /.*/
back to top