Examples of end-to-end GoLang build pipeline - go

There seems to be little information around examples and best practices when building an end-to-end pipeline for a Go Lang application that can:
Calculate next version (ala semantic-release)
Run all tests
Build for the different supported platforms ((Linux, FreeBSD, Mac OS X, Windows) * (amd64, 386, arm, s390x, ppc64le))
Tag and Release in a SCM (github | gitlab | bitbucket)
Optionally create packages (deb, rpm, snaps, flatpaks, brew taps, Inno Setup).
Run this integrated in (TravisCI | CircleCI | Jenkins | Bamboo | others)
Is there any documentation, example project at this regard? I've checked some of the more famous Go projects (kubernetes, hashicorp/* and others) and they all seem to leave this part outside of the project.

I am not sure if this is what you need, but you can take a look at this one goreleaser.
GoReleaser builds Go binaries for several platforms, creates a GitHub
release and then pushes a Homebrew formula to a repository. All that
wrapped in your favorite CI.

Related

How to build .px4

i want to build .px4 file
so i trying build with Qt Creator in ubuntu 14
but did not work
how to fix this problem...
If you have cloned into the native git px4 repo (https://github.com/PX4/Firmware) I would suggest you to go for a suitable tagged release branch (other than beta-unless you think of developing the firmware) depending on your board version instead of master as it is most probably tbd..
Open the terminal, manual build is mostly recommended. cd to go to your cloned/source directory of px4 firmware with:
cd <fmu_source_directory>/
and just use
make build px4fmu-v**x**_default upload
(x can be any version you like to build for your board [1-4])
this way you would be able to bypass the config errors of qt and easily manually deploy your px4 firmware (assuming that you have a gnu compiler and all other dependencies built and ready to use on your computer)..

Building Erlang projects on Windows

I'm looking for a way to build an Erlang project on Windows. I have Erlang installed and all project files, including makefile, cloned from GitHub. I would like to build the project as if I was using make command on Linux and run it. What tools can I use to do that?
I'd try cygwin. https://www.cygwin.com
http://erlang.org/doc/installation_guide/INSTALL-WIN32.html
You can either build erlang with cygwin or use gnu-make in combination with a native windows build of erlang
If you're asking "how do I run make in Windows?" then you can use Cygwin, the newly-available Bash shell, or the MinGW tools. These will all give you some level of ability to run make, though not every makefile will work.
If you're asking "how can I build an Erlang project using a makefile?" then you are looking for erlang.mk. Note that Rebar3 (which is configured with Erlang terms and looks nothing like a make system) was recently selected as the "official" build tool, but erlang.mk is quite popular and is well-maintained.

Octopus deploy on Mac OS runner from teamcity

I'm setting up a build on Teamcity that will build a XCode project, then create a release in Octopus and using Powershell copy the files into a server. However, I'm having an issue, while both steps (Teamcity and Octopus) work independently, currently Teamcity is telling me that my build agent does not complies with the requirement 'OctopusDeploy: Release'.
I've downloaded the plugin that is here, and have managed to put the zip file on the runner directory, and while Octopus restarted and seems to have installed it, it still doesn't show as one of the available Build runners.
Apparently you can't do this, or that's what it seems like. Installing the plugin on a fresh install of Teamcity ignored the Mac build agent, which means it's not compatible.
This makes sense because Octopus uses an exe wrapper so this could be the reason. If anybody finds something else, feel free to contribute.

Can Elixir or Erlang programs be compiled to a standalone binary?

It says that Elixir has a tool called elixirc and Erlang has a tool called erlc to compile modules for use. It says immediately after this that you can then run code with the elixir command line tool.
Is there a way to compile a binary executable with Elixir or Erlang? (one which I can chmod +x binary_name and then run from the same directory with ./binary_name)
Escripts support that to some extent but you still need Erlang installed in your machine. See this answer for more information: Elixir or Hex portable package format?
Make sure you checkout Distillery. It does what you need, without having to deal with Rebar.
Add this to your mix.exs file's dependencies then run mix release.
defp deps do
[{:distillery, "~> 0.9"}]
end
Their documentation is great:
Home - Distillery Documentation
You can use tools like rebar to generate a release that also contains the erts, which makes it possible to run said release on a machine where erlang is not installed. But the erts included corresponds to the operating system on which the release was built, i.e. windows binaries if built on windows.
You can use Elixir's built-in releases as of Elixir 1.9. It is a lightweight alternative to Distillery.
Caveats:
It will not create anything remotely like Go does with a single binary executable that you can run almost anywhere. Also your target will have to match the CPU architecture and OS.
To build a release run:
mix release
Read more here:
https://hexdocs.pm/mix/Mix.Tasks.Release.html
There are a few tools now that allow you to create a self contained executable binary that doesn't require any dependencies on the target machine. They support multiple platforms.
Bakeware: https://github.com/bake-bake-bake/bakeware
Burrito: https://github.com/burrito-elixir/burrito

rpmbuild - How to mark some package as conflicting at build time

I have to use different compiler (gcc) from one packaged with centos. It is also gcc, just repacked newer version which has been installed with different path.
I am using mock for build, which has in its basic setup
config_opts['chroot_setup_cmd'] = 'groupinstall build'
Group build in my case contains CentOS stock gcc. I cannot change anything in mock environment.
Is there a way how to delete gcc package before build actually proceed?
The problem is that some programs compiled by my repacked gcc tends to use system /usr/include/ instead of correct include's from repacked gcc, so I am looking for a way how to localize problem.
You can try to use the instructions provided by Fedora to complete this task, they talk about doing a build when the rpm you need to install isn't part of a repo.
If that doesn't work I would look at setting up a custom environment, or asking your admin to do so if you cannot change it as you state in your question. The configuration files are stored under /etc/mock/*.cfg. I would suggest copying one of these that matches your needs and naming it something unique. Then you need to add an additional repo line (either local or remote depending on where your custom copy of GCC lives).
This will configure the environment to pick up that version of GCC if it really is just marked as a newer release. In the event there is some unique naming convention or it's not being picked up for some reason you should look at modifying the chroot_setup_cmd to simply install all the build packages. When I review a
yum groupinstall buildsys-build
I see a list of all the associated packages. You'll obviously want to check 'build'. You can then modify your config_opts['chroot_setup_cmd'] to use 'install', instead of 'groupinstall', where you can then install all the associated build packages, as well as your custom GCC.
If that still doesn't work, you can always copy the build packages to your own personal repo where GCC lives, ensure that's the only one available to pull from, configure the repo so it supports the 'build' group, and then build the package. While not extremely helpful due to age, the Mock docs have some useful information for configuring your environment with local repos.

Resources