Skip to content

Commit

Permalink
Set up CI with Azure Pipelines (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-epifanoff authored Mar 15, 2022
1 parent 174149e commit 367b2a0
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 5 deletions.
94 changes: 94 additions & 0 deletions .ci/azure-build.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions .ci/hosts/osx/before_install.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions .ci/targets/rhosimulator_osx/pre_gem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .ci/targets/rhosimulator_osx/run_app_on_simulator.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
67 changes: 67 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion platform/shared/qt/RhoSimulator.pro
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ unix:!macx {
}
macx {
SUBDIRS += curl
QMAKE_MAC_SDK = macosx10.13
QMAKE_MAC_SDK = macosx11.1
}

win32{
Expand Down
2 changes: 2 additions & 0 deletions platform/shared/ruby/osx/ruby/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
//<<<
Expand Down

0 comments on commit 367b2a0

Please sign in to comment.