Coder Social home page Coder Social logo

jandelgado / golang-ci-template-github-actions Goto Github PK

View Code? Open in Web Editor NEW
57.0 4.0 42.0 1.02 MB

example for golang project using github actions

License: MIT License

Go 34.18% Dockerfile 65.82%
golang ci github-actions coveralls coverage goreleaser docker

golang-ci-template-github-actions's Introduction

golang ci template using github actions

Build Status Coverage Status Go Report Card

Info

This repository serves as a template for github-actions integrated go projects. It consists of a hello, world! like example in source file main.go which gets compiled into the binary golang-ci-template-github-actions. The CI runs some linters on the code, before the unit tests are executed. Test coverage is uploaded to coveralls.io.

goreleaser is used to create the final multi-plattform assets, which are automatically uploaded to the release. The release-process is triggered by pushing a git tag to the repository.

Finally, a docker image is built, which gets published to ghcr.io. Run it with

$ docker run --rm  ghcr.io/jandelgado/golang-ci-template-github-actions:latest
hello, world!

Creating a release

A new release is created by creating a git tag and pushing it, e.g.:

$ git tag -a "v1.2.3" -m "this is release v1.2.3"
$ git push origin v1.2.3

The push of the new tag triggers the CI, which uses goreleaser to:

  • build multiplatform release artifacts
  • create a new release
  • upload the artifacts, which are then available on the releases page.

Finally, a docker image is built, which gets published to ghcr.io.

Test coverage (coveralls)

We use the gcov2lcov-action to first convert the golang test coverage to lcov format and then upload it using the coveralls github action.

Don't forget to enable Leave comments (x) in coveralls, under repo settings > pull request alerts, so that the coveralls-action posts a comment with the test coverage to affected pull requests:

pr screenshot

Author

(c) copyright 2021 by Jan Delgado

golang-ci-template-github-actions's People

Contributors

jandelgado avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.