Skip to content

Commit

Permalink
Merge pull request #29 from benmatselby/switch-build
Browse files Browse the repository at this point in the history
Move builds and coverage to GitHub actions and Sonar
  • Loading branch information
benmatselby authored Aug 28, 2019
2 parents 9ca5720 + a3ebf97 commit 67546db
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 17 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Go
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.12
uses: actions/setup-go@v1
with:
go-version: 1.12
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
make install
- name: Vet
run: |
make vet
- name: Build
run: |
make build
- name: Test
run: |
make test
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ trace.out
debug.test
vendor/
debug

# Sonar
.scannerwork/
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ static: ## Build the application

.PHONY: test
test: ## Run the unit tests
go test ./... -coverprofile=profile.out
go test ./... -coverprofile=coverage.out

.PHONY: test-cov
test-cov: test ## Run the unit tests with coverage
go tool cover -html=profile.out
go tool cover -html=coverage.out

.PHONY: all ## Run everything
all: clean install lint vet build test
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Donny

[![Build Status](https://travis-ci.org/benmatselby/donny.png?branch=master)](https://travis-ci.org/benmatselby/donny)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=donny&metric=alert_status)](https://sonarcloud.io/dashboard?id=donny)
[![Go Report Card](https://goreportcard.com/badge/github.com/benmatselby/donny?style=flat-square)](https://goreportcard.com/report/github.com/benmatselby/donny)

_Forget it, Donny, you're out of your element!_
Expand Down Expand Up @@ -31,7 +31,7 @@ COMMANDS:
If you are wanting to build and develop this, you will need the following items installed. If, however, you just want to run the application I recommend using the docker container (See below)
* Go version 1.11+
- Go version 1.12+
## Configuration
Expand Down
13 changes: 13 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sonar.host.url=https://sonarcloud.io
sonar.organization=benmatselby
sonar.projectKey=donny
sonar.projectName=donny

sonar.sources=.
sonar.exclusions=*_test.go

sonar.tests=.
sonar.test.inclusions=*_test.go

sonar.go.tests.reportPaths=coverage.out
sonar.go.coverage.reportPaths=coverage.out

0 comments on commit 67546db

Please sign in to comment.