Skip to content

Commit

Permalink
Adds inprogress summary to console output (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroon Sheikh authored Jan 5, 2021
1 parent 616a17d commit 1074fee
Show file tree
Hide file tree
Showing 7 changed files with 465 additions and 14 deletions.
43 changes: 43 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 2
jobs:
build:
docker:
- image: circleci/golang:1.13
working_directory: /go/src/github.com/sitture/gauge-inprogress
steps:
- checkout
- run:
name: Get all dependencies
command: go get ./...
- run:
name: Run Tests
command: go test ./... -cover
- run:
name: Make Binaries
command: go run build/make.go --all-platforms
deploy:
docker:
- image: circleci/golang:1.13
working_directory: /go/src/github.com/sitture/gauge-inprogress
steps:
- checkout
- run:
name: Get all dependencies
command: go get ./...
- run:
name: Install github-release
command: go get -v -u github.com/aktau/github-release
- run:
name: Build and Release
command: .circleci/release.sh
workflows:
version: 2
build_and_deploy:
jobs:
- build
- deploy:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
21 changes: 21 additions & 0 deletions .circleci/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

if [ -z "${GITHUB_TOKEN}" ]; then
echo "GITHUB_TOKEN is not set"
exit 1
fi

go run build/make.go --all-platforms
go run build/make.go --all-platforms --distro

cd deploy/
for i in `ls`; do
${GOPATH}/bin/github-release upload \
-u ${CIRCLE_PROJECT_USERNAME} \
-r ${CIRCLE_PROJECT_REPONAME} \
-t ${CIRCLE_TAG} \
-n $i -f $i
if [ $? -ne 0 ];then
exit 1
fi
done
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dmotylev/goproperties v0.0.0-20140630191356-7cbffbaada47 h1:sP2APvSdZpfBiousrppBZNOvu+TE79Myq4kkmmrtSuI=
github.com/dmotylev/goproperties v0.0.0-20140630191356-7cbffbaada47/go.mod h1:f2V6964+f0p8Asqy8mIK5cKyyVc6MP9PFzGVNRcnYJQ=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/getgauge/common v0.0.0-20200824023809-24587c106922 h1:/KwwglTNoofndO0RhEPY750erewl4uAL+WbfN+nLkVs=
Expand Down Expand Up @@ -73,6 +75,8 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.34.0 h1:raiipEjMOIC/TO2AvyTxP25XFdLxNIBwzDh3FM3XztI=
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
Expand Down
59 changes: 57 additions & 2 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package main

import (
"context"
"fmt"
"github.com/sitture/gauge-inprogress/gauge_messages"
"github.com/sitture/gauge-inprogress/inprogress"
"github.com/sitture/gauge-inprogress/logger"
"google.golang.org/grpc"
)

Expand All @@ -12,7 +13,61 @@ type handler struct {
}

func (h *handler) GenerateDocs(c context.Context, m *gauge_messages.SpecDetails) (*gauge_messages.Empty, error) {
fmt.Printf("Succesfully converted specs to html")
logger.Debugf("In progress tags are set to %s.", inprogress.GetInProgressTags())
specDirs := inprogress.GetSpecDirs()
logger.Debugf("Analysing specs under %s", specDirs)
allSpecs := inprogress.GetSpecs(m, inprogress.GetSpecFiles(specDirs))
allScenarios := inprogress.GetScenarios(allSpecs)
inProgressSpecs := inprogress.GetInProgressSpecs(allSpecs)
inProgressScenarios := inprogress.GetInProgressScenarios(inProgressSpecs)
inProgressSpecsWithReason := inprogress.GetInProgressSpecsWithReason(inProgressSpecs)
inProgressScenariosWithReason := inprogress.GetInProgressScenariosWithReason(inProgressSpecsWithReason)

if err := inprogress.WriteToFile(inProgressSpecs, inProgressScenariosWithReason); err != nil {
logger.Debugf("Could not generate the inprogress report file.")
}

logger.Infof(
"\nIn progress Summary: %s\n",
inprogress.GetProjectDirName(),
)
if inprogress.PercentOf(len(inProgressSpecs), len(allSpecs)) == 0 && inprogress.PercentOf(len(inProgressScenarios), len(allScenarios)) == 0 {
logger.Infof("No in progress scenarios found.")
} else {
logger.Infof(
"Specifications: %d/%d (%0.0f%%)",
len(inProgressSpecs),
len(allSpecs),
inprogress.PercentOf(len(inProgressSpecs), len(allSpecs)),
)
specsWithoutReason := len(inProgressSpecs) - len(inProgressSpecsWithReason)
if specsWithoutReason > 0 {
logger.Infof(
" - No inprogress comments: %d/%d (%0.0f%%)",
specsWithoutReason,
len(inProgressSpecs),
inprogress.PercentOf(specsWithoutReason, len(inProgressSpecs)),
)
}
logger.Infof(
"Scenarios: %d/%d (%0.0f%%)",
len(inProgressScenarios),
len(allScenarios),
inprogress.PercentOf(len(inProgressScenarios), len(allScenarios)),
)
scenariosWithoutReason := len(inProgressScenarios) - len(inProgressScenariosWithReason)
if scenariosWithoutReason > 0 {
logger.Infof(
" - No inprogress comments: %d/%d (%0.0f%%)",
scenariosWithoutReason,
len(inProgressScenarios),
inprogress.PercentOf(scenariosWithoutReason, len(inProgressScenarios)),
)
}

}
logger.Infof("")
logger.Infof("Successfully generated inprogress report to => %s\n", inprogress.GetReportPath())
return &gauge_messages.Empty{}, nil
}

Expand Down
8 changes: 0 additions & 8 deletions helper/helper.go

This file was deleted.

Loading

0 comments on commit 1074fee

Please sign in to comment.