Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 39 additions & 8 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
name: Go CI build and test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

Expand All @@ -25,15 +23,48 @@ jobs:
run: go mod tidy

- name: Build
id: go_build
run: go build -v ./...

- name: Run tests with coverage
id: go_test
run: |
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
go test ./... -coverprofile=coverage.out
go tool cover -func=coverage.out > coverage.txt

coverage=$(tail -n 1 coverage.txt | awk '{print $3}')

echo "Overall test coverage: $coverage"

echo "setting coverage brief"
echo "coverage=$coverage" >> $GITHUB_ENV

echo "Setting details"
{
echo 'coverage_details<<EOF'
cat coverage.txt
echo EOF
} >> "$GITHUB_ENV"

echo "done setting"


- name: Upload coverage report
uses: actions/upload-artifact@v4
- name: Echo Coverage Result
run: |
echo "Overall test coverage: ${{ env.coverage }}"

- name: Create comment
uses: peter-evans/create-or-update-comment@v4
with:
name: coverage-report
path: coverage.html
token: ${{ secrets.PAT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: append
body: |
## Test Coverage Report
The overall test coverage is **$${{ env.coverage }}**.

### Coverage Details
```
${{ env.coverage_details}}
```

4 changes: 0 additions & 4 deletions channels_experiments/channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import (
"time"
)

func DoChannelTests() {
TestChannelDirections()
//TestStructChannel()
}
func SendMessage[T any](aSendOnlyChannel chan<- T, message T) {
aSendOnlyChannel <- message
fmt.Printf("Sending message on channel %v\n", message)
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
)

require (
github.com/blugnu/test-report v0.1.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/goconvey v1.8.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/aoliveti/curling v1.1.0 h1:/1k05HmPUEGYXNHo3aX5BWRJWvWQbiU0A7n9ugqhdLY=
github.com/aoliveti/curling v1.1.0/go.mod h1:xoDmoUg9vX3pMTltyG/rp9tFtIlweL2QeCJVnvyAvzw=
github.com/blugnu/test-report v0.1.5 h1:L/LL19jpu41WyDzk5haKvrOK9wsydNVV6pyTYsH8GhU=
github.com/blugnu/test-report v0.1.5/go.mod h1:Jvnn/ALD/slapXT3eUG0oTltRupAsvfPFfeBsK9cJPI=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
Expand Down
9 changes: 9 additions & 0 deletions types_experiments/types_func_handler_experiment.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ func (f HandlerFunc) GoOn(in *InRequest, out ResponseWriter) {
f(in, out)
}

func DoneHandler(a *InRequest, out ResponseWriter) {
fmt.Println("Running EndHandler")
out.Write("END")
}
func create() Handler {
internalHandler := HandlerFunc(DoneHandler)
return internalHandler
}

// Sample handlers
func AddTest(next Handler) Handler {
fmt.Println("Creating Test Handler")
Expand Down
4 changes: 2 additions & 2 deletions types_experiments/types_func_handler_experiment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ func (o *MockedResponseWriter) Write(toWrite string) {
}

func TestInvocation_Invoke_WithMiddlewares(t *testing.T) {
invocationSetup := CreateInvocation().AddMiddleware(AddTest)
invocationSetup := CreateInvocation().AddMiddleware(AddTest, AddXXX, AddABC)
invocation := invocationSetup.Handle(HandlePayload)
r := &MockedResponseWriter{}
invocation.Invoke("PayloadGoesHere", r)
fmt.Println(r.writes)
t.Log(r.writes)
assert.EqualValues(t, []string{"START", "Test", "Payload: PayloadGoesHere", "END"}, r.writes)
assert.EqualValues(t, []string{"START", "Test", "XXX", "ABC", "Payload: PayloadGoesHere", "END"}, r.writes)
}

func TestInvocation_Invoke_WithoutMiddlewares(t *testing.T) {
Expand Down