From 367b2a047478106e0a456ae7493c9b51e6301733 Mon Sep 17 00:00:00 2001 From: alex-epifanoff Date: Tue, 15 Mar 2022 14:04:53 +0300 Subject: [PATCH] Set up CI with Azure Pipelines (#1089) --- .ci/azure-build.sh | 94 +++++++++++++++++++ .ci/hosts/osx/before_install.sh | 10 ++ .ci/targets/rhosimulator_osx/pre_gem.sh | 7 +- .../rhosimulator_osx/run_app_on_simulator.sh | 2 +- README.md | 2 + azure-pipelines.yml | 67 +++++++++++++ platform/shared/qt/RhoSimulator.pro | 2 +- platform/shared/ruby/osx/ruby/config.h | 2 + 8 files changed, 181 insertions(+), 5 deletions(-) create mode 100755 .ci/azure-build.sh create mode 100755 .ci/hosts/osx/before_install.sh create mode 100644 azure-pipelines.yml diff --git a/.ci/azure-build.sh b/.ci/azure-build.sh new file mode 100755 index 00000000000..0197d9d2e60 --- /dev/null +++ b/.ci/azure-build.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +set -e +set -x + +uname -a + +#setup for host +$BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/hosts/$OS_NAME/before_install.sh +#source ~/.rvm/scripts/rvm +#rvm list +#setup for target +$BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/targets/$RHO_TARGET/before_install.sh +#install Ruby version specified in RHO_RUBY env var ( system Ruby by default ) +#$BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/check_cache_and_install_ruby.sh +#rvm use $RHO_RUBY +# run target-specific and host-specific install scripts ( for instance download and install NDK/SDK for Android targets) +$BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/hosts/$OS_NAME/install.sh +$BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/targets/$RHO_TARGET/install.sh + +# start building of Rhodes gem in a separate gemset +cd $BUILD_DIR +#rvm gemset create rhodes +#rvm gemset use rhodes + +bundle install +gem list + +#TODO: build RhoRuby executable for host platform +#- .ci/hosts/$TRAVIS_OS_NAME/build_rhoruby.sh + +# run target-specific and host-specific script before start of Rhodes gem build +$BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/hosts/$OS_NAME/pre_gem.sh +$BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/targets/$RHO_TARGET/pre_gem.sh + +# build Rhodes gem +$BUILD_DIR/lib/build/buildgem.rb + +# install Rhodes gem to clean gemset. All dependencies should be installed automatically +gem install --no-document ./rhodes-$(cat ./version).gem + +# check rhodes path is valid +#if [ "$(get-rhodes-info --rhodes-path)" != "$HOME/.rvm/gems/$RHO_RUBY@rhodes/gems/rhodes-$(cat ./version)" ] +#then +# echo "Unexpected path to Rhodes:" +# echo "$(get-rhodes-info --rhodes-path)" +# echo "Expected path:" +# echo "$HOME/.rvm/gems/$RHO_RUBY@rhodes/gems/rhodes-$(cat ./version)" +# exit 1 +#fi + +# run target-specific rhodes-setup command +$BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/targets/$RHO_TARGET/rho_setup.sh + +# clone and install rhoconnect-client gem +.ci/install_rhoconnect-client.sh + +# clone and install rhoconnect-client gem if required by matrix config +if [[ -n $RHO_TAU_EXTENSIONS ]]; then + .ci/install_rho-tau-extensions.sh; +fi + +# run target-specific script after all Rhodes build environment has been setup +$BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/targets/$RHO_TARGET/post_gem.sh + +gem list +cd $PIPELINE_WORKSPACE + +# generate few apps from scratch +rhodes app vanilla_rhodes_app +cd vanilla_rhodes_app +#- safe_run_target_script upgrade_package.sh here we build not only android aps +rhodes extension testext +cd .. +rhodes jsapp vanilla_rhodes_jsapp +rhodes nodejsapp vanilla_rhodes_nodejsapp + +# clone testable app if required by matrix config +if [[ -n $RHO_APP ]]; then + git clone $($BUILD_DIR/.ci/app_repo.rb) $PIPELINE_WORKSPACE/$RHO_APP; + cd $PIPELINE_WORKSPACE/$RHO_APP/$($BUILD_DIR/.ci/app_build_root.rb); +fi + +if [[ -z $SKIP_BUILD ]]; then + $BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/targets/$RHO_TARGET/build_artefact_for_deploy.sh; +fi + +# add this for copy builded artifacts to foder for ipload to S3 +$BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/targets/$RHO_TARGET/before_deploy.sh + +#TODO: change this to run specs in auto mode and collect results +if [[ -z $SKIP_TESTS ]]; then + $BUILD_DIR/.ci/safe_run.sh $BUILD_DIR/.ci/targets/$RHO_TARGET/$RHO_RUNNER_SCRIPT; +fi \ No newline at end of file diff --git a/.ci/hosts/osx/before_install.sh b/.ci/hosts/osx/before_install.sh new file mode 100755 index 00000000000..ce9828d0216 --- /dev/null +++ b/.ci/hosts/osx/before_install.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e +set -x + +#brew install gnupg2 +#gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB +#\curl -sSL https://get.rvm.io | bash -s stable +#source ~/.rvm/scripts/rvm +#rvm list diff --git a/.ci/targets/rhosimulator_osx/pre_gem.sh b/.ci/targets/rhosimulator_osx/pre_gem.sh index b2ba649dc3b..23f7103ec69 100755 --- a/.ci/targets/rhosimulator_osx/pre_gem.sh +++ b/.ci/targets/rhosimulator_osx/pre_gem.sh @@ -7,8 +7,8 @@ set -e echo Downloading Qt -wget -q https://s3.amazonaws.com/files.tau-platform.com/buildenv/Qt5.13.2_mini.tar.gz -O $HOME/Qt5.13.2.tar.gz -tar -xzf $HOME/Qt5.13.2.tar.gz -C $HOME/ +wget -q https://s3.amazonaws.com/files.tau-platform.com/buildenv/Qt5.15.2_mini.tar.gz -O $PIPELINE_WORKSPACE/Qt5.15.2.tar.gz +tar -xzf $PIPELINE_WORKSPACE/Qt5.15.2.tar.gz -C $PIPELINE_WORKSPACE/ echo Qt installed echo "Installing Rhoconnect client" @@ -22,7 +22,8 @@ echo "Building rhosim" cd $TRAVIS_BUILD_DIR #rm $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/RhoSimulator.app.zip rm -rf $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/* -rake build:osx:rhosimulator +env +rake build:osx:rhosimulator --trace cd $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/ zip -r -y RhoSimulator.app.zip RhoSimulator.app # rm -rf $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/RhoSimulator.app diff --git a/.ci/targets/rhosimulator_osx/run_app_on_simulator.sh b/.ci/targets/rhosimulator_osx/run_app_on_simulator.sh index 268bcb405c1..8f7d0fc3597 100755 --- a/.ci/targets/rhosimulator_osx/run_app_on_simulator.sh +++ b/.ci/targets/rhosimulator_osx/run_app_on_simulator.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -x -cd $HOME/vanilla_rhodes_app +cd $PIPELINE_WORKSPACE/vanilla_rhodes_app rake run:iphone:rhosimulator diff --git a/README.md b/README.md index 9a844a786fd..c9d0c4aa257 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://dev.azure.com/TauPlatform/rhodes/_apis/build/status/rhomobile.rhodes?branchName=master)](https://dev.azure.com/TauPlatform/rhodes/_build/latest?definitionId=1&branchName=master) + [![Build Status](https://travis-ci.org/rhomobile/rhodes.svg?branch=master)](https://travis-ci.org/rhomobile/rhodes) [![Build status](https://ci.appveyor.com/api/projects/status/4c1uqndnfau9c8hq/branch/master?svg=true)](https://ci.appveyor.com/project/alex-epifanoff/rhodes/branch/master) diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000000..daf988ad663 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,67 @@ +name: rhomobile + +variables: +- name: BUILD_DIR + value: $(Build.Repository.LocalPath) +- name: TRAVIS_BUILD_DIR + value: $(Build.Repository.LocalPath) +- name: OS_NAME + value: osx +- name: RHO_TARGET + value: rhosimulator_osx +- name: RHO_RUNNER_SCRIPT + value: run_app_on_simulator.sh +- name: RHO_RUBY + value: ruby-2.7.4 +- name: ruby_version + value: '2.7.4' +- name: BUILD_ARTEFACTS_DIR + value: $(Pipeline.Workspace)/build_artefacts +- name: RHO_APP + value: "" + +- name: QTDIR + value: $(Pipeline.Workspace)/Qt5.15.2/5.15.2/clang_64 + +- name: S3_JOB_DIR + value: "$(Build.SourceVersion)/${{ variables.OS_NAME }}" + +- name: S3_DEPLOY_DIR + value: "$(Build.Repository.Name)/$(Build.SourceBranchName)" + +trigger: + branches: + exclude: + - '*' + +stages: + - stage: build + jobs: + - job: build + pool: + vmImage: 'macOS-10.15' + steps: +# - task: Bash@3 +# inputs: +# targetType: 'inline' +# script: 'env | sort' + - task: UseRubyVersion@0 + inputs: + versionSpec: $(ruby_version) + - task: Bash@3 + inputs: + targetType: 'inline' + script: 'mkdir $BUILD_ARTEFACTS_DIR' + + - script: $BUILD_DIR/.ci/azure-build.sh + + - task: S3Upload@1 + inputs: + regionName: 'eu-central-1' + bucketName: 'tau-autobuilds' + sourceFolder: '$(BUILD_ARTEFACTS_DIR)' + globExpressions: '**' + targetFolder: $(S3_DEPLOY_DIR)/$(S3_JOB_DIR)-$(RHO_TARGET)-$(RHO_APP) + filesAcl: 'public-read' + logRequest: true + logResponse: true diff --git a/platform/shared/qt/RhoSimulator.pro b/platform/shared/qt/RhoSimulator.pro index 1e6704f8aac..38e857971f3 100644 --- a/platform/shared/qt/RhoSimulator.pro +++ b/platform/shared/qt/RhoSimulator.pro @@ -37,7 +37,7 @@ unix:!macx { } macx { SUBDIRS += curl - QMAKE_MAC_SDK = macosx10.13 + QMAKE_MAC_SDK = macosx11.1 } win32{ diff --git a/platform/shared/ruby/osx/ruby/config.h b/platform/shared/ruby/osx/ruby/config.h index b41eb2fc5c6..7b22e804773 100644 --- a/platform/shared/ruby/osx/ruby/config.h +++ b/platform/shared/ruby/osx/ruby/config.h @@ -70,6 +70,8 @@ #define HAVE_TYPE_STRUCT_SOCKADDR_STORAGE 1 #define HAVE_GAI_STRERROR 1 #define HAVE_INET_PTON 1 +#define HAVE_INET_NTOP 1 +#define HAVE_ARPA_INET_H 1 #define HAVE_TYPE_STRUCT_IP_MREQ 1 //<<<