Skip to content

Commit

Permalink
[#16] .Update added linter report as well
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasObenaus committed Feb 17, 2020
1 parent 25c6c83 commit cbed06f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@ jobs:
golangci-lint --version
make lint
test:
name: Test
- name: Run the unit tests and check for race conditions
run: make test.report

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

integration-test:
name: Integration Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
Expand All @@ -37,15 +46,6 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Run the unit tests and check for race conditions
run: make test.report

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Start the local gremlin as preparation for the integration test and run the integration tests
run: |
make infra.up
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ local
coverage.out

test-report.out

lint.out
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ test: sep ## Runs all unittests and generates a coverage report.
@echo "--> Run the unit-tests and checks for race conditions."
@go test -timeout 30s -race -run "^Test.*[^IT]$$" -covermode=atomic

test.report: sep ## Runs all unittests and generates a coverage- and a test-report.
@echo "--> Run the unit-tests"
@go test -timeout 30s -race -run "^Test.*[^IT]$$" -covermode=atomic -coverprofile=coverage.out -json | tee test-report.out

test.integration: sep ## Runs all integration tests. As precondition a local gremlin-server has to run and listen on port 8182.
@echo "--> Run the integration-tests"
Expand All @@ -32,6 +29,15 @@ lint: ## Runs the linter to check for coding-style issues
@echo "!!!!golangci-lint has to be installed. See: https://github.com/golangci/golangci-lint#install"
@golangci-lint run --fast

report.test: sep ## Runs all unittests and generates a coverage- and a test-report.
@echo "--> Run the unit-tests"
@go test -timeout 30s -race -run "^Test.*[^IT]$$" -covermode=atomic -coverprofile=coverage.out -json | tee test-report.out

report.lint: ## Runs the linter to check for coding-style issues and generates the report file used in the ci pipeline
@echo "--> Lint project + Reporting"
@echo "!!!!golangci-lint has to be installed. See: https://github.com/golangci/golangci-lint#install"
@golangci-lint run --fast --out-format checkstyle | tee lint.out

gen-mocks: sep ## Generates test doubles (mocks).
@echo "--> generate mocks (github.com/golang/mock/gomock is required for this)"
@go get github.com/golang/mock/gomock
Expand Down
2 changes: 1 addition & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (ws *websocket) Read() (messageType int, msg []byte, err error) {
if err := ws.conn.SetReadDeadline(time.Now().Add(ws.readingWait)); err != nil {
return 0, nil, err
}

fmt.Printf("%d", "hallo")
return ws.conn.ReadMessage()
}

Expand Down
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.test.exclusions=**/vendor/**,**/test/mocks/**
sonar.go.coverage.reportPaths=coverage.out
sonar.go.tests.reportPaths=test-report.out
sonar.go.tests.reportPaths=test-report.out
sonar.go.golangci-lint.reportPaths=lint.out

0 comments on commit cbed06f

Please sign in to comment.