Add travis config file
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Wed, 20 Jun 2018 14:26:04 +0000 (17:26 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Thu, 28 Jun 2018 09:36:12 +0000 (12:36 +0300)
Enable 3 jobs:
* build and test on Ubuntu
* build and test on macOS
* build for Tizen TM1 armv7l

If the build happens on master and is not from PR,
then tag it as latest and do a GitHub release.

.travis.yml [new file with mode: 0644]

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..9a11c2a
--- /dev/null
@@ -0,0 +1,187 @@
+matrix:
+  include:
+    - os: linux
+      dist: trusty
+      sudo: false
+      addons:
+        apt:
+          sources:
+          - ubuntu-toolchain-r-test
+          - sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main'
+            key_url: 'http://apt.llvm.org/llvm-snapshot.gpg.key'
+          packages:
+          - git
+          - ninja-build
+          - cmake
+          - llvm-3.9
+          - clang-3.9
+          - lldb-3.9
+          - liblldb-3.9-dev
+          - libunwind8
+          - libunwind8-dev
+          - gettext
+          - libicu-dev
+          - liblttng-ust-dev
+          - libcurl4-openssl-dev
+          - libssl-dev
+          - uuid-dev
+          - libnuma-dev
+          - libkrb5-dev
+          - g++-5
+    - os: linux
+      dist: trusty
+      sudo: required
+      env: TIZEN=1
+      addons:
+        apt:
+          sources:
+          - sourceline: 'deb http://download.tizen.org/tools/latest-release/Ubuntu_14.04/ /'
+          packages:
+          - gbs
+          - rpm2cpio
+    - os: osx
+      osx_image: xcode9.4
+
+env:
+  global:
+  - CLI_VERSION=2.1
+  - RELEASE_BRANCH=master
+  - RELEASE_REPO=Samsung/netcoredbg
+  - secure: "goktFL3DGZOhxD11w6BNUFmA02pMJLbQ8YbbrbaaeV831iFScbJf3TUFUJqrgn4ecWCz7d9bPD38XIMrRAr2m1VPW9N0aH/Zd/goxgVwO9Eu3JH3VclGMzBwnu1em1N7XNbhcAyFd7AqgBbAk0D5uBAfbMQqsJRDtXw+buqzrfwPUDEMlMr4ipt2RBSNOGvgFAixT1XCTNJi+gxoTuKAXB9UZHE4jPzC5c/xQVJQBCJI9jm6GlJ6Yr7aWpAXjGV1d0v1ZFpWNpD7FslVzFe3iX4oNqAjODHrgBVg2IO5M1A9BnfnUDh3xPahZNoE1yiAYGenXrjOs6x15KlzNEaoJ3/bOeNVytdddGRqbp2iw7nDMYp0uIjorD0WmFU9keKUC6K3g1m1i7GVrimTZR+kvYVifwMmotRuos6Kh7VGdAL0drsOgjdwZAOVNvEBcCYKcpawMNinccRQ77iLRC9iu8yfQiz9aRnHWrFbj/8v0V+hXDBDYk37of3v9e5+56iHOftpJZgs/4Eaf6SZpfCo8TqKiRKoqBpE9p2udjs+INcBY2Jdqd4zJzO3JzHd0GWIyR/9MxI0fE/4J6p/wlybdQat+yfqvdMXJg72Sd2FNcZZjgjtTYKlAK3up8KBxAew9i1YTwnYJsXR/+dKq61OKYVXM7ixAZuTmaJjEbAEDcI="
+
+branches:
+  except:
+    - latest
+
+language: cpp
+compiler: clang
+
+cache:
+  directories:
+    - $HOME/.nuget
+    - coreclr/bin/Product/Linux.x64.Release/inc
+    - coreclr/bin/Product/Linux.x64.Release/lib
+    - coreclr/bin/Product/OSX.x64.Release/inc
+    - coreclr/bin/Product/OSX.x64.Release/lib
+    - coreclr/src/inc
+    - coreclr/src/pal/inc
+    - coreclr/src/pal/inc/rt
+    - coreclr/src/pal/prebuilt/inc
+    - coreclr/src/debug/inc
+    - coreclr/src/debug/shim
+    - coreclr/src/dlls/dbgshim
+    - coreclr/src/coreclr/hosts/inc
+    - coreclr/src/ToolBox/SOS/Strike
+    - $HOME/GBS-ROOT/local/cache
+
+before_install:
+  - |
+      if [ ${TRAVIS_OS_NAME} = 'osx' ]; then
+        brew update
+        brew install git cmake ninja icu4c pkgconfig
+        brew link --force icu4c
+        mkdir -p /usr/local/lib/pkgconfig
+        ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
+        ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
+        ln -s /usr/local/opt/openssl/lib/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/
+        ln -s /usr/local/opt/openssl/lib/pkgconfig/libssl.pc /usr/local/lib/pkgconfig/
+        ln -s /usr/local/opt/openssl/lib/pkgconfig/openssl.pc /usr/local/lib/pkgconfig/
+      fi
+
+install:
+  - |
+      if [ -z "$TIZEN" ]; then
+        # Download .NET CLI
+        export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
+        curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel "$CLI_VERSION" --install-dir "$DOTNET_INSTALL_DIR"
+        export PATH="$DOTNET_INSTALL_DIR:$PATH"
+        # Set CoreCLR binaries output directory name and (for linux) specific compiler versions
+        if [ ${TRAVIS_OS_NAME} = 'linux' ]; then
+          export CORECLR_PRODUCT=Linux.x64.Release CC=clang-3.9 CXX=clang++-3.9
+        elif [ ${TRAVIS_OS_NAME} = 'osx' ]; then
+          export CORECLR_PRODUCT=OSX.x64.Release
+        fi
+        # Make CoreCLR sources and binaries available for build script
+        if [ ! -f "coreclr/src/inc/.cache_valid" ]; then
+          # Invalidate cache and build CoreCLR, put dbgshim library into cached directory
+          rm -rf coreclr
+          git clone --depth 1 https://github.com/dotnet/coreclr -b "release/$CLI_VERSION" && cd coreclr
+          ./build.sh ninja skiptests skipnuget release && cp bin/Product/$CORECLR_PRODUCT/libdbgshim.* bin/Product/$CORECLR_PRODUCT/lib && touch src/inc/.cache_valid
+          cd ..
+        else
+          # Restore dbgshim library location from cached directory
+          cp coreclr/bin/Product/$CORECLR_PRODUCT/lib/libdbgshim.* coreclr/bin/Product/$CORECLR_PRODUCT
+        fi
+      fi
+
+script:
+  - |
+      if [ -z "$TIZEN" ]; then
+        # Build and run tests
+        mkdir build && cd build
+        cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCLR_DIR=$PWD/../coreclr -DCMAKE_INSTALL_PREFIX=$PWD/../bin
+        ninja && ninja install
+        cd ..
+        dotnet build tests && dotnet test tests/runner
+      else
+        # Verify that Tizen build does not break
+        cat <<EOF > $HOME/.gbs.conf
+      [general]
+      profile = profile.target-TM1.unified
+      buildroot = ~/GBS-ROOT/
+      [profile.target-TM1.unified]
+      repos = repo.target.unified, repo.target.base
+      [repo.target.unified]
+      url=http://download.tizen.org/releases/milestone/tizen/unified/tizen-unified_20180528.1/repos/standard/packages/
+      [repo.target.base]
+      url=http://download.tizen.org/releases/milestone/tizen/base/tizen-base_20180518.1/repos/standard/packages/
+      EOF
+        gbs build -A armv7l
+      fi
+
+before_deploy:
+  - |
+      if [ "$TRAVIS_BRANCH" = "$RELEASE_BRANCH" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then
+        # Tag last commit as 'latest'.
+        git config --local user.name "Travis"
+        git config --local user.email "travis@travis-ci.org"
+
+        git remote add release "https://${GITHUB_API_KEY}@github.com/${RELEASE_REPO}.git"
+
+        git push -d release latest
+        git tag -d latest
+        git tag -a "latest" -m "[Autogenerated] This is the latest version pushed to the ${TRAVIS_BRANCH} branch."
+        git push release --tags
+        # Prepare files for deployment
+        if [ -z "$TIZEN" ]; then
+          mv bin netcoredbg
+          tar cfz netcoredbg-${TRAVIS_OS_NAME}-${TRAVIS_BRANCH}.tar.gz ./netcoredbg/*
+        else
+          # Generate tar.gz from rpm for Tizen SDK
+          RPMFILE=$(find ~/GBS-ROOT/local/repos/target_TM1.unified/armv7l/RPMS -type f -name 'netcoredbg-[0-9]*.rpm')
+          if [ ! -f "$RPMFILE" ]; then travis_terminate; fi
+          FILENAME=$(basename -- "$RPMFILE")
+          PKGNAME=$(echo "$FILENAME" | cut -d'-' -f1)
+          PKGVERSION=$(echo "$FILENAME" | cut -d'-' -f2)
+          PKGARCH=$(echo "$FILENAME"| cut -d'-' -f3 | cut -d'.' -f2)
+          TARGZNAME=$PKGNAME-$PKGVERSION-$PKGARCH.tar.gz
+          mkdir unpacked && cd unpacked
+          rpm2cpio "$RPMFILE" | cpio -idmv
+          touch ./home/owner/share/tmp/sdk_tools/$PKGNAME/version-$PKGVERSION
+          tar cfz ../$TARGZNAME --owner=root --group=root -C ./home/owner/share/tmp/sdk_tools .
+          cd ..
+          cp "$RPMFILE" ./
+        fi
+      fi
+deploy:
+  provider: releases
+  api_key: $GITHUB_API_KEY
+  file:
+    - "*.tar.gz"
+    - "*.rpm"
+  file_glob: true
+  skip_cleanup: true
+  overwrite: true
+  on:
+    repo: $RELEASE_REPO
+    branch: $RELEASE_BRANCH