Travis build with nodejs en custom ftp - continuous-integration

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.

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

Using a private go module on Gitlab as import : "Unknown revision"

I cannot get this to work, even after checking other topics on stackoverflow. My project on gitlab.com/my_company/backend needs a module, found at gitlab.com/my_company/pkg/auth.
Locally, I've setup GOPRIVATE / git's configuration to make it work (and it works), though in Gitlab's CI Pipelines on a merge request, this fails.
Pipeline log / go.mod
I've added some debugging logs just to make sure everything was setup like I thought. Here's a failing pipeline's log :
$ git config --global url."ssh://git#gitlab.com/my_company/".insteadOf "https://gitlab.com/my_company/"
$ git config --global url."git#gitlab.com:".insteadOf "https://gitlab.com/"
$ git config -l | grep instead
url.ssh://git#gitlab.com/my_company/.insteadof=https://gitlab.com/my_company/
url.git#gitlab.com:.insteadof=https://gitlab.com/
$ env | grep GOPRIVATE
GOPRIVATE=gitlab.com/my_company
$ go mod download
go: gitlab.com/my_company/pkg/auth#v1.1.0: reading gitlab.com/my_company/pkg/auth/auth/go.mod at revision auth/v1.1.0: unknown revision auth/v1.1.0
One weird part of this log I've found is :
reading gitlab.com/my_company/pkg/auth/auth/go.mod - why is it repeating auth/auth? It actually happened once before locally, but it was because I wrote "github" instead of "gitlab" :)
The relevant go.mod line just in case :
require (
gitlab.com/my_company/pkg/auth v1.1.0 // indirect
)
Repository tags
Here are the tags setup on the repository gitlab.com/my_company/pkg :
$ git tag -l
auth/v1.0.0
auth/v1.1.0
cache/v1.0.0
cache/v1.0.1
$ git ls-remote --tags
From git#gitlab.my_company/pkg.git
9efcb02d5489adaac9d525dcb496d868d65e856a refs/tags/auth/v1.0.0
13730d4f61df978c6d690fd2678e2ed924808e0c refs/tags/auth/v1.1.0
2b8dff0ec1b737d975290720933180a9b591a1db refs/tags/cache/v1.0.0
9a3e598bbf83bea57b29d8a908b514861ae37b12 refs/tags/cache/v1.0.1
I'm not that familiar with Gitlab CI so I'm out of things to try. Any ideas?
Thank you!
Update: I finally got gitlab-runner installed so I could try running the yml directly, no luck. It still works locally (not a big surprise).
In you project should be file .gitlab-ci.yml and you can add GOPRIVATE variable to your CI and runner will use it for you project.
More details how to add env vars:
https://docs.gitlab.com/ee/ci/variables/#create-a-custom-cicd-variable-in-the-gitlab-ciyml-file

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

Can't make Travis-CI work

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"

How do use node-qunit?

The info on this page seems less-than-forth-coming -- https://github.com/kof/node-qunit. I've got a setup where I installed nodejs and installed the node-quit module. I have test runner and executed the command node /path/to/runner.js. Below is an example of my setup. Any ideas or examples on how to do this or maybe I'm using it wrong. I previous ran qunit tests using Rhino and EnvJs without any issues but I figured I try nodejs since I using it for other things and the packaging system can be scripted in my build. Maybe I missing an option to node to include Qunit or some environment variable not set -- that would make sense.
File Structure
node/
public/
js/
main.js
tests/
js/
testrunner.js
tests.js
Installation
cd node
npm install qunit
This will now update the file structure.
node/
node_modules/
qunit/
tests/js/testrunner.js
var runner = require("../../node/node_modules/qunit");
runner.run({
code : "/full/path/to/public/js/main.js",
tests : "/full/path/to/tests/js/tests.js"
});
tests/js/tests.js
test("Hello World", function() {
ok(true);
});
Command
node tests/js/testrunner.js
It appears that you need to use full paths to the main.js and tests.js files and also include a relative path to the qunit module. I updated the code above as an example for others.

Resources