Can't make Travis-CI work - ruby

I'm trying to set up Travis on this repo: https://github.com/lcguida/worksheet
I've put the travis.yml file there.
I've enabled the repository in my travis account (the "ON" button)
I've pushed some commits to see if it woukld trigger the tester.
I'm always getting this message in "My Repositories" tab: You don't have any repos set up on Travis CI
Here is my travis.yml file:
language: ruby
rvm:
- 2.0.0
- 2.1.1
script: 'bundle exec rake test'
Can't figure out what I'm doing wrrong

I made the same mistake as you when starting on Travis :-)
The file name you need is .travis.yml
Note the first dot.
You can see what's wrong by looking at https://travis-ci.org/lcguida/worksheet/requests . . . where it repeatedly says "missing config"

Related

Xcode Cloud: unable to open configuration settings file

I'm working with a React Native project, setting up Xcode Cloud builds.
I keep getting this error:
unable to open configuration settings file
Pods-XXX.debug.xcconfig:1
The files in my workspace look like the following:
|-- XXX
|-- Pods
|. -- Podfile
|. -- Targets Support Files
|. -- Pods-XXX
|. -- Pods-XXX.debug
Guess what? XCode is garbage but doc can help us here.
This what I'm using to smoothly build my workflow. I'l share exact bash scripts here.
Why it's failing?
First open logs on your workflow window side bar.
Check if you're installing necessary dependencies before running archive process. You're using virtual machine so any dependencies like cocoapods or yarn aren't installed by default there.
If you haven't read and skipped to the SOLUTION:
Here is the steps:
Create ci_scripts folder inside ios folder.
Create 3 files inside ci_scripts folder:
ci_post_clone.sh
ci_post_xcodebuild.sh
ci_pre_xcodebuild.sh
Inside your ci_post_clone.sh file add this:
#!/bin/zsh
# fail if any command fails
echo "🧩 Stage: Post-clone is activated .... "
set -e
# debug log
set -x
# Install dependencies using Homebrew. This is MUST! Do not delete.
brew install node yarn cocoapods fastlane
# Install yarn and pods dependencies.
# If you're using Flutter or Swift
# just install pods by "pod install" command
ls && cd .. && yarn && pod install
echo "🎯 Stage: Post-clone is done .... "
exit 0
Inside your ci_pre_xcodebuild.sh file add this:
#!/bin/zsh
echo "🧩 Stage: PRE-Xcode Build is activated .... "
# You can add additional scripts here...
echo "🎯 Stage: PRE-Xcode Build is DONE .... "
exit 0
Inside your ci_post_xcodebuild.sh file add this:
#!/bin/zsh
echo "🧩 Stage: POST-Xcode Build is activated .... "
# You can add additional scripts here...
echo "🎯 Stage: POST-Xcode Build is DONE .... "
exit 0
I've had this same issue recently, there is now a default workflow for xcode cloud that performs the post clone step that was provided by #BEK ROZ
I also had the same issue locally when building a VueJS app with Ionic/Capacitor
Before now my knowledge of iOS builds is precisely zero, so excuse innocence, but I found the issues were relating to the *xcconfig files. Every capacitor module that you install with npm will have it's own xcconfig file for debug and release - Stored in:
ios/App/Pods/Target Support Files/{{ Module Name }}/{{ Module Name }}.debug.xcconfig
ios/App/Pods/Target Support Files/{{ Module Name }}/{{ Module Name }}.release.xcconfig
I've only installed two plugins, so I uninstalled one of them, which was cordova-plugin-screen-orientation, synced and then archived (steps below) and this time it passed.
# Remove a capacitor module with npm e.g. cordova-plugin-screen-orientation
npm uninstall cordova-plugin-screen-orientation
# Sync the iOS plugins to remove the plugin from your Podfile (ios/App/Podfile)
npx cap sync ios
So I'd recommend going through all of the plugins you've installed and see if any of them are playing up. Then go back to xcode, run "Product -> Archive" from the menus to start a new build or push your changes and let xcode cloud do the heavy lifting for you.
Good luck

Gitlab CI: Stage variable based on global variable is not resolved when using anchors

I have something like this in my .gitlab-ci.yml file:
.docker_build_cmd: &docker_build_cmd >-
docker build -t $DOCKER_IMAGE_TAG -f $DOCKER_FILE .
variables:
PROJECT_NAME: best-app-ever
BUILD_VERSION: 4.2.0
DOCKER_IMAGE_TAG: $DOCKER_PROJECT_NAME:$BUILD_VERSION
build:
stage: build
variables:
GRADLE_CMD: app:build
DOCKER_PROJECT_NAME: $PROJECT_NAME-service
DOCKER_FILE: docker/service.dockerfile
script:
- echo $DOCKER_PROJECT_NAME
- echo $DOCKER_IMAGE_TAG
- *docker_build_cmd
but runner says:
$ echo $DOCKER_PROJECT_NAME
best-app-ever
$ echo $DOCKER_IMAGE_TAG
$PROJECT_NAME-service:4.2.0
$ docker build -t $DOCKER_IMAGE_TAG -f $DOCKER_FILE .
invalid argument "$PROJECT_NAME-service:4.2.0" for "-t, --tag" flag: invalid reference format: repository name must be lowercase
Does anyone understand why it happens?
How Gitlab processes the .yml?
And if there is a way to make it work as I intended, I am really want to know.
GitLab SaaS version is 14.3.0-ee.
UPD. After some googling it seems that "variable_inside_variable" feature flag has to be enabled. Will do it tomorrow and see what changes.
GitLab CI "variable inside variable" feature was disabled, so I asked admins to toggle it and everything became fine. Don't think that this could be helpful question for many, because GitLab already enabled the feature globally, but if you have a standalone solution and the same issue, then you know what to do.

How to run a Ruby script on a Github Workflow

I have a Ruby script that I want to run when a pull-request is created. This pull-request validates a series of conditions to be sure the pull-request can be merged. It's a very simple script with no external gems, just standard Ruby.
I'm trying to run this script on a job on a run step. The problem is, I'm not sure the path where the file should be saved.
The script is called: validator.rb. From my local computer I can run the script using:
ruby -r ./validator.rb -e "Validator.new.validate_something 'One parameter'"
This works fine locally but when I push this to GitHub it is failing. I saved my script as .github/workflows/ruby-scripts so my job looks like this:
jobs:
title:
name: "Title"
runs-on: ubuntu-latest
steps:
- run: ruby -r ./ruby-scripts/validator.rb -e "Validator.new.validate_something '${{ github.event.pull_request.title}}'"
And I get:
Run ruby -r ./ruby-scripts/validator.rb -e "Validator.new.validate 'Create README.md'"
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:29: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:30: warning: constant Gem::ConfigMap is deprecated
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
/usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- ./ruby-scripts/validator.rb (LoadError)
from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'
##[error]Process completed with exit code 1.
I tried with all the possible combination of paths and it fails each time.
Running pwd and ls returned:
- run: pwd => /home/runner/work/repo-name/repo-name
- run: ls => shell: /bin/bash -e {0}
What is the right way to do this?
As I've mentioned in the comments, the reason why your workflow isn't working is that you forgot the crucial step that checks-out your repository. By default, the workspace is empty unless you check out the repository with the Checkout GitHub Action.
From the GitHub Action's README:
This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
Here's an example:
- name: Checkout Repo
uses: actions/checkout#v2
(That's it, really)
(Note: You don't have to specify a name for the step.)
For me, the problem was also the location of the file. The ruby script was running in the root of the repository, not in the same path as the workflow YAML (as I was expecting).
I was running run: ruby -r ./my-file.rb, where my-file.rb was next to the workflow yaml.
I realized this by adding this step:
- run: ruby -e 'p `ls`.split("\n")'
Which printed the output of ls in a ruby array.
I fixed using:
run: ruby ./.github/workflows/my_file.rb

Travis build with nodejs en custom ftp

I m trying to use travis CI with nodejs and I m facing a problem like this one.
What I want here, is only to use ftp to upload my file, not to run any command.
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
I dont know what is the problem actually... Here's my travis.yml file :
env:
global:
- "FTP_USER=xxx"
- "FTP_PASSWORD=xxx"
after_success:
"curl --ftp-create-dirs -T uploadfilename -u $FTP_USER:$FTP_PASSWORD ftp://xxxx.fr/www/mochatest"
What am I doing wrong ?
I faced similar scenario when I decided to use Travis-CI with HTML+JS app. I finally ended up deployment from my package.json file via "posttest" section. I wrote some code which uses ftp-deploy npm module to upload the files. Test repository here.

Travis gem deployment failing "Directory nonexistent"

I don't understand why the deployment is not working. I'm getting the following error in the build console:
Preparing deploy
Found gem
/usr/lib/git-core/git-stash: 186: /usr/lib/git-core/git-stash: cannot create /home/travis/build/prismicio/ruby-kit/.git/logs/refs/stash: Directory nonexistent
Build: https://travis-ci.org/prismicio/ruby-kit/jobs/40767391
My .travis.yml:
language: ruby
rvm:
- 2.1.1
- 2.1.0
- 2.0.0
- 1.9.3
- 1.9.2
- jruby-19mode
script: bundle exec rspec spec
notifications:
email:
- example#example.com
addons:
code_climate:
repo_token: X
deploy:
provider: rubygems
api_key:
secure: XXX
gemspec: prismic.gemspec
on:
tags: true
all_branches: true
What's wrong with the build?
The error:
/usr/lib/git-core/git-stash: 186: /usr/lib/git-core/git-stash: cannot create /home/travis/build/prismicio/ruby-kit/.git/logs/refs/stash: Directory nonexistent
may be related to how you're deploying your files to your provider and it's triggered by git stash and its DPL::Provider#cleanup process (see: releases.rb). By default Deployment Provider will deploy the files from the latest commit. This is not supported for all providers, therefore this just means that the "releases" provider needs to skip the cleanup, so it should deploy from the current file state instead (see #BanzaiMan comment) by adding this line:
skip_cleanup: true
This is because every provider has slightly different flags and these are documented in the Deployment section (or for the latest documentation check on GitHub for supported providers).
Further more, the above error is basically related to Travis CI bug (GH #1648) where basically File#basename is stripping the directory part (as per #BanzaiMan comment) and it's not clear why this cannot manifest in the CLI case. So this is something to fix in the near future.

Resources