travis go error 'The command "eval go get -t -v ./..." failed' - go

I have a pretty straightforward setup..
- a Travis.yml file : https://github.com/openassistive/OpenATFrontEnd/blob/master/.travis.yml
which has this line:
before_script:
- go get -u -v github.com/spf13/hugo
but it fails - with
The command "eval go get -t -v ./..." failed. Retrying, 2 of 3.
(https://travis-ci.org/openassistive/OpenATFrontEnd/builds/166105574)
I can't figure it out. I see the language is set correctly - and looking at other SO posts the version number is correct. Is there a different version I should be using?

Read this, the go get .... is part of the default go build script on travis, if no makefile is found.
A simple solution may be to add a Makefile with an empty recipe
$ cat Makefile
target: ;
$ make && echo "ok"
make: « target » uptodate.
ok
So travis will set the default install step to true, which should avoid the got get

Related

test: -v: unary operator expected

I try to run such code via "github actions"
- name: Run tests
run: |
set -e
...
test -v A || export B=42
shell: bash
and got error at line test -v A || export B=42:
test: -v: unary operator expected
I have no idea what is this about,
if I run this command in my local bash all works as expected,
what is wrong in my yaml code for "github actions"?
By any chance does your test happen to be running under a macOS CI environment? test -v tests if a variable has been set, but, it was only added in Bash 4.2.
macOS by default comes with Bash 3.2, and that's the expected error if it doesn't recognize -v as a unary operator.
To fix this, you can install the latest Bash, or use a different approach for testing for existence:
[ -z "${A+x}" ] && export B=42

CircleCi and CodeCov: The '<' operator is reserved for future use

I am trying to integrate CodeCov in CircleCI, but the command
bash <(curl -s https://codecov.io/bash)
returns
The '<' operator is reserved for future use. when executed in the pipeline.
I am following the documentation that I found for
CodeCov: https://docs.codecov.io/v4.3.0/docs/about-the-codecov-bash-uploader
CircleCI: https://circleci.com/docs/reference-2-1/#jobs
My config.yml has the following steps:
steps:
- checkout
- run:
name: "Run Unit Tests"
command: dotnet.exe test ./UnitTests --collect:"XPlat Code Coverage"
- run:
name: Upload CodeCov.io Data
command: bash <(curl -s https://codecov.io/bash)
when: always # Uploads code coverage results, pass or fail
I have also tried with just curl -s https://codecov.io/bash but in this way I get the error
Invoke-WebRequest : Cannot process command because of one or more missing mandatory parameters: Uri.
Has anyone of you made this integration?
Thank you
Update:
I had to add the .exe to the curl command:
- run:
name: Upload Coverage Results
command: curl.exe -s https://codecov.io/bash | bash -s --
when: "always"
Now it builds but can't find the report.
==> Circle CI detected.
project root: C:/Users/circleci/project
Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
==> Running gcov in C:/Users/circleci/project (disable via -X gcov)
FIND: Parameter format not correct
==> Python coveragepy not found
==> Searching for coverage reports in:
+ C:/Users/circleci/project
--> No coverage report found.
Please visit http://docs.codecov.io/docs/supported-languages
CircleCI received exit code 0
“The '<' operator is reserved for future use.”
Try to run your command as shown below:
cmd /c "<your command>"

What that this line means in a make file `DOCKER := $(shell command -v docker)`

$(shell command -v docker) What command means? it's being used in a Makefile.
I saw this in a github repository that I'm trying to understand.
It looks like it's setting a variable with a command to test if docker is installed, and stop the build if its not, the problem is this that I don't have a command installed and I tryed to install command in ubuntu but it can't find it, looking on internet how to install this commad command seems realy difficult because of its name, how to install command in linux/ubuntu didn't bring anything useful, also search for this being using on Makefiles trying to get some clue but nothing so far.
Running the build command seems to work becuse it build the image and yes I have docker installed, but still getting that message in the terminal make: command: Command not found
Any idea?
make build output (trucated):
$ make build
make: command: Command not found
make: command: Command not found
docker build -t codelytv/typescript-ddd-skeleton:dev .
Sending build context to Docker daemon 1.023MB
.....
This is the Makefile:
.PHONY = default deps build test start clean start-database
IMAGE_NAME := codelytv/typescript-ddd-skeleton
SERVICE_NAME := app
# Test if the dependencies we need to run this Makefile are installed
DOCKER := $(shell command -v docker)
DOCKER_COMPOSE := $(shell command -v docker-compose)
deps:
ifndef DOCKER
#echo "Docker is not available. Please install docker"
#exit 1
endif
ifndef DOCKER_COMPOSE
#echo "docker-compose is not available. Please install docker-compose"
#exit 1
endif
default: build
# Build image
build:
docker build -t $(IMAGE_NAME):dev .
# Run tests
test: build
docker-compose run --rm $(SERVICE_NAME) bash -c 'npm run build && npm run test'
# Start the application
start: build
docker-compose up $(SERVICE_NAME) && docker-compose down
# Clean containers
clean:
docker-compose down --rmi local --volumes --remove-orphans
# Start mongodb container in background
start_database:
docker-compose up -d mongo
What it means is that the person who wrote this makefile wasn't careful enough to write it in a portable way.
The command command is part of the shell (which is why you won't see it if you look for it in the GNU make manual). Not only that, it's part of the bash shell specifically: it is not a POSIX sh standard command. The bash man page says:
command [-pVv] command [arg ...]
Run command with args suppressing the normal shell function
lookup. Only builtin commands or commands found in the PATH are
executed.
Basically, running command docker ... means that any shell alias or function named docker is ignored, and only the actual docker command is run.
However, GNU make always runs /bin/sh as its shell, including for both recipes and for the $(shell ...) function.
So, if you're on a system (such as Red Hat or CentOS or Fedora GNU/Linux) where the /bin/sh is a link to the bash shell, then the above command will work.
However, if you're on a system (such as Debian or Ubuntu GNU/Linux) where the /bin/sh is a link to a simpler POSIX shell such as dash, then the above command will not work.
In reality, this is not needed because there won't be any shell aliases or functions defined in the shell that make invokes, regardless. However, if the author wants to use bash shell features in their makefiles and allow them to work, they also need to tell make to use bash as its shell, by adding this to their makefile:
SHELL := /bin/bash
(of course this assumes that the user has a /bin/bash on their system, but...)

Compile cygwin1.dll from its source code

I want to edit some code in cygwin1.dll for my project. So, I clone git repository from these two url:
https://github.com/mirror/newlib-cygwin.git
git://sourceware.org/git/newlib-cygwin.git
I've gcc, g++, make installed with cygwin and mingw-w64 (and also in WSL). But none of them generate DLL file. I also follow the commands ./configure & make. Command generates only object files. Is it possible to compile cygwin1.dll from its source code?
I had two different problems.
First, I followed the steps in cygwin FAQ: How do I build Cygwin on my own?. I forget to install mingww64_x86_64-gcc-g++ package. So, I installed those with the following commands:
setup-x86_64.exe -q -P gcc-g++ -P make -P perl -P cocom -P gettext-devel -P libiconv-devel -P zlib-devel
setup-x86_64.exe -q -P mingw64-x86_64-gcc-core -P mingw64-i686-gcc-g++ -P mingw64-i686-zlib
setup-x86_64.exe -q -P mingw64-x86_64-gcc-g++ -P mingw64-x86_64-zlib
Second, I logged the output from make command with make |& tee make.log. Thanks, #matzeri for the logging tip. Then I followed an error in make.log file as below:
../../.././winsup/cygwin/cygmagic: line 25: /usr/bin/awk: cannot
execute binary file: Exec format error
*** WARNING WARNING WARNING WARNING WARNING ***
*** ../../.././winsup/cygwin/child_info.h: magic number for
CHILD_INFO_MAGIC changed old 0xc96f5e9U != new
Somehow, the awk (hard linked with gawk) does not work in cygwin. So I installed awk package with setup-x86_64.exe. And now I can easily compile cygwin.dll.

How to access secondary travis logs

I know the primary travis build logs are available on the web and with the logs command in the travis command line client, but I was wondering if there is a way to access other files generated as part of the build process, such as the file /home/travis/.rvm/log/1391454748_rbx-2.2.4/rubygems.install.log referenced in https://travis-ci.org/rspec/rspec-its/jobs/18148204
Those files are lost once the build is finished. If you want to read them, you should add a cat command to print out to the log you see.
before_script: cat /home/travis/.rvm/log/*_rbx-2.2.4/rubygems.install.log
If the install command is failing, then you should override install to install the gem for which the installation is failing:
install: gem install XXX || cat /home/travis/.rvm/log/*_rbx-2.2.4/rubygems.install.log
banzaiman's answer is good (it helped me!). But if you use:
install: gem install XXX || cat /home/travis/.rvm/log/*_rbx-2.2.4/rubygems.install.log
then the cat command will likely succeed, and so the line above will count as as success, and the build will continue. If you want the build to fail when the install fails, then you need to make sure the line has a non-zero exit status. So do something like this:
install: gem install XXX || { cat /home/travis/.rvm/log/*_rbx-2.2.4/rubygems.install.log && 1; }
The expression in curly braces will be run only if the gem install XXX fails (i.e., has a non-zero exit status). cat will presumably succeed, so the command after the && will be run. That 1 ensures a non-zero exit status for the whole line, causing the build to stop at that point.
Note the necessary whitespace around the curly braces.

Resources