How to determine the configuration during a AppVeyor/Travis CI build? - travis-ci

How to determine the configuration during a AppVeyor/Travis CI build?
I build my project for release and debug and on each build I would like to run my test.exe which will be in the Release folder for release build and Debug folder for debug build
Both of these attempts dont work.
It would be great to just be able to refer to the location where the build product is placed.
AppVeyor.yml
test_script:
- cd Build
- cd $env:CONFIGURATION
- UtilsTests.exe
Travis.yml
matrix:
include:
- os: osx
osx_image: xcode8.3
compiler: clang
script:
- brew update
- cmake . -G Xcode
- xcodebuild
- ./UtilsTests

Correct cd command should be:
- cd %CONFIGURATION%

Related

Travis CI not using master branch cache

I'm using Carthage as my project package manager and Travis CI.
The problem that I'm facing is that yesterday, Travis did create a cache from master branch correctly, as you can see in the picture below, and everything was working fine.
But today, when I did switch to another branch and pushed changes to it, Travis is not fetching the cache that it has made from master branch. Instead, it's creating a new cache for this branch that I've created. I want it to use master cache always, and don't try to create a cache for each branch that I create from master.
How should I proceed to achieve that?
Source Files:
.travis.yml
#Xcode 9.4 image default contents: https://blog.travis-ci.com/2018-07-19-xcode9-4-default-announce
#Need to create: "if: branch = master" and "if: branch = development"
language: swift
os: osx
osx_image: xcode10
sudo: required
cache:
directories:
- Carthage
before_install:
# Update Homebrew
- brew update
# Clean install Carthage
- brew uninstall --force carthage
- brew install carthage
- brew cask install fastlane
# Provide travis machines with github access
- echo -e "machine github.com\n login $CI_USER_TOKEN" >> ~/.netrc
# Print script to avoid travis_wait from stopping build process
- while sleep 480m; do echo "=====[ $SECONDS seconds, Carthage still building... ]====="; done &
# Carthage Bootstrap
- carthage bootstrap --cache-builds --platform ios,watchos --no-use-binaries
# Stop Print script
- kill %1
script:
- fastlane beta

TravisCI - ERR : Package flute_music_player requires Flutter SDK version ^0.1.2 but the current SDK is 0.0.0-unknown

I am new travis and started working on it with flutter.
I am using flute_music_player plugin for my music player app.
Now app is working/building fine locally on my machine but I cant build it on Travis
Here is what I get
$ ./flutter/bin/flutter test
Running "flutter packages get" in tumultus...
Package flute_music_player requires Flutter SDK version ^0.1.2 but the current SDK is 0.0.0-unknown.
---- Log transcript ----
.
.
.
.
---- End log transcript ----
pub get failed (1)
The command "./flutter/bin/flutter test" exited with 1.
store build cache
nothing changed, not updating cache
Done. Your build exited with 1.
Here is the link to my complete Job log.
And my travis.yml is :
os:
- linux
sudo: false
addons:
apt:
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
sources:
- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
packages:
- libstdc++6
- fonts-droid
before_script:
- git clone https://github.com/flutter/flutter.git -b alpha --depth 1
- ./flutter/bin/flutter doctor
script:
- ./flutter/bin/flutter test
cache:
directories:
- $HOME/.pub-cache
My complete project can be found on github here
Actually I have copied most of the code from here and I tried to run his project on travis but same error on log.
Is there anywhere I am lacking, please help.
Thanks for any help or suggestions in advance.
Alright the Issue was with plugin version not actually Travis.

xcodebuild: error: 'APP.xcworkspace' does not exist

I am trying to set up CI with gitlab. When I try to build locally, I get this error : xcodebuild: error: 'APP.xcworkspace' does not exist.
"APP" not being the real name. I am also using CocoaPods.
This happens after I run this command in terminal:
gitlab-ci-multi-runner exec shell build_project
I have checked and the file does exist in the same folder I call the command.
This is my .gitlab-ci.yml file:
stages:
- build
build_project:
stage: build
script:
- xcodebuild clean -workspace APP.xcworkspace -scheme APP | xcpretty
- xcodebuild test -workspace APP.xcworkspace -scheme APP -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.2' | xcpretty -s
tags:
- v0.0.1
Xcode version: 8.2.1
Cocoapods version: 1.2.0
Gitlab-runner version : 1.11.0
Alex
On React Native I've solved this issue by running command inside /ios folder.
I have solved this now!!
I just had to update the cocoapods repo, se this link:
https://github.com/CocoaPods/CocoaPods/issues/5077
Looks like your specs repo was edited at some point, and now git can't update it. I'd recommend deleting and re-creating your Specs repo: pod repo remove master and running pod setup
In my case i had project with same folder name("Project") ending with 1 , 2 ,3 ,4 (total 5 folders). when i was trying to install cocoapods in "Project 4" Directory it was getting installed in "Project" instead it should be for "Project 4".
I could find Xcworkspace in the folder "Project"
Hence i need to delete other folders with same name and then install pods in "Project" folder
To share a scheme in Xcode:
Choose Product > Scheme > Manage Schemes.
Share your scheme:
Click on the Close button.

Travis CI fails to compile Pods

I'm trying to set up Travis CI for my iOS project.
Here is my travis yml file
language: objective-c
env:
matrix:
- export LANG=en_US.UTF-8
script:
- xctool -workspace TravisExample.xcworkspace -scheme TravisExample -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
- xctool test -workspace TravisExample.xcworkspace -scheme TravisExampleTests -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
cache:
- bundler
- cocoapods
Travis failed with errors like this
Support Files/Bolts/Bolts-prefix.pch' file not found
Support Files/AFNetworking/AFNetworking-prefix.pch' file not found
I have AFNetworking and Bolts as dependencies in my project managed by cocoapods.
Any idea how to fix this problem?
Try using this lines before script:
before_install:
- rvm use system
- sudo gem install cocoapods -v '0.39.0'
It looks like some Travis Machines are using old Cocoapods versions. With this lines you force Travis to use the version you want.
Check which version are you using in your machine with this line in your Terminal:
pod --version
I wrote a blog post about Travis-CI, maybe it can help you.

Travis-ci command "./gradlew build" exited with 1

I am unable to build my Android application with Travis-ci. It keeps failing with:
Travis-ci command "./gradlew build" exited with 1.
I have no idea what's causing this, and Travis-ci has no information on how to fix it!
Please advise,
Igor
For anyone who is interested, I used the following android components section in my travis.yml file to solve the problem:
android:
components:
# Update Android SDK Tools
- tools
- build-tools-23.0.1
- android-23
# Support library
- extra-android-support
- extra-android-m2repository
Also, my script section has the following:
script:
- chmod +x ./gradlew
Seems to work now!
hi i also have the same issue but the above solution was not working in my case.But if fix it by giving
before_install:
- chmod +x gradlew
After applying chmode on before_install i have resolved the issue.
Complete .travis.yml
language: android
android:
components:
# Uncomment the lines below if you want to
# use the latest revision of Android SDK Tools
# - platform-tools
# - tools
# The BuildTools version used by your project
- build-tools-25.0.0
# The SDK version used to compile your project
- android-25
# Specify at least one system image,
# if you need to run emulator(s) during your tests
- sys-img-armeabi-v7a-android-22
- sys-img-armeabi-v7a-android-17
before_install:
- chmod +x gradlew
I hope this will help anyone who fail to get the solution from the above answer.
I had to set the jdk in the second line to 8 and it works:
language: android
jdk: oraclejdk8
android:
...

Resources