Skip to content

Commit

Permalink
Merge pull request #6 from ermos/rollback-test
Browse files Browse the repository at this point in the history
Rollback test action
  • Loading branch information
ermos authored Mar 4, 2023
2 parents 0f233d0 + f8b206a commit 78ccf4f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 34 deletions.
47 changes: 15 additions & 32 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,24 @@
name: Test and Coverage Report

on:
push:
branches:
- main
name: Go
on: [push]

jobs:
test-and-report:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.20

- name: Install dependencies
run: go mod download
go-version: 1.20.1

- name: Run tests and coverage
run: |
go test -race -coverprofile=coverage.out ./...
go tool cover -func=coverage.out -o coverage.txt
- name: Upload coverage to CodeClimate
uses: codeclimate/test-reporter-action@v2
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}
with:
name: Test Coverage Report
coverageCommand: go tool cover -json=coverage.out | codeclimate analyze-coverage --input=- --language=go
verbose: true
debug: false
- name: Test
run: go test -v ./...

- name: Cleanup
run: |
rm -f coverage.out
rm -f coverage.txt
- name: Update coverage report
uses: ncruces/go-coverage-report@main
if: |
matrix.os == 'ubuntu-latest' &&
github.event_name == 'push'
continue-on-error: true
3 changes: 3 additions & 0 deletions go.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func (b *Golang) StructField(name, goType string, docs ...map[string]string) {
func (b *Golang) String() string {
sb := NewBuilder()

sb.SetIndentChar(b.indentChar)
sb.StripIndent(b.currIndent)

sb.WriteStringln(fmt.Sprintf("package %s", b.packageName), 2)

if len(b.imports) != 0 {
Expand Down
4 changes: 2 additions & 2 deletions go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func TestGolang_AddImports(t *testing.T) {

expected := "" +
"import (\n" +
" \"fmt\"\n" +
" \"strings\"\n" +
" \"fmt\"\n" +
" \"strings\"\n" +
")\n\n"

return t, expected, b.String()
Expand Down
3 changes: 3 additions & 0 deletions php.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func (b *PHP) ClassFunc(modifiers, name, parameters, output string, inside func(
func (b *PHP) String() string {
sb := NewBuilder()

sb.SetIndentChar(b.indentChar)
sb.StripIndent(b.currIndent)

sb.WriteStringln("<?php", 2)

if b.namespace != "" {
Expand Down

0 comments on commit 78ccf4f

Please sign in to comment.