Skip to content
This repository was archived by the owner on Nov 22, 2020. It is now read-only.

jandelgado/golang-ci-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golang travis-ci template

ci status Coverage Status Go Report Card

⚠️ Info
This project is archived, development now concentrates on github-actions: https://github.com/jandelgado/golang-ci-template-github-actions

This repository serves as my template for travis-ci-integrated go projects. It consists of a hello, world! like example in source file main.go which gets compiled into binary ci-test. The pre-commit script runs some checks on the code. When a new release is created, the released-artifacts are automatically uploaded to github and available on the release page. For demonstration purposes, both a linux- and windows target is created and packetized in a zip-archive.

Releasing

travis-ci cli

The travis cli tool is recommended to create the encrypted api_key used in .travis.yml file. Example installation on Fedora25:

$ sudo dnf install ruby ruby-devel redhat-rpm-config
$ gem install travis -v 1.8.8 --no-rdoc --no-ri

Set up deployment in .travis.yml and create encrypted api-key with: $ travis setup releases --force

This will ask some questions and create the deploy section in i the .travis.yml, modify it to look like:

before_deploy:
- zip ci-test-${TRAVIS_TAG}-windows-amd64.zip ci-test-windows-amd64.exe README.md
- zip ci-test-${TRAVIS_TAG}-linux-amd64.zip ci-test-linux-amd64 README.md
- sha256sum *zip > SHASUMS256.txt

deploy:
  provider: releases
  api_key:
    secure: ZSqZx+Ej1mFm5....
  file: 
    - ci-test-${TRAVIS_TAG}-windows-amd64.zip
    - ci-test-${TRAVIS_TAG}-linux-amd64.zip
  skip_cleanup: true
  on:
    tags: true

Creating a release

On your repositories home (github.com) go to Releases > create realease. As soon as the release-tag is created, Travis will run the deployment step.

Test coverage (coveralls)

Create coveralls account and activate coveralls for repositiory. Encrypt coveralls token with travis encrypt COVERALLS_TOKE="<token>".

For instructions on using goveralls look here.

About

example for golang travis-ci integration including releasing

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published