diff --git a/CI/travis/ci-linux.sh b/CI/travis/ci-linux.sh new file mode 100644 index 0000000..d2866a0 --- /dev/null +++ b/CI/travis/ci-linux.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +set -x + +handle_centos() { + local package=$1 + yum -y install yum-utils gcc + yum config-manager --set-enabled powertools + yum localinstall -y $package + export CMAKE_OPTIONS="-DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON .." + export LD_LIBRARY_PATH=/usr/local/lib64/ +} + +handle_default() { + local package=$1 + DEBIAN_FRONTEND=noninteractive apt-get install -y rpm + sudo dpkg -i $package + export CMAKE_OPTIONS="-DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON -DDEB_DETECT_DEPENDENCIES=ON .." +} + +handle_opensuse() { + local package=$1 + zypper in -y --allow-unsigned-rpm $package + export CMAKE_OPTIONS="-DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON .." +} + +handle_"$1" "$2" + +python3 -m pip install pylibiio --no-binary :all: +# Build project +mkdir -p build +cd build +cmake $CMAKE_OPTIONS +sudo make && sudo make package && make test +sudo make install +ldconfig +cd .. +cd bindings/python +pip install -r requirements_dev.txt +python3 -m pip install pytest +python3 -m pytest -vs --skip-scan diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 13d2bf7..51f29e8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -35,22 +35,64 @@ pr: jobs: - job: LinuxBuilds + pool: + vmImage: 'ubuntu-latest' strategy: matrix: + ubuntu_18_04_x86_64: + image: 'tfcollins/libiio_ubuntu_18_04-ci:latest' + artifactName: 'Linux-Ubuntu-18.04' + build_script: ci-linux.sh + OS_TYPE: default + PACKAGE_TO_INSTALL: '/ci/build/*.deb' ubuntu_20_04_x86_64: image: 'tfcollins/libiio_ubuntu_20_04-ci:latest' artifactName: 'Linux-Ubuntu-20.04' - build_script: ci-debian.sh + build_script: ci-linux.sh + OS_TYPE: default + PACKAGE_TO_INSTALL: '/ci/build/*.deb' ubuntu_22_04_x86_64: image: 'tfcollins/libiio_ubuntu_22_04-ci:latest' artifactName: 'Linux-Ubuntu-22.04' - build_script: ci-debian.sh + build_script: ci-linux.sh + OS_TYPE: default + PACKAGE_TO_INSTALL: '/ci/build/*.deb' debian_bullseye: image: 'tfcollins/libiio_debian_bullseye-ci:latest' artifactName: 'Linux-Debian-11' - build_script: ci-debian.sh - pool: - vmImage: 'ubuntu-latest' + build_script: ci-linux.sh + OS_TYPE: default + PACKAGE_TO_INSTALL: '/ci/build/*.deb' + debian_bookworm: + image: 'tfcollins/libiio_debian_bookworm-ci:latest' + artifactName: 'Linux-Debian-12' + build_script: ci-linux.sh + OS_TYPE: default + PACKAGE_TO_INSTALL: '/ci/build/*.deb' + centos_7: + image: 'tfcollins/libiio_centos_7-ci:latest' + artifactName: 'Linux-CentOS-7' + build_script: ci-linux.sh + OS_TYPE: centos + PACKAGE_TO_INSTALL: '/ci/build/*.rpm' + fedora28: + image: 'tfcollins/libiio_fedora_28-ci:latest' + artifactName: 'Linux-Fedora-28' + build_script: ci-linux.sh + OS_TYPE: centos + PACKAGE_TO_INSTALL: '/ci/build/*.rpm' + fedora34: + image: 'tfcollins/libiio_fedora_34-ci:latest' + artifactName: 'Linux-Fedora-34' + build_script: ci-linux.sh + OS_TYPE: centos + PACKAGE_TO_INSTALL: '/ci/build/*.rpm' + opensuse_15_4: + image: 'tfcollins/libiio_opensuse_15_4-ci:latest' + artifactName: 'Linux-openSUSE-15.4' + build_script: ci-linux.sh + OS_TYPE: opensuse + PACKAGE_TO_INSTALL: '/ci/build/*.rpm' steps: - checkout: self fetchDepth: 1 @@ -66,7 +108,7 @@ jobs: path: '$(Agent.BuildDirectory)/s/build/' - script: | set -e - sudo docker run --rm -t --privileged -e ARTIFACTNAME=$(artifactName) -v "$(Agent.BuildDirectory)/s":"/ci" "$(image)" /bin/bash -c "cd /ci/ && chmod +x ./CI/travis/$(build_script) && ./CI/travis/$(build_script)" + sudo docker run --rm -t --privileged -e ARTIFACTNAME=$(artifactName) -v "$(Agent.BuildDirectory)/s":"/ci" "$(image)" /bin/bash -c "cd /ci/ && chmod +x ./CI/travis/$(build_script) && ./CI/travis/$(build_script) $(OS_TYPE) $(PACKAGE_TO_INSTALL)" displayName: "Build" - task: CopyFiles@2 inputs: @@ -91,7 +133,7 @@ jobs: artifactFeed: libad9361-iio pythonUploadServiceConnection: PyPi - task: TwineAuthenticate@1 - condition: and(succeeded(), variables.isMain, eq(variables['artifactName'], 'Linux-Ubuntu-20.04')) + condition: and(succeeded(), eq(variables.isMain, true), eq(variables['artifactName'], 'Linux-Ubuntu-20.04')) displayName: Twine Authenticate inputs: artifactFeed: test-libad9361-iio @@ -111,12 +153,12 @@ jobs: ls -al cd dist ls -al - condition: and(succeeded(), variables.isMain, eq(variables['artifactName'], 'Linux-Ubuntu-20.04')) + condition: and(succeeded(), eq(variables.isMain, true), eq(variables['artifactName'], 'Linux-Ubuntu-20.04')) displayName: "Update to dev version" - script: | cd /home/vsts/work/1/s/build/bindings/python sudo python -m twine upload --repository-url https://test.pypi.org/legacy/ -u $(USERNAME) -p $(PASSWORD) --skip-existing --config-file $(PYPIRC_PATH) dist/*.whl - condition: and(succeeded(), variables.isMain, eq(variables['artifactName'], 'Linux-Ubuntu-20.04')) + condition: and(succeeded(), eq(variables.isMain, true), eq(variables['artifactName'], 'Linux-Ubuntu-20.04')) displayName: "Deploy python test package" - job: ARMBuilds