Browse Source

Extract Travis/Appveyor changes from PR #732 into separate PR

Stefan Profanter 8 years ago
parent
commit
0a80e17aab
4 changed files with 91 additions and 73 deletions
  1. 3 0
      .travis.yml
  2. 73 63
      appveyor.yml
  3. 5 0
      tools/travis/travis_linux_before_install.sh
  4. 10 10
      tools/travis/travis_linux_script.sh

+ 3 - 0
.travis.yml

@@ -34,10 +34,13 @@ addons:
       # see https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
       - kalakris-cmake
       - ubuntu-toolchain-r-test
+      - llvm-toolchain-precise
+      - llvm-toolchain-precise-3.7
     packages:
       - binutils-mingw-w64-i686
       - build-essential
       - clang
+      - clang-3.7
       - cmake
       - gcc-4.8
       - gcc-mingw-w64-i686

+ 73 - 63
appveyor.yml

@@ -6,16 +6,18 @@ clone_folder: c:\projects\open62541
 clone_depth: 20
 
 environment:
-    global:
-        CYG_ARCH: x86
-        CYG_ROOT: C:/cygwin
-        CYG_SETUP_URL: http://cygwin.com/setup-x86.exe
-        CYG_MIRROR: http://cygwin.mirror.constant.com
-        CYG_CACHE: C:\cygwin\var\cache\setup
-        CYG_BASH: C:/cygwin/bin/bash
-
-cache:
-  - '%CYG_CACHE%'
+  matrix:
+  - Compiler: msvc
+    Arch: x86
+  - Compiler: msvc
+    Arch: x64
+  - Compiler: mingw
+    Arch: x86
+  - Compiler: mingw
+    Arch: x64
+#    cygwin cmake stopped working on 05.07.2016 -- commented out until a fix appears
+#  - Compiler: cygwin
+#    Arch: x86
 
 #
 # Initialisation prior to pulling the Mono repository
@@ -29,64 +31,72 @@ init:
 # Install needed build dependencies
 #
 install:
-  - if not exist "%CYG_ROOT%" mkdir "%CYG_ROOT%"
-  - ps:  echo "Installing Cygwin from $env:CYG_SETUP_URL to $env:CYG_ROOT/setup-x86.exe"
-  - appveyor DownloadFile %CYG_SETUP_URL% -FileName %CYG_ROOT%/setup-x86.exe
-  - ps:  echo "Downloaded. Now ready to install."
-  - cmd: '"%CYG_ROOT%/setup-x86.exe" --quiet-mode --no-shortcuts --only-site -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" --packages cmake,gcc-core,make,python'
-  - cmd: '%CYG_BASH% -lc "cygcheck -dc cygwin"'
-
+  - git submodule update --init --recursive
 
 before_build:
   # Workaround for CMake not wanting sh.exe on PATH for MinGW
   - set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
-  - set PATH=C:\MinGW\bin;%PATH%
 
 build_script:
-  - cd c:\projects\open62541
-  - md build
-  - cd build
-  # cygwin cmake stopped working on 05.07.2016 -- commented out until a fix appears
-  #- echo "Testing cygwin"
-  #- '%CYG_BASH% --login -lc "/usr/bin/cmake.exe --version"'
-  #- '%CYG_BASH% --login -lc "cd /cygdrive/c/projects/open62541/build; cmake -DUA_BUILD_EXAMPLES:BOOL=ON -G\"Unix Makefiles\" .."'
-  #- '%CYG_BASH% --login -lc "cd /cygdrive/c/projects/open62541/build; make -j"'
-  - cd ..
-  - rd /s /q build
-  - md build
-  - cd build
-  - echo "Testing MinGW32"
-  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_BUILD_SELFSIGNED_CERTIFICATE:BOOL=ON -G"MinGW Makefiles" ..
-  - mingw32-make
-  - cd ..
-  - rd /s /q build
-  - md build
-  - cd build
-  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -G"Visual Studio 12 2013" ..
-  - msbuild open62541.sln /m
-  - echo "Testing amalgamation"
-  - cd ..
-  - rd /s /q build
-  - md build
-  - cd build
-  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_BUILD_SELFSIGNED_CERTIFICATE:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON -G"Visual Studio 12 2013" ..
-  - msbuild open62541.sln /m
-  - copy C:\projects\open62541\build\open62541.c C:\projects\open62541\build\Debug\open62541.c
-  - copy C:\projects\open62541\build\open62541.h C:\projects\open62541\build\Debug\open62541.h
-  - copy C:\projects\open62541\build\examples\server_cert.der C:\projects\open62541\build\Debug\server_cert.der
-  - cd ..
-  - echo "Win 64 build"
-  - md build64
-  - cd build64
-  - cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_BUILD_SELFSIGNED_CERTIFICATE:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON -G"Visual Studio 12 2013 Win64" ..
-  - msbuild open62541.sln /m
-  - copy C:\projects\open62541\build64\open62541.c C:\projects\open62541\build64\Debug\open62541.c
-  - copy C:\projects\open62541\build64\open62541.h C:\projects\open62541\build64\Debug\open62541.h
-  - copy C:\projects\open62541\build64\examples\server_cert.der C:\projects\open62541\build64\Debug\server_cert.der
-  - cd ..
+  - ps: |
+        cd c:\projects\open62541
+        md build
+        cd build
+        if ($env:Compiler -eq "mingw") {
+          if ($env:Arch -eq "x64") {
+            echo "Testing MinGW64"
+            $env:Path = "C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin;" + $env:Path
+          } else {
+            echo "Testing MinGW32"
+            $env:Path = "C:\MinGW\bin;" + $env:Path
+          }
+          cmake -DUA_BUILD_EXAMPLES:BOOL=ON -G"MinGW Makefiles" ..
+          mingw32-make -j4
+        } elseif ($env:Compiler -eq "cygwin") {
+          echo "Testing cygwin"
+          $env:Path = "C:\cygwin\bin;" + $env:Path
+          C:\cygwin\bin\bash -lc "cygcheck -dc cygwin"
+          C:\cygwin\bin\bash --login -lc "cmake.exe --version"
+          C:\cygwin\bin\bash --login -lc "cd /cygdrive/c/projects/open62541/build; cmake -DUA_BUILD_EXAMPLES:BOOL=ON -G\"Unix Makefiles\" .."
+          C:\cygwin\bin\bash --login -lc "cd /cygdrive/c/projects/open62541/build; make -j"
+        } else {
+          if ($env:Arch -eq "x64") {
+            echo "Testing MSVC with amalgamation (x64)"
+            cd ..
+            md build64
+            cd build64
+            cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON -G"Visual Studio 12 2013 Win64" ..
+            msbuild open62541.sln /m
+            copy C:\projects\open62541\build64\open62541.c C:\projects\open62541\build64\Debug\open62541.c
+            copy C:\projects\open62541\build64\open62541.h C:\projects\open62541\build64\Debug\open62541.h
+            copy C:\projects\open62541\build64\examples\server_cert.der C:\projects\open62541\build64\Debug\server_cert.der
+          } else {
+            echo "Testing MSVC without amalgamation (x86)"
+            cmake -DUA_BUILD_EXAMPLES:BOOL=ON -G"Visual Studio 12 2013" ..
+            msbuild open62541.sln /m
+            cd ..
+            Remove-Item .\build -Force -Recurse
+            md build
+            cd build
+
+            echo "Testing MSVC with amalgamation (x86)"
+            cmake -DUA_BUILD_EXAMPLES:BOOL=ON -DUA_ENABLE_AMALGAMATION:BOOL=ON -G"Visual Studio 12 2013" ..
+            msbuild open62541.sln /m
+            copy C:\projects\open62541\build\open62541.c C:\projects\open62541\build\Debug\open62541.c
+            copy C:\projects\open62541\build\open62541.h C:\projects\open62541\build\Debug\open62541.h
+            copy C:\projects\open62541\build\examples\server_cert.der C:\projects\open62541\build\Debug\server_cert.der
+          }
+        }
+        echo "Build done"
 
 after_build:
-  - 7z a open62541-win32.zip %APPVEYOR_BUILD_FOLDER%\build\Debug\* %APPVEYOR_BUILD_FOLDER%\build\examples\Debug\*
-  - 7z a open62541-win64.zip %APPVEYOR_BUILD_FOLDER%\build64\Debug\* %APPVEYOR_BUILD_FOLDER%\build64\examples\Debug\*
-  - appveyor PushArtifact open62541-win32.zip
-  - appveyor PushArtifact open62541-win64.zip
+  - ps: |
+        if ($env:Compiler -eq "msvc") {
+          if ($env:Arch -eq "x64") {
+            7z a open62541-win64.zip C:\projects\open62541\build64\Debug\*
+            appveyor PushArtifact open62541-win64.zip
+          } else {
+            7z a open62541-win32.zip C:\projects\open62541\build\Debug\*
+            appveyor PushArtifact open62541-win32.zip
+          }
+        }

+ 5 - 0
tools/travis/travis_linux_before_install.sh

@@ -30,6 +30,11 @@ fi
 
 echo "=== The build environment is outdated ==="
 
+if [ -z ${LOCAL_PKG} ]; then
+	echo "ERROR: LOCAL_PKG variable is not defined. Aborting"
+	exit 1
+fi
+
 # Clean up
 rm -rf $LOCAL_PKG/*
 

+ 10 - 10
tools/travis/travis_linux_script.sh

@@ -6,8 +6,8 @@ if [ $ANALYZE = "true" ]; then
     if [ "$CC" = "clang" ]; then
         mkdir -p build
         cd build
-        scan-build cmake -G "Unix Makefiles" -DUA_BUILD_EXAMPLES=ON -DUA_BUILD_UNIT_TESTS=ON ..
-        scan-build -enable-checker security.FloatLoopCounter \
+        scan-build-3.7 cmake -G "Unix Makefiles" -DUA_BUILD_EXAMPLES=ON -DUA_BUILD_UNIT_TESTS=ON ..
+        scan-build-3.7 -enable-checker security.FloatLoopCounter \
           -enable-checker security.insecureAPI.UncheckedReturn \
           --status-bugs -v \
           make -j 8
@@ -15,8 +15,8 @@ if [ $ANALYZE = "true" ]; then
 
         mkdir -p build
         cd build
-        scan-build cmake -G "Unix Makefiles" -DUA_ENABLE_AMALGAMATION=ON ..
-        scan-build -enable-checker security.FloatLoopCounter \
+        scan-build-3.7 cmake -G "Unix Makefiles" -DUA_ENABLE_AMALGAMATION=ON ..
+        scan-build-3.7 -enable-checker security.FloatLoopCounter \
           -enable-checker security.insecureAPI.UncheckedReturn \
           --status-bugs -v \
           make -j 8
@@ -51,7 +51,7 @@ else
         echo "Cross compile release build for MinGW 32 bit"
         mkdir -p build && cd build
         cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw32.cmake -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLES=ON ..
-        make -j8
+        make -j
         zip -r open62541-win32.zip ../../doc ../../server_cert.der ../LICENSE ../AUTHORS ../README.md examples/server.exe examples/client.exe libopen62541.dll.a open62541.h open62541.c
         cp open62541-win32.zip ..
         cd .. && rm build -rf
@@ -59,7 +59,7 @@ else
         echo "Cross compile release build for MinGW 64 bit"
         mkdir -p build && cd build
         cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw64.cmake -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLES=ON ..
-        make -j8
+        make -j
         zip -r open62541-win64.zip ../../doc ../../server_cert.der ../LICENSE ../AUTHORS ../README.md examples/server.exe examples/client.exe libopen62541.dll.a open62541.h open62541.c
         cp open62541-win64.zip ..
         cd .. && rm build -rf
@@ -67,7 +67,7 @@ else
         echo "Cross compile release build for 32-bit linux"
         mkdir -p build && cd build
         cmake -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-gcc-m32.cmake -DUA_ENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DUA_BUILD_EXAMPLES=ON ..
-        make -j8
+        make -j
         tar -pczf open62541-linux32.tar.gz ../../doc ../../server_cert.der ../LICENSE ../AUTHORS ../README.md examples/server examples/client libopen62541.a open62541.h open62541.c
         cp open62541-linux32.tar.gz ..
         cd .. && rm build -rf
@@ -76,7 +76,7 @@ else
     echo "Compile release build for 64-bit linux"
     mkdir -p build && cd build
     cmake -DCMAKE_BUILD_TYPE=Release -DUA_ENABLE_AMALGAMATION=ON -DUA_BUILD_EXAMPLES=ON ..
-    make -j8
+    make -j
     tar -pczf open62541-linux64.tar.gz ../../doc ../../server_cert.der ../LICENSE ../AUTHORS ../README.md examples/server examples/client libopen62541.a open62541.h open62541.c
     cp open62541-linux64.tar.gz ..
     cp open62541.h .. # copy single file-release
@@ -111,12 +111,12 @@ else
     echo "Debug build and unit tests (64 bit)"
     mkdir -p build && cd build
     cmake -DCMAKE_BUILD_TYPE=Debug -DUA_BUILD_EXAMPLES=ON -DUA_BUILD_UNIT_TESTS=ON -DUA_ENABLE_COVERAGE=ON ..
-    make -j8 && make test ARGS="-V"
+    make -j && make test ARGS="-V"
     echo "Run valgrind to see if the server leaks memory (just starting up and closing..)"
     (valgrind --leak-check=yes --error-exitcode=3 ./examples/server & export pid=$!; sleep 2; kill -INT $pid; wait $pid);
     # only run coveralls on main repo, otherwise it fails uploading the files
     echo "-> Current repo: ${TRAVIS_REPO_SLUG}"
-    if ([ "$CC" = "gcc-4.8" ] || [ "$CC" = "gcc" ]) && [ "${TRAVIS_REPO_SLUG}" = "open62541/open62541" ]; then
+    if ([ "$CC" = "gcc-4.8" ] || [ "$CC" = "gcc" ]) && ([ "${TRAVIS_REPO_SLUG}" = "open62541/open62541" ] || [ "${TRAVIS_REPO_SLUG}" = "Pro/open62541" ]); then
         echo "  Building coveralls for ${TRAVIS_REPO_SLUG}"
         coveralls --gcov /usr/bin/gcov-4.8 -E '.*\.h' -E '.*CMakeCXXCompilerId\.cpp' -E '.*CMakeCCompilerId\.c' -r ../
     else