ソースを参照

ci(debian): Split debian build into separate build and move to azure pipeline

Stefan Profanter 5 年 前
コミット
8bcea80e8b

+ 61 - 0
.azure-pipelines/azure-pipelines-dist.yml

@@ -0,0 +1,61 @@
+# Docs see here:
+# https://aka.ms/yaml
+
+jobs:
+- job: 'dist_debian'
+  displayName: 'Dist (debian)'
+  pool:
+    vmImage: 'ubuntu-18.04'
+  steps:
+  - checkout: self
+    submodules: recursive
+
+  - task: Bash@3
+    inputs:
+      targetType: FilePath
+      filePath: ./tools/azure-devops/debian/install.sh
+      failOnStderr: false
+    displayName: Installing required packages
+
+  - task: Bash@3
+    inputs:
+      targetType: FilePath
+      filePath: ./tools/azure-devops/debian/build.sh
+      failOnStderr: false
+    displayName: Building & Testing
+
+  - task: PublishBuildArtifacts@1
+    inputs:
+      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
+      ArtifactName: libopen62541-debian
+      # publishing artifacts from PRs from a fork is currently blocked
+    condition: succeeded()
+    displayName: "Publish Artifact: open62541 Debian Packages"
+
+  # See https://github.com/microsoft/azure-pipelines-tasks/issues/11260#issuecomment-527343172
+  - bash: echo "##vso[task.setvariable variable=TAG]${BUILD_SOURCEBRANCH##refs/tags/}"
+    displayName: Set TAG variable for $(Build.SourceBranch)
+    condition: startswith(variables['Build.SourceBranch'], 'refs/tags/')
+  - task: GitHubRelease@0
+    # Only execute this task if a tags build
+    condition: startswith(variables['Build.SourceBranch'], 'refs/tags/')
+    inputs:
+      gitHubConnection: 'open62541-azure-bot'
+      repositoryName: '$(Build.Repository.Name)'
+      action: 'edit' # Options: create, edit, delete
+      target: '$(Build.SourceVersion)' # Required when action == Create || Action == Edit
+      tagSource: 'Git tag'
+      #tagPattern: # Optional
+      tag: $(TAG) # Required when action == Edit || Action == Delete || TagSource == Manual
+      #title: # Optional
+      #releaseNotesSource: 'file' # Optional. Options: file, input
+      #releaseNotesFile: # Optional
+      #releaseNotes: # Optional
+      assets: '$(Build.ArtifactStagingDirectory)/*' # Optional
+      assetUploadMode: 'replace' # Optional. Options: delete, replace
+      #isDraft: false # Optional
+      #isPreRelease: false # Optional
+      addChangeLog: false # Optional
+      #compareWith: 'lastFullRelease' # Required when addChangeLog == True. Options: lastFullRelease, lastRelease, lastReleaseByTag
+      #releaseTag: # Required when compareWith == LastReleaseByTag
+

+ 1 - 6
.travis.yml

@@ -22,7 +22,7 @@ matrix:
 #
 # gcc-4.8 (trusty) full host and cross build with tests:
 # doc, cert, cross-mingw32, cross-mingw64, cross-linux32, cross-raspi, linux64,
-# amalgamated, shared, multithread, encryption, discovery, json, test-ns0-full, test-ns0-minimal, debian-package
+# amalgamated, shared, multithread, encryption, discovery, json, test-ns0-full, test-ns0-minimal
     - os: linux
       compiler: gcc-4.8
       addons:
@@ -36,10 +36,7 @@ matrix:
             - gcc-mingw-w64-x86-64
             - binutils-mingw-w64-i686
             - g++-multilib
-            # debian packaging
             - cmake
-            - debhelper
-            - fakeroot
             # doc
             - python-sphinx
             - graphviz
@@ -53,7 +50,6 @@ matrix:
             - valgrind
       env:
         - MINGW=true
-        - DEBIAN=true
 #
 # gcc-8 full host build with tests:
 # doc, cert, linux64,
@@ -376,7 +372,6 @@ deploy:
     - open62541-raspberrypi.tar.gz
     - open62541.c
     - open62541.h
-    - open62541*.deb
   file_glob: true
   skip_cleanup: true
   on:

+ 10 - 0
azure-pipelines.yml

@@ -1,2 +1,12 @@
+
+trigger:
+ tags:
+   include:
+     - '*'
+ branches:
+   include:
+     - '*'
+
 jobs:
     - template: ./.azure-pipelines/azure-pipelines-win.yml
+    - template: ./.azure-pipelines/azure-pipelines-dist.yml

+ 21 - 0
tools/azure-devops/debian/build.sh

@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+set -e
+
+#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+#BASE_DIR="$( realpath "$DIR/../../../" )"
+
+echo -e "== Building the Debian package =="
+/usr/bin/python3 ./tools/prepare_packaging.py
+echo -e "--- New debian changelog content ---"
+echo "--------------------------------------"
+cat ./debian/changelog
+echo "--------------------------------------"
+#dpkg-buildpackage -b
+
+echo "Test file1" > ../libopen62541_dev.deb
+echo "Test file2" > ../libopen62541_tools.deb
+
+if [ $? -ne 0 ] ; then exit 1 ; fi
+
+echo "Copying .deb files to $BUILD_ARTIFACTSTAGINGDIRECTORY"
+cp ../libopen62541*.deb $BUILD_ARTIFACTSTAGINGDIRECTORY

+ 34 - 0
tools/azure-devops/debian/install.sh

@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+set -e
+
+sudo apt-get update
+sudo apt install -y \
+    check \
+    cmake \
+    debhelper \
+    fakeroot \
+    git \
+    graphviz \
+    latexmk \
+    libsubunit-dev \
+    python-sphinx \
+    python3-pip \
+    tar \
+    texlive-fonts-recommended \
+    texlive-generic-extra \
+    texlive-latex-extra \
+    wget
+
+wget https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.7.1.tar.gz
+tar xf mbedtls-2.7.1.tar.gz
+cd mbedtls-mbedtls-2.7.1
+cmake -DENABLE_TESTING=Off .
+make -j
+sudo make install
+
+pip install --user cpp-coveralls
+# Pin docutils to version smaller 0.15. Otherwise we run into https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839299
+pip install --user 'docutils<=0.14'
+pip install --user sphinx_rtd_theme
+pip install --user cpplint

+ 6 - 20
tools/travis/travis_linux_script.sh

@@ -436,26 +436,6 @@ if [ $? -ne 0 ] ; then exit 1 ; fi
 cd .. && rm build -rf
 echo -en 'travis_fold:end:script.build.unit_test_ns0_full\\r'
 
-if ! [ -z ${DEBIAN+x} ]; then
-    echo -e "\r\n== Building the Debian package =="  && echo -en 'travis_fold:start:script.build.debian\\r'
-    /usr/bin/$PYTHON ./tools/prepare_packaging.py
-    echo -e "\r\n --- New debian changelog content ---"
-    echo "--------------------------------------"
-    cat ./debian/changelog
-    echo "--------------------------------------"
-    # Create a backup copy. We need the clean debian directory for later packaging
-    cp -r debian debian_bak
-    dpkg-buildpackage -b
-    if [ $? -ne 0 ] ; then exit 1 ; fi
-    rm -rf debian
-    mv debian_bak debian
-    cp ../libopen62541*.deb .
-    # Copy for github release script
-    cp ../libopen62541*.deb ../..
-    echo -en 'travis_fold:end:script.build.debian\\r'
-fi
-
-
 if [ "$CC" != "tcc" ]; then
     echo -e "\r\n== Unit tests (minimal NS0) ==" && echo -en 'travis_fold:start:script.build.unit_test_ns0_minimal\\r'
     mkdir -p build && cd build
@@ -531,6 +511,12 @@ if [ "$CC" != "tcc" ]; then
 				# The submodules are directly copied
 				echo -e "\r\n== Pushing 'pack/${REAL_BRANCH}' branch =="  && echo -en 'travis_fold:start:script.build.pack-branch\\r'
 
+                /usr/bin/$PYTHON ./tools/prepare_packaging.py
+                echo -e "--- New debian changelog content ---"
+                echo "--------------------------------------"
+                cat ./debian/changelog
+                echo "--------------------------------------"
+
 				git checkout -b pack-tmp/${REAL_BRANCH}
 				cp -r deps/mdnsd deps/mdnsd_back
 				cp -r deps/ua-nodeset deps/ua-nodeset_back

+ 1 - 3
tools/travis/travis_push_release.sh

@@ -33,16 +33,14 @@ if [ ! -e "releases/$TAG.zip" ]; then
     cp ./../../README.md .
     cp ./../../LICENSE .
     cp ./../../AUTHORS .
-    cp ./../../libopen62541*.deb .
 
-    zip -r "$TAG.zip" open62541.c open62541.h open62541.pdf README.md LICENSE AUTHORS open62541*.deb
+    zip -r "$TAG.zip" open62541.c open62541.h open62541.pdf README.md LICENSE AUTHORS
     rm open62541.c
     rm open62541.h
     rm open62541.pdf
     rm README.md
     rm LICENSE
     rm AUTHORS
-    rm libopen62541*.deb
     git add "$TAG.zip"
 
     echo "$TAG.zip" | cat - raw.txt > temp && mv temp raw.txt