Browse Source

Merge pull request #5605 from docker/circleci-osx-build

Move Linux/OSX builds from Travis to CircleCI
Joffrey F 7 years ago
parent
commit
707f9db18a

+ 62 - 0
.circleci/config.yml

@@ -0,0 +1,62 @@
+version: 2
+jobs:
+  test:
+    macos:
+      xcode: "8.3.3"
+    steps:
+    - checkout
+#    - run:
+#        name: install python3
+#        command: brew install python3
+    - run:
+        name: install tox
+        command: sudo pip install --upgrade tox==2.1.1
+    - run:
+        name: unit tests
+        command: tox -e py27 -- tests/unit
+
+  build-osx-binary:
+    macos:
+      xcode: "8.3.3"
+    steps:
+      - checkout
+      - run:
+          name: upgrade python tools
+          command: sudo pip install --upgrade pip virtualenv
+      - run:
+         name: setup script
+         command: ./script/setup/osx
+      - run:
+         name: build script
+         command: ./script/build/osx
+      - store_artifacts:
+          path: dist/docker-compose-Darwin-x86_64
+          destination: docker-compose-Darwin-x86_64
+      - deploy:
+          name: Deploy binary to bintray
+          command: |
+            OS_NAME=Darwin PKG_NAME=osx ./script/circle/bintray-deploy.sh
+
+
+  build-linux-binary:
+    machine:
+      enabled: true
+    steps:
+      - checkout
+      - run:
+          name: build Linux binary
+          command: ./script/build/linux
+      - store_artifacts:
+          path: dist/docker-compose-Linux-x86_64
+          destination: docker-compose-Linux-x86_64
+      - deploy:
+          name: Deploy binary to bintray
+          command: |
+            OS_NAME=Linux PKG_NAME=linux ./script/circle/bintray-deploy.sh
+workflows:
+  version: 2
+  all:
+    jobs:
+      - test
+      - build-linux-binary
+      - build-osx-binary

+ 0 - 30
.travis.yml

@@ -1,30 +0,0 @@
-sudo: required
-
-language: python
-
-matrix:
-  include:
-    - os: linux
-      services:
-      - docker
-    - os: osx
-      osx_image: xcode7.3
-      language: generic
-
-install: ./script/travis/install
-
-script:
-  - ./script/travis/ci
-  - ./script/travis/build-binary
-
-before_deploy:
-  - "./script/travis/render-bintray-config.py < ./script/travis/bintray.json.tmpl > ./bintray.json"
-
-deploy:
-  provider: bintray
-  user: docker-compose-roleuser
-  key: '$BINTRAY_API_KEY'
-  file: ./bintray.json
-  skip_cleanup: true
-  on:
-    all_branches: true

+ 27 - 0
script/circle/bintray-deploy.sh

@@ -0,0 +1,27 @@
+#!/bin/bash
+
+curl -f -u$BINTRAY_USERNAME:$BINTRAY_API_KEY -X GET \
+  https://api.bintray.com/repos/docker-compose/${CIRCLE_BRANCH}
+
+if test $? -ne 0; then
+  echo "Bintray repository ${CIRCLE_BRANCH} does not exist ; abandoning upload attempt"
+  exit 0
+fi
+
+curl -u$BINTRAY_USERNAME:$BINTRAY_API_KEY -X POST \
+  -d "{\
+    \"name\": \"${PKG_NAME}\", \"desc\": \"auto\", \"licenses\": [\"Apache-2.0\"], \
+    \"vcs_url\": \"${CIRCLE_REPOSITORY_URL}\" \
+  }" -H "Content-Type: application/json" \
+  https://api.bintray.com/packages/docker-compose/${CIRCLE_BRANCH}
+
+curl -u$BINTRAY_USERNAME:$BINTRAY_API_KEY -X POST -d "{\
+    \"name\": \"$CIRCLE_BRANCH\", \
+    \"desc\": \"Automated build of the ${CIRCLE_BRANCH} branch.\", \
+  }" -H "Content-Type: application/json" \
+  https://api.bintray.com/packages/docker-compose/${CIRCLE_BRANCH}/${PKG_NAME}/versions
+
+curl -f -T dist/docker-compose-${OS_NAME}-x86_64 -u$BINTRAY_USERNAME:$BINTRAY_API_KEY \
+  -H "X-Bintray-Package: ${PKG_NAME}" -H "X-Bintray-Version: $CIRCLE_BRANCH" \
+  -H "X-Bintray-Override: 1" -H "X-Bintray-Publish: 1" -X PUT \
+  https://api.bintray.com/content/docker-compose/${CIRCLE_BRANCH}/docker-compose-${OS_NAME}-x86_64 || exit 1

+ 0 - 34
script/setup/osx

@@ -10,40 +10,6 @@ openssl_version() {
   python -c "import ssl; print ssl.OPENSSL_VERSION"
 }
 
-desired_python_version="2.7.12"
-desired_python_brew_version="2.7.12"
-python_formula="https://raw.githubusercontent.com/Homebrew/homebrew-core/737a2e34a89b213c1f0a2a24fc1a3c06635eed04/Formula/python.rb"
-
-desired_openssl_version="1.0.2j"
-desired_openssl_brew_version="1.0.2j"
-openssl_formula="https://raw.githubusercontent.com/Homebrew/homebrew-core/30d3766453347f6e22b3ed6c74bb926d6def2eb5/Formula/openssl.rb"
-
-PATH="/usr/local/bin:$PATH"
-
-if !(which brew); then
-  ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-fi
-
-brew update > /dev/null
-
-if !(python_version | grep "$desired_python_version"); then
-  if brew list | grep python; then
-    brew unlink python
-  fi
-
-  brew install "$python_formula"
-  brew switch python "$desired_python_brew_version"
-fi
-
-if !(openssl_version | grep "$desired_openssl_version"); then
-  if brew list | grep openssl; then
-    brew unlink openssl
-  fi
-
-  brew install "$openssl_formula"
-  brew switch openssl "$desired_openssl_brew_version"
-fi
-
 echo "*** Using $(python_version)"
 echo "*** Using $(openssl_version)"
 

+ 0 - 29
script/travis/bintray.json.tmpl

@@ -1,29 +0,0 @@
-{
-    "package": {
-        "name": "${TRAVIS_OS_NAME}",
-        "repo": "${TRAVIS_BRANCH}",
-        "subject": "docker-compose",
-        "desc": "Automated build of master branch from travis ci.",
-        "website_url": "https://github.com/docker/compose",
-        "issue_tracker_url": "https://github.com/docker/compose/issues",
-        "vcs_url": "https://github.com/docker/compose.git",
-        "licenses": ["Apache-2.0"]
-    },
-
-    "version": {
-        "name": "${TRAVIS_BRANCH}",
-        "desc": "Automated build of the ${TRAVIS_BRANCH} branch.",
-        "released": "${DATE}",
-        "vcs_tag": "master"
-    },
-
-    "files": [
-        {
-            "includePattern": "dist/(.*)",
-            "excludePattern": ".*\.tar.gz",
-            "uploadPattern": "$1",
-            "matrixParams": { "override": 1 }
-        }
-    ],
-    "publish": true
-}

+ 0 - 13
script/travis/build-binary

@@ -1,13 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
-    script/build/linux
-    # TODO: requires auth to push, so disable for now
-    # script/build/image master
-    # docker push docker/compose:master
-else
-    script/setup/osx
-    script/build/osx
-fi

+ 0 - 10
script/travis/ci

@@ -1,10 +0,0 @@
-#!/bin/bash
-
-set -e
-
-if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
-    tox -e py27,py34 -- tests/unit
-else
-    # TODO: we could also install py34 and test against it
-    tox -e py27 -- tests/unit
-fi

+ 0 - 10
script/travis/install

@@ -1,10 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
-    pip install tox==2.1.1
-else
-    sudo pip install --upgrade pip tox==2.1.1 virtualenv
-    pip --version
-fi

+ 0 - 13
script/travis/render-bintray-config.py

@@ -1,13 +0,0 @@
-#!/usr/bin/env python
-from __future__ import absolute_import
-from __future__ import print_function
-from __future__ import unicode_literals
-
-import datetime
-import os.path
-import sys
-
-os.environ['DATE'] = str(datetime.date.today())
-
-for line in sys.stdin:
-    print(os.path.expandvars(line), end='')