I'm trying to set up a basic BrowserStack sample App with Jenkins a Jenkinsfile for the Pipeline.
Reading the documentation of the BrowserStack plugin for Jenkins I came up with the following step:
// ...
stages {
stage('assemble') {
// Here the App gets assembled
}
stage('upload-to-browserstack'){
steps{
browserstack(credentialsId: '<credentials>'){
sh 'test -e app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk && echo exists || echo does not exist'
browserstackAppUploader('app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk'){
}
}
}
}
}
// ...
This results in the following error message:
[BrowserStack] Starting upload process.
[BrowserStack] Uploading app app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk to Browserstack.
[BrowserStack] [ERROR] File not found at app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk
[BrowserStack] ERROR : App Id empty. ABORTING!!!
I can see, that the file exists on my Jenkins instance. How can I upload the APK to the BrowserStack server or am I using a wrong syntax for this?
You can use any of the two scripts in your Jenkins build step in order to upload an app and use the hash ID from the response.
result="$(curl -u ":" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=#/Users/Downloads/BStackSampleApp_1.ipa" | jq -r '.app_url')"
result="$(curl -u ":" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=#/Users/Downloads/BStackSampleApp_1.ipa" | jq '.app_url' | tr -d \")"
You can then export the value of the result as the environment variable for the Jenkins configuration.
Related
I'm trying to setup CI on Gitlab. I've got a problem. Looks like runner is working well but each time I try to run pipeline it fails with following error :
Running with gitlab-runner 14.4.0 (4b9e985a)
on local-runner g_SbFiLZ
Resolving secrets
00:00
Preparing the "shell" executor
00:00
Using Shell executor...
Preparing environment
00:00
Running on GU33...
Getting source from Git repository
00:02
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in C:/Users/xxx/GitLab-Runner/builds/g_SbFiLZ/0/xxx/xxx/.git/
Checking out f4fb6ec9 as main...
git-lfs/2.11.0 (GitHub; windows amd64; go 1.14.2; git 48b28d97)
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:01
$ gem install bundler
gem : The term 'gem' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the s
pelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\WINDOWS\TEMP\build_script461193448\script.ps1:225 char:1
+ gem install bundler
+ ~~~
+ CategoryInfo : ObjectNotFound: (gem:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 1
I have Ruby installed and setup correctly. I can run gem commands locally. Runner is also set locally so I really dont understand the issue. Here's my gitlab-ci.yml :
stages:
- prepare
- build
- test
- ui-test
variables:
LC_ALL: "en_US.UTF-8"
LANG: "en_US.UTF-8"
.setup_bundler: &setup_bundler |
gem install bundler
bundle config
bundle install
.setup: &setup
- *setup_bundler
prepare_project:
stage: prepare
script:
*setup
cache:
key:
files:
- Gemfile.lock
paths:
- vendor
artifacts:
name: "Bundle_${CI_BUILD_NAME}_${CI_COMMIT_REF_NAME}_${CI_BUILD_ID}"
expire_in: 1 day
paths:
- vendor
when: always
when: on_success
tags:
- android
build:
stage: build
script:
- bundle exec fastlane build
dependencies:
- prepare_project
tags:
- android
test:
stage: test
script:
- bundle exec fastlane tests
dependencies:
- prepare_project
tags:
- android
ui-test:
stage: ui-test
script:
- bundle exec fastlane ui_tests
dependencies:
- prepare_project
tags:
- android
Any ideas, pelase ?
It's likely that when you're running gem to debug, you're running it with a different user than gitlab-runner, which is the default gitlab-runner user. Check the PATH setup of your gitlab-runner user, and ensure that gem is on the path.
I am configured "config.yml" file in Circle CI for Android, I need to deliver my APK to slack channel, all the things are configured as success, and build created successfully, but upload to slack does not work. Here is my config.yml code part for uploading
- run:
name: Upload to Slack
command: |
export GIT_COMMIT_DESC=$(git log --format=oneline -n 1 | sed -E 's/^[^ ]+
(.*)$/\1/g')
curl -F file=#app/build/outputs/apk/debug/empower_deposit-development.apk -F
channels=$SLACK_CHANNEL -F token=$SLACK_API_TOKEN -F title="${CIRCLE_PROJECT_REPONAME} |
branch -> ${CIRCLE_BRANCH} | commit -> ${GIT_COMMIT_DESC}"
https://slack.com/api/files.upload
Please help me for that.
Thanks
I am trying to build the Alexa auto sdk in Mac OS High Sierra. I am able to successfully build the docker environment required on Mac for the Alexa Auto SDK Builder. While installing the NDK I am getting the following error in terminal `
*******************
*** Docker Mode ***
*******************
NOTE: Run Docker image...
NOTE: SDK Version: 1.2.0
NOTE: Start building for androidarm...
NOTE: Android toolchains will be installed: /workdir/android
NOTE: Checking Android toolchain installation (armeabi-v7a/22)...
NOTE: Installing NDK (android-ndk-r16b)...
NOTE: Downloading file android-ndk-r16b-linux-x86_64.zip
--2018-10-31 05:39:02-- https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip
Resolving dl.google.com (dl.google.com)... 216.58.203.142, 2404:6800:4009:802::200e
Connecting to dl.google.com (dl.google.com)|216.58.203.142|:443... connected.
ERROR: cannot verify dl.google.com's certificate, issued by ‘CN=192.168.86.1’:
Self-signed certificate encountered.
To connect to dl.google.com insecurely, use `--no-check-certificate'.
ERROR: Android toolchain setup failed
I tried wget --no-check-certificate https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip `
and downloaded the NDK but the issue is still persisting. Please help as I am stuck.
We have downloaded Alexa-auto-SDK 1.6.
we used the following steps below. Please update docker, my case everything fine working.
mac$ ./builder/build.sh oe -t androidarm --android-api 26
*******************************************************************************
The scripts provided herein will retrieve several third-party libraries,
environments, and/or other software packages at build-time
("External Dependencies") from third-party sources. These are terms and
conditions that you need to agree to abide by if you choose to build the
External Dependencies. Licenses for the External Dependencies may be found at
builder/README.md. If you do not agree with every term and condition
associated with the External Dependencies, enter “QUIT” in the command line
when prompted by the script.
*******************************************************************************
Type "QUIT" to exit the script now, press ENTER to continue:
\e[1mNOTE\e[0m: Builder only runs within Docker with macOS host
\e[1mNOTE\e[0m: Switching to Docker mode...
*******************
*** Docker Mode ***
*******************
+++ dirname /Users/mac/MetroProject/Android1.5/alexa-auto-sdk/builder/scripts/run-docker.sh
++ cd /Users/mac/MetroProject/Android1.5/alexa-auto-sdk/builder/scripts
++ pwd
+ THISDIR=/Users/mac/MetroProject/Android1.5/alexa-auto-sdk/builder/scripts
+ source /Users/mac/MetroProject/Android1.5/alexa-auto-sdk/builder/scripts/common.sh
++ '[' -z /Users/mac/MetroProject/Android1.5/alexa-auto-sdk/builder ']'
+ VM_HOME=/home/builder
+ IMAGE_REVISION=20190128
+ IMAGE_NAME=aac/ubuntu-base:20190128
+ VOLUME_NAME=buildervolume
+ VOLUME_MOUNT_POINT=/workdir
+ [[ '' != \1 ]]
+ TTY=-t
+ EXTRA_OPTIONS=
+ '[' '!' -z ']'
++ docker images -q aac/ubuntu-base:20190128
+ [[ aad39b28847b == '' ]]
++ docker volume ls
++ grep buildervolume
+ [[ local buildervolume == '' ]]
+ note 'Run Docker image...'
+ echo -e '\e[1mNOTE\e[0m: Run Docker image...'
\e[1mNOTE\e[0m: Run Docker image...
+ execute_command aac/builder/build.sh oe -t androidarm --android-api 26
+ docker run -i -t --rm -v buildervolume:/workdir -v /Users/mac/MetroProject/Android1.5/alexa-auto-sdk/builder/..:/home/builder/aac -e ANDROID_TOOLCHAIN=/workdir/android -e AGL_SDK_BASE=/workdir/agl-sdk -e HOST_PWD=/Users/mac/MetroProject/Android1.5/alexa-auto-sdk -e HOST_SDK_HOME=/Users/mac/MetroProject/Android1.5/alexa-auto-sdk/builder/.. aac/ubuntu-base:20190128 aac/builder/build.sh oe -t androidarm --android-api 26
NOTE: SDK Version: 1.6.0-00002-gb9ee08f-dirty
NOTE: Start building for androidarm...
NOTE: Android toolchains will be installed: /workdir/android
NOTE: Checking Android toolchain installation (armeabi-v7a/26)...
NOTE: Using BUILD_DIR=/workdir/build
Welcome to Alexa Auto Builder!
.c;.
.lKx.
':loooooc' .:c' .c:. .;lkKOocc:. .;looooc,.
.:lc;;;:d00l. ,OKc cK0; 'coOKOocc:. .lOOd:;;cxOk:.
.oKk' ,OKc :0O; .dKx. .oKO; .l00:
.;:::;:dKk' ,OKc :0O; .dKx. ,kKo. 'kKd.
'dOxlc::lkKk' ,OKc :0O; .dKx. ,OKo. .xKd.
.dKk' .lKk' ,OKl. cKO; .dKx. .dKk' :00c
.oKOc...,lkKk' .xKOc'.';cxKO; .oKOl,,,. 'd0kc,..,lO0l.
.:dxxdol;:ol. 'lxkxdol;;lo' .:dxxdo' .;ldxxxxdc'
... ... ....
......
... .',,,;;cc:.
.',,.. .. 'c:.
..,::;,... ...,;;. 'c,
..,:ccc:;,''...... .....'',;:cc;,.. .:,
..',:ccllllcccc:::::::ccccllllc:;'.. ..
...',,;;::::::::;;;,'....
Loading cache: 100% |############################################| Time: 0:00:00
Loaded 1299 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
NOTE: Multiple providers are available for virtual/nativesdk-libintl (nativesdk-gettext, nativesdk-glibc)
Consider defining a PREFERRED_PROVIDER entry to match virtual/nativesdk-libintl
Build Configuration:
BB_VERSION = "1.36.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "ubuntu-16.04"
TARGET_SYS = "arm-linux-androideabi"
MACHINE = "androidarm"
DISTRO = "aac"
DISTRO_VERSION = "1.6.0"
TUNE_FEATURES = "arm armv7a vfp thumb callconvention-hard"
TARGET_FPU = "hard"
meta-aac-ubuntu = "1.6:b9ee08ff5e9a88e1554d1d90f3e368d92cd302cf"
meta = "HEAD:1b18cdf6b8bdb00ff5df165b9ac7bc2b10c87d57"
meta-aac
meta-aac-builder = "1.6:b9ee08ff5e9a88e1554d1d90f3e368d92cd302cf"
Initialising tasks: 100% |#######################################| Time: 0:00:03
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 553 tasks of which 417 didn't need to be rerun and all succeeded.
Thank you
I try to install Fastlane in a pre build step on Buddybuild.
My pre build script looks like this:
#!/bin/bash
if ! which fastlane >/dev/null; then
echo "Installing fastlane this may need sudo"
sudo gem install fastlane
else
echo "Updating fastlane this may need sudo"
sudo gem update fastlane
fi
I get the following error:
ERROR: Error installing fastlane:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 mkrf_conf.rb .
Building native extensions. This could take a while...
/usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError) .
/usr/bin/ruby2.1 extconf.rb .
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
How can I solve this?
Rest of the Log
Gem files will remain installed in /var/lib/gems/2.1.0/gems/unf-0.2.0.beta2/ext/gems/gems/unf_ext-0.0.7.4 for inspection.
Results logged to /var/lib/gems/2.1.0/gems/unf-0.2.0.beta2/ext/gems/extensions/x86_64-linux/2.1.0/unf_ext-0.0.7.4/gem_make.out
from /usr/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:38:in block in build
from /usr/lib/ruby/2.1.0/tempfile.rb:324:in 'open'
from /usr/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in 'build'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:161:in 'block (2 levels) in build_extension'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in 'chdir'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in 'block in build_extension'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in 'synchronize'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in 'block in build_extensions'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in 'each'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in 'build_extensions'
from /usr/lib/ruby/2.1.0/rubygems/installer.rb:677:in 'build_extensions'
from /usr/lib/ruby/2.1.0/rubygems/installer.rb:232:in 'install'
from /usr/lib/ruby/2.1.0/rubygems/resolver/specification.rb:78:in 'install'
from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:206:in 'block in install_into'
from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:198:in 'each'
from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:198:in 'install_into'
from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:119:in 'install'
from /usr/lib/ruby/2.1.0/rubygems/dependency_installer.rb:389:in 'install'
from mkrf_conf.rb:15:in ''
rake failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.1.0/gems/unf-0.2.0.beta2 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/unf-0.2.0.beta2/gem_make.out
Change your script to:
if ! which fastlane >/dev/null; then
echo "Installing fastlane..."
echo password | sudo -S gem install fastlane
else
echo "Updating fastlane..."
echo password | sudo -S gem update fastlane
fi
Our recommendation (and, as it turns out, fastlane's) is to use bundler and a Gemfile to achieve that. It lets you use a specific version of fastlane and, as a bonus, don't require sudo.
Let me know if this helps!
How do we generate reports in calabash android ? I looked in to "The cucumber recipe" book on how to generate report. But that didn't help me completely.
I want to generate report on why login failed :
For eg :
1) User enter valid credential and tries to Login
2) But, Login fails due to server_error/user_not_found or some exceptions . I get error xml/ statusCode from server when login fails.
How to generate report using that xml/status code in calabash ?
Please help !!
Use this command to execute your test:
calabash-android run <apkfile>.apk --format html --out reports.html
<%
date = Time.now.strftime('%m_%d-%H:%M:%S')
default_report = "./reports/output_#{date}.html"
default_rerun = "./rerun.txt"
%>
common: NO_STOP='1'
rerun_out: -f rerun -o <%= default_rerun %>
html_report: -f html -o <%= default_report %>
run: -p common -p rerun_out -p html_report
Here is my calabash-android profile config, you can put it in ./.config/cucumber.yml file under your calabash android project.
using the following command will export the test result into a rerun.txt file and a ./reports/output_#{date}.html file at the same time:
calabash-android run *.apk -p run
For HTML report
> calabash-android run <apkfile>.apk --format HTML --out
For JSON report
> calabash-android run <apkfile>.apk --format JSON --out
These are the otehr formats in cucumber,
Pretty
Progress
Usage
JUnit
Rerun
Read more from here: https://cucumber.io/docs/reference#reports
For HTML report use the following:
calabash-android run ${APKFile} -f html -o test-result.html