diff --git a/CI/ubuntu/install_deps b/CI/ubuntu/install_deps index c6bbb340..b93cf712 100755 --- a/CI/ubuntu/install_deps +++ b/CI/ubuntu/install_deps @@ -5,7 +5,9 @@ LIBIIO_VERSION=libiio-v0 set -x -handle_default() { +install_deps() { + echo "# INSTALLING DEPENDENCIES" + sudo apt-get -qq update echo "libm2k packages" sudo DEBIAN_FRONTEND=noninteractive apt-get install -y cmake doxygen graphviz \ @@ -15,13 +17,17 @@ handle_default() { debhelper devscripts fakeroot libserialport-dev swig dh-python # libiio dependencies + echo "libiio packages" sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \ libxml2-dev bison flex libcdk5-dev cmake \ libaio-dev libusb-1.0-0-dev \ - libserialport-dev libavahi-client-dev man2html - + libserialport-dev libavahi-client-dev man2html \ + python3-sphinx +} + +install_glog() { + echo "## Building glog" - #Install glog cd ${TOP_DIR} git clone --branch v0.4.0 --depth 1 https://github.com/google/glog mkdir -p glog/build_0_4_0 && cd glog/build_0_4_0 @@ -29,18 +35,28 @@ handle_default() { make sudo make install sudo pip3 install --upgrade pip stdeb argparse +} - # Install libiio - echo "Building libiio - version $LIBIIO_VERSION" +install_libiio() { + echo "## Building libiio - version $LIBIIO_VERSION" cd ${TOP_DIR} git clone https://github.com/analogdevicesinc/libiio.git -b $LIBIIO_VERSION libiio mkdir ./libiio/build && cd ./libiio/build - cmake ../ -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=OFF -DWITH_DOC=ON -DWITH_MAN=ON -DWITH_USB_BACKEND=OFF -DWITH_IIOD_USBD=OFF -DWITH_LOCAL_MMAP_API=OFF + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_SERIAL_BACKEND=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} make make package sudo apt install ./libiio-*.deb - # sudo make install +} + +handle_default() { + install_deps + install_glog + install_libiio +} + +handle_ubuntu_docker() { + handle_default } handle_doxygen() { @@ -71,8 +87,4 @@ handle_doxygen() { sudo pip3 install --upgrade sphinx_rtd_theme } -handle_ubuntu_docker() { - handle_default -} - handle_${OS_TYPE} diff --git a/CI/ubuntu/make_linux b/CI/ubuntu/make_linux index f5daf76e..fa7e27b6 100755 --- a/CI/ubuntu/make_linux +++ b/CI/ubuntu/make_linux @@ -9,7 +9,7 @@ handle_default() { cd build #create deb for bindings - cmake -DENABLE_PYTHON=ON -DENABLE_TOOLS=ON -DENABLE_CSHARP=OFF -DENABLE_LOG=ON -DBUILD_EXAMPLES=ON .. && make + cmake -DENABLE_PYTHON=ON -DENABLE_TOOLS=ON -DENABLE_CSHARP=OFF -DENABLE_LOG=OFF -DBUILD_EXAMPLES=ON .. && make sudo python3 setup.py --command-packages=stdeb.command sdist_dsc cd "$(find . -type d -name "debian" | head -n 1)" sudo env DEB_BUILD_OPTIONS=nocheck debuild -us -uc @@ -20,7 +20,7 @@ handle_default() { ls #create simple .deb without Python bindings - cmake -DENABLE_PACKAGING=ON -DDEB_DETECT_DEPENDENCIES=ON -DENABLE_PYTHON=OFF -DENABLE_CSHARP=ON -DENABLE_TOOLS=ON -DENABLE_LOG=ON -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_EXAMPLES=ON .. + cmake -DENABLE_PACKAGING=ON -DDEB_DETECT_DEPENDENCIES=ON -DENABLE_PYTHON=OFF -DENABLE_CSHARP=ON -DENABLE_TOOLS=ON -DENABLE_LOG=OFF -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_EXAMPLES=ON .. make && make package ls } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0f7aca2c..3ced5c08 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -31,7 +31,7 @@ parameters: - 3.9 - 3.8 - 3.7 - +# TODO: Fix conditions to export artifacts after validating current pipelines jobs: - job: LinuxBuilds strategy: @@ -60,67 +60,17 @@ jobs: persistCredentials: true - script: ./CI/ubuntu/install_deps displayName: "Install Dependencies" - - script: ./CI/ubuntu/make_linux - displayName: "Build" - task: CopyFiles@2 condition: ne(variables['System.JobName'], 'deploy_doxygen') inputs: - sourceFolder: '$(Agent.BuildDirectory)/s/build/' - contents: '$(Agent.BuildDirectory)/s/build/?(*.deb|*.rpm)' + sourceFolder: '$(Agent.BuildDirectory)/s/libiio/build/' + contents: '$(Agent.BuildDirectory)/s/libiio/build/?(*.deb)' targetFolder: '$(Build.ArtifactStagingDirectory)' - - task: PublishPipelineArtifact@1 - # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne(variables['System.JobName'], 'deploy_doxygen')) - condition: and(succeeded(), ne(variables['System.JobName'], 'deploy_doxygen')) - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)' - artifactName: '$(artifactName)' - -- job: macOSBuilds - workspace: - clean: all - strategy: - matrix: - macOS_11: - poolName: 'Azure Pipelines' - vmImage: 'macOS-11' - agentName: 'Azure Pipelines 4' - artifactName: 'macOS-11' - macOS_12: - poolName: 'Azure Pipelines' - vmImage: 'macOS-12' - agentName: 'Azure Pipelines 3' - artifactName: 'macOS-12' - macOS_13_x64: - poolName: 'Azure Pipelines' - vmImage: 'macOS-13' - agentName: 'Azure Pipelines 2' - artifactName: 'macOS-13-x64' - # TODO: discuss with DevOps team how to setup ARM agent - # macOS_13_arm64: - # poolName: 'Default' - # vmImage: - # agentName: 'macOS_arm64' - # artifactName: 'macOS-13-arm64' - pool: - name: $(poolName) - vmImage: $(vmImage) - demands: - - agent.name -equals $(agentName) - steps: - - checkout: self - fetchDepth: 1 - clean: true - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.11' - addToPath: true - - script: ./CI/macOS/install_deps - displayName: "Install Dependencies" - condition: ne(variables['agentName'],'macOS_arm64') - - script: ./CI/macOS/make_macOS + - script: ./CI/ubuntu/make_linux displayName: "Build" - ${{ each pyVersion in parameters.pythonVersions }}: - task: UsePythonVersion@0 + condition: and(ne(variables['System.JobName'], 'deploy_doxygen'), eq('${{ pyVersion }}', '3.11')) displayName: Use Python ${{ pyVersion }} inputs: versionSpec: '${{ pyVersion }}' @@ -134,120 +84,199 @@ jobs: export COMPILE_BINDINGS= cp dist/*.whl wheelhouse displayName: Wheel Python ${{ pyVersion }} + condition: and(ne(variables['System.JobName'], 'deploy_doxygen'), eq('${{ pyVersion }}', '3.11')) + - task: CopyFiles@2 + condition: ne(variables['System.JobName'], 'deploy_doxygen') + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/build/' + contents: '$(Agent.BuildDirectory)/s/build/wheelhouse/?(*.whl)' + targetFolder: '$(Build.ArtifactStagingDirectory)' - task: CopyFiles@2 + condition: ne(variables['System.JobName'], 'deploy_doxygen') inputs: sourceFolder: '$(Agent.BuildDirectory)/s/build/' - contents: '$(Agent.BuildDirectory)/s/build/?(*.pkg)' - targetFolder: '$(Build.ArtifactStagingDirectory)' - - task: CopyFiles@2 - inputs: - sourceFolder: '$(Agent.BuildDirectory)/s/build/' - contents: '$(Agent.BuildDirectory)/s/build/wheelhouse/?(*.whl)' - targetFolder: '$(Build.ArtifactStagingDirectory)' - - task: CopyFiles@2 - inputs: - sourceFolder: '$(Agent.BuildDirectory)/s/build_tar/' - contents: '$(Agent.BuildDirectory)/s/build_tar/?(*.tar.gz)' + contents: '$(Agent.BuildDirectory)/s/build/?(libm2k*.deb|libm2k*.rpm)' targetFolder: '$(Build.ArtifactStagingDirectory)' - task: PublishPipelineArtifact@1 - # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - condition: succeeded() + # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne(variables['System.JobName'], 'deploy_doxygen')) + condition: and(succeeded(), ne(variables['System.JobName'], 'deploy_doxygen')) inputs: targetPath: '$(Build.ArtifactStagingDirectory)' artifactName: '$(artifactName)' - - script: | - python -m pip install --upgrade pip twine - cd '$(Agent.BuildDirectory)/s/build/wheelhouse/' - python -m twine upload --repository "testpypi" *.whl - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - displayName: "Upload to PyPI" - env: - TWINE_USERNAME: '__token__' - TWINE_PASSWORD: $(TWINE_PASSWORD) -- job: WindowsBuilds - workspace: - clean: all - strategy: - matrix: - VS_2022: - poolName: 'Azure Pipelines' - vmImage: 'windows-2022' - COMPILER: 'Visual Studio 17 2022' - ARCH: 'x64' - PLATFORM: 'win64' - artifactName: 'Windows-VS-2022-x64' - VS_2019: - poolName: 'Azure Pipelines' - vmImage: 'windows-2019' - COMPILER: 'Visual Studio 16 2019' - ARCH: 'x64' - PLATFORM: 'win64' - artifactName: 'Windows-VS-2019-x64' - pool: - vmImage: $[ variables['vmImage'] ] - steps: - - checkout: self - fetchDepth: 1 - clean: true - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.11' - - task: PowerShell@2 - displayName: 'Install Dependencies' - inputs: - targetType: filePath - filePath: ./CI/windows/install_deps.ps1 - - task: PowerShell@2 - displayName: "Build libm2k" - inputs: - targetType: 'filePath' - filePath: ./CI/windows/make_windows.ps1 - - ${{ each pyVersion in parameters.pythonVersions }}: - - task: UsePythonVersion@0 - displayName: Use Python ${{ pyVersion }} - inputs: - versionSpec: '${{ pyVersion }}' - - powershell: | - $SRC_DIR = Get-Item -Path $env:BUILD_SOURCESDIRECTORY - $OUTSIDE_BUILD = $SRC_DIR.Parent.FullName +# - job: macOSBuilds +# workspace: +# clean: all +# strategy: +# matrix: +# macOS_11: +# poolName: 'Azure Pipelines' +# vmImage: 'macOS-11' +# agentName: 'Azure Pipelines 4' +# artifactName: 'macOS-11' +# macOS_12: +# poolName: 'Azure Pipelines' +# vmImage: 'macOS-12' +# agentName: 'Azure Pipelines 3' +# artifactName: 'macOS-12' +# macOS_13_x64: +# poolName: 'Azure Pipelines' +# vmImage: 'macOS-13' +# agentName: 'Azure Pipelines 2' +# artifactName: 'macOS-13-x64' +# # TODO: discuss with DevOps team how to setup ARM agent +# # macOS_13_arm64: +# # poolName: 'Default' +# # vmImage: +# # agentName: 'macOS_arm64' +# # artifactName: 'macOS-13-arm64' +# pool: +# name: $(poolName) +# vmImage: $(vmImage) +# demands: +# - agent.name -equals $(agentName) +# steps: +# - checkout: self +# fetchDepth: 1 +# clean: true +# - task: UsePythonVersion@0 +# inputs: +# versionSpec: '3.11' +# addToPath: true +# - script: ./CI/macOS/install_deps +# displayName: "Install Dependencies" +# condition: ne(variables['agentName'],'macOS_arm64') +# - script: ./CI/macOS/make_macOS +# displayName: "Build" +# - ${{ each pyVersion in parameters.pythonVersions }}: +# - task: UsePythonVersion@0 +# displayName: Use Python ${{ pyVersion }} +# inputs: +# versionSpec: '${{ pyVersion }}' +# - script: | +# python3 --version +# python3 -m pip install wheel twine build virtualenv +# cd '$(Agent.BuildDirectory)/s/build/' +# mkdir -p wheelhouse +# export COMPILE_BINDINGS=True +# python3 -m build +# export COMPILE_BINDINGS= +# cp dist/*.whl wheelhouse +# displayName: Wheel Python ${{ pyVersion }} +# - task: CopyFiles@2 +# inputs: +# sourceFolder: '$(Agent.BuildDirectory)/s/build/' +# contents: '$(Agent.BuildDirectory)/s/build/?(*.pkg)' +# targetFolder: '$(Build.ArtifactStagingDirectory)' +# - task: CopyFiles@2 +# inputs: +# sourceFolder: '$(Agent.BuildDirectory)/s/build/' +# contents: '$(Agent.BuildDirectory)/s/build/wheelhouse/?(*.whl)' +# targetFolder: '$(Build.ArtifactStagingDirectory)' +# - task: CopyFiles@2 +# inputs: +# sourceFolder: '$(Agent.BuildDirectory)/s/build_tar/' +# contents: '$(Agent.BuildDirectory)/s/build_tar/?(*.tar.gz)' +# targetFolder: '$(Build.ArtifactStagingDirectory)' +# - task: PublishPipelineArtifact@1 +# # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) +# condition: succeeded() +# inputs: +# targetPath: '$(Build.ArtifactStagingDirectory)' +# artifactName: '$(artifactName)' +# - script: | +# python -m pip install --upgrade pip twine +# cd '$(Agent.BuildDirectory)/s/build/wheelhouse/' +# python -m twine upload --repository "testpypi" *.whl +# condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) +# displayName: "Upload to PyPI" +# env: +# TWINE_USERNAME: '__token__' +# TWINE_PASSWORD: $(TWINE_PASSWORD) - $BUILD_DIR = Join-Path $OUTSIDE_BUILD "libm2k-$env:PLATFORM" - $TEMP_BUILD_DIR = Join-Path $SRC_DIR "tmp-build-$env:PLATFORM" +# - job: WindowsBuilds +# workspace: +# clean: all +# strategy: +# matrix: +# VS_2022: +# poolName: 'Azure Pipelines' +# vmImage: 'windows-2022' +# COMPILER: 'Visual Studio 17 2022' +# ARCH: 'x64' +# PLATFORM: 'win64' +# artifactName: 'Windows-VS-2022-x64' +# VS_2019: +# poolName: 'Azure Pipelines' +# vmImage: 'windows-2019' +# COMPILER: 'Visual Studio 16 2019' +# ARCH: 'x64' +# PLATFORM: 'win64' +# artifactName: 'Windows-VS-2019-x64' +# pool: +# vmImage: $[ variables['vmImage'] ] +# steps: +# - checkout: self +# fetchDepth: 1 +# clean: true +# - task: UsePythonVersion@0 +# inputs: +# versionSpec: '3.11' +# - task: PowerShell@2 +# displayName: 'Install Dependencies' +# inputs: +# targetType: filePath +# filePath: ./CI/windows/install_deps.ps1 +# - task: PowerShell@2 +# displayName: "Build libm2k" +# inputs: +# targetType: 'filePath' +# filePath: ./CI/windows/make_windows.ps1 +# - ${{ each pyVersion in parameters.pythonVersions }}: +# - task: UsePythonVersion@0 +# displayName: Use Python ${{ pyVersion }} +# inputs: +# versionSpec: '${{ pyVersion }}' +# - powershell: | +# $SRC_DIR = Get-Item -Path $env:BUILD_SOURCESDIRECTORY +# $OUTSIDE_BUILD = $SRC_DIR.Parent.FullName - Set-Location $TEMP_BUILD_DIR - python.exe -m pip install --user --upgrade pip setuptools wheel twine build virtualenv - $env:COMPILE_BINDINGS = $true - python.exe -m build - Remove-Item Env:COMPILE_BINDINGS - Copy-Item -Path "dist/libm2k*.whl" -Destination (Join-Path $BUILD_DIR "dist") - Set-Location $SRC_DIR - displayName: Wheel Python ${{ pyVersion }} - condition: eq('${{ pyVersion }}', '3.11') # TODO: to be removed in final version - - task: PowerShell@2 - displayName: 'Create libm2k-system-setup installer' - # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.JobName'], 'VS_2022')) - condition: and(succeeded(), eq(variables['System.JobName'], 'VS_2022')) - inputs: - targetType: 'filePath' - filePath: ./CI/windows/create_installer.ps1 - - task: PublishPipelineArtifact@1 - # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.JobName'], 'VS_2022')) - condition: and(succeeded(), eq(variables['System.JobName'], 'VS_2022')) - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)/installer' - artifactName: 'Libm2k-System-Setup-Exe' - - task: PowerShell@2 - displayName: "Create ZIPs" - inputs: - targetType: 'filePath' - filePath: ./CI/windows/create_zips.ps1 - - task: PublishPipelineArtifact@1 - # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - condition: succeeded() - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)/libm2k-$(PLATFORM)' - artifactName: '$(artifactName)' +# $BUILD_DIR = Join-Path $OUTSIDE_BUILD "libm2k-$env:PLATFORM" +# $TEMP_BUILD_DIR = Join-Path $SRC_DIR "tmp-build-$env:PLATFORM" + +# Set-Location $TEMP_BUILD_DIR +# python.exe -m pip install --user --upgrade pip setuptools wheel twine build virtualenv +# $env:COMPILE_BINDINGS = $true +# python.exe -m build +# Remove-Item Env:COMPILE_BINDINGS +# Copy-Item -Path "dist/libm2k*.whl" -Destination (Join-Path $BUILD_DIR "dist") +# Set-Location $SRC_DIR +# displayName: Wheel Python ${{ pyVersion }} +# condition: eq('${{ pyVersion }}', '3.11') # TODO: to be removed in final version +# - task: PowerShell@2 +# displayName: 'Create libm2k-system-setup installer' +# # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.JobName'], 'VS_2022')) +# condition: and(succeeded(), eq(variables['System.JobName'], 'VS_2022')) +# inputs: +# targetType: 'filePath' +# filePath: ./CI/windows/create_installer.ps1 +# - task: PublishPipelineArtifact@1 +# # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.JobName'], 'VS_2022')) +# condition: and(succeeded(), eq(variables['System.JobName'], 'VS_2022')) +# inputs: +# targetPath: '$(Build.ArtifactStagingDirectory)/installer' +# artifactName: 'Libm2k-System-Setup-Exe' +# - task: PowerShell@2 +# displayName: "Create ZIPs" +# inputs: +# targetType: 'filePath' +# filePath: ./CI/windows/create_zips.ps1 +# - task: PublishPipelineArtifact@1 +# # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) +# condition: succeeded() +# inputs: +# targetPath: '$(Build.ArtifactStagingDirectory)/libm2k-$(PLATFORM)' +# artifactName: '$(artifactName)'