Skip to content

Commit

Permalink
fix #145: update link to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed Feb 23, 2020
1 parent 8009b56 commit 46ba329
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 69 deletions.
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
.gitignore export-ignore
.travis.yml export-ignore

Makefile export-ignore
/.github/ export-ignore

Makefile export-ignore
*.md export-ignore

*_test.go export-ignore
testdata/ export-ignore
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# code coverage and quality reports
*.out

# binaries
cc-test-reporter
45 changes: 28 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,45 @@ language: go

cache:
directories:
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod

env:
global:
- CODECLIMATE=https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
- GO111MODULE=on
- GOFLAGS=-mod=vendor
- CODECLIMATE=https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64

go:
- master
- 1.x
- 1.11.x
- 1.12.x
- 1.13.x
- master
- 1.x
- 1.11.x
- 1.12.x
- 1.13.x

matrix:
allow_failures:
- go: master

before_script:
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then curl -L $CODECLIMATE > ./cc-test-reporter; fi
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then chmod +x ./cc-test-reporter; fi
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then ./cc-test-reporter before-build; fi
- |
if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then
curl -L $CODECLIMATE > bin/cc-test-reporter
chmod +x bin/cc-test-reporter
bin/cc-test-reporter before-build
fi
script:
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then make test-with-coverage-profile; else make test; fi
- |
if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then
make test-with-coverage-profile
else
make test
fi
after_script:
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then export EXIT_CODE=$TRAVIS_TEST_RESULT; fi
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then export PREFIX=$(basename $(go list -m)); fi
- if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then ./cc-test-reporter after-build -t gocov -p $PREFIX; fi
- |
if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then
bin/cc-test-reporter after-build -t gocov -p $(basename $(go list -m)) --exit-code $TRAVIS_TEST_RESULT
fi
notifications:
slack: octolab:1eMS7IqOArBipiu31jYVd0cN
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 OctoLab, https://www.octolab.org/ <copyright@octolab.org>
Copyright (c) 2020 OctoLab, https://www.octolab.org/ <copyright@octolab.org>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
94 changes: 71 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,52 +1,100 @@
# sourced by https://github.com/octomation/makefiles

.DEFAULT_GOAL = test-with-coverage

SHELL = /bin/bash -euo pipefail

GO111MODULE = on
GOFLAGS = -mod=vendor
MODULE = $(shell go list -m)
PACKAGES = $(shell go list ./...)
PATHS = $(shell go list ./... | sed -e "s|\s+$(shell go list -m)/\{0,1\}||g")
SHELL = /bin/bash -euo pipefail
GOPRIVATE = go.octolab.net
GOPROXY = direct
LOCAL = $(MODULE)
MODULE = `go list -m`
PACKAGES = `go list ./... 2> /dev/null`
PATHS = $(shell echo $(PACKAGES) | sed -e "s|$(MODULE)/\{0,1\}||g")
TIMEOUT = 1s

.DEFAULT_GOAL = test-with-coverage
ifeq (, $(PACKAGES))
PACKAGES = $(MODULE)
endif

.PHONY: env
env:
@echo "GO111MODULE: $(GO111MODULE)"
@echo "GOFLAGS: $(GOFLAGS)"
ifeq (, $(PATHS))
PATHS = .
endif

export GO111MODULE := $(GO111MODULE)
export GOFLAGS := $(GOFLAGS)
export GOPRIVATE := $(GOPRIVATE)
export GOPROXY := $(GOPROXY)

.PHONY: go-env
go-env:
@echo "GO111MODULE: `go env GO111MODULE`"
@echo "GOFLAGS: $(strip `go env GOFLAGS`)"
@echo "GOPRIVATE: $(strip `go env GOPRIVATE`)"
@echo "GOPROXY: $(strip `go env GOPROXY`)"
@echo "LOCAL: $(LOCAL)"
@echo "MODULE: $(MODULE)"
@echo "PACKAGES: $(PACKAGES)"
@echo "PATHS: $(PATHS)"
@echo "SHELL: $(SHELL)"
@echo "PATHS: $(strip $(PATHS))"
@echo "TIMEOUT: $(TIMEOUT)"


.PHONY: deps
deps:
@go mod tidy && go mod vendor && go mod verify
@go mod download
@if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi

.PHONY: format
format:
@goimports -local $(dir $(shell go list -m)) -ungroup -w $(PATHS)
.PHONY: deps-clean
deps-clean:
@go clean -modcache

.PHONY: generate
generate:
@go generate $(PACKAGES)
.PHONY: deps-shake
deps-shake:
@go mod tidy

.PHONY: update
update: selector = '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}'
update:
@go get -mod= -u

.PHONY: refresh
refresh: update deps generate format test-with-coverage
@if command -v egg > /dev/null; then \
packages="`egg deps list`"; \
else \
packages="`go list -f $(selector) -m all`"; \
fi; go get -mod= -u $$packages

.PHONY: update-all
update-all:
@go get -mod= -u ./...

.PHONY: test
test:
@go test -race -timeout $(TIMEOUT) $(PACKAGES)

.PHONY: test-clean
test-clean:
@go clean -testcache

.PHONY: test-with-coverage
test-with-coverage:
@go test -cover -timeout $(TIMEOUT) $(PACKAGES) | column -t | sort -r

.PHONY: test-with-coverage-profile
test-with-coverage-profile:
@go test -cover -covermode count -coverprofile c.out -timeout $(TIMEOUT) $(PACKAGES)

.PHONY: format
format:
@goimports -local $(LOCAL) -ungroup -w $(PATHS)

.PHONY: generate
generate:
@go generate $(PACKAGES)


.PHONY: clean
clean: deps-clean test-clean

.PHONY: env
env: go-env

.PHONY: refresh
refresh: deps-shake update deps generate format test
49 changes: 25 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
>
> The most advanced interruptible mechanism to perform actions repetitively until successful.
[![Build][icon_build]][page_build]
[![Quality][icon_quality]][page_quality]
[![Documentation][icon_docs]][page_docs]
[![Coverage][icon_coverage]][page_coverage]
[![Awesome][icon_awesome]][page_awesome]
[![Build][build.icon]][build.page]
[![Quality][quality.icon]][quality.page]
[![Documentation][docs.icon]][docs.page]
[![Coverage][coverage.icon]][coverage.page]
[![Template][template.icon]][template.page]
[![Awesome][awesome.icon]][awesome.page]

## 💡 Idea

The package based on [github.com/Rican7/retry](https://github.com/Rican7/retry) but fully reworked
and focused on integration with the 🚧 [breaker][] and the built-in [context][] packages.

Full description of the idea is available [here][design].
Full description of the idea is available [here][design.page].

## 🏆 Motivation

Expand Down Expand Up @@ -175,11 +176,11 @@ You can use [go modules](https://github.com/golang/go/wiki/Modules) or
[dep](https://golang.github.io/dep/) to manage its version.

```bash
$ go get -u github.com/kamilsk/retry # inside GOPATH and for old Go versions

$ go get -u github.com/kamilsk/retry/v4 # inside Go module, works well since Go 1.11

# inside GOPATH and for old Go versions
$ go get -u github.com/kamilsk/retry
$ dep ensure -add github.com/kamilsk/retry@v4.0.0
# inside Go module, works well since Go 1.11
$ go get -u github.com/kamilsk/retry/v4
```

## 🤲 Outcomes
Expand All @@ -200,26 +201,26 @@ See more details [here][cli].

made with ❤️ for everyone

[icon_awesome]: https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg
[icon_build]: https://travis-ci.org/kamilsk/retry.svg?branch=v4
[icon_coverage]: https://api.codeclimate.com/v1/badges/ed88afbc0754e49e9d2d/test_coverage
[icon_docs]: https://godoc.org/github.com/kamilsk/retry?status.svg
[icon_quality]: https://goreportcard.com/badge/github.com/kamilsk/retry

[page_awesome]: https://github.com/avelino/awesome-go#utilities
[page_build]: https://travis-ci.org/kamilsk/retry
[page_coverage]: https://codeclimate.com/github/kamilsk/retry/test_coverage
[page_docs]: https://godoc.org/github.com/kamilsk/retry
[page_quality]: https://goreportcard.com/report/github.com/kamilsk/retry
[awesome.icon]: https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg
[awesome.page]: https://github.com/avelino/awesome-go#utilities
[build.icon]: https://travis-ci.org/kamilsk/retry.svg?branch=v4
[build.page]: https://travis-ci.org/kamilsk/retry
[coverage.icon]: https://api.codeclimate.com/v1/badges/ed88afbc0754e49e9d2d/test_coverage
[coverage.page]: https://codeclimate.com/github/kamilsk/retry/test_coverage
[design.page]: https://www.notion.so/octolab/retry-cab5722faae445d197e44fbe0225cc98?r=0b753cbf767346f5a6fd51194829a2f3
[docs.page]: https://pkg.go.dev/github.com/kamilsk/retry/v4
[docs.icon]: https://img.shields.io/badge/docs-pkg.go.dev-blue
[promo.page]: https://github.com/kamilsk/retry
[quality.icon]: https://goreportcard.com/badge/github.com/kamilsk/retry
[quality.page]: https://goreportcard.com/report/github.com/kamilsk/retry
[template.page]: https://github.com/octomation/go-module
[template.icon]: https://img.shields.io/badge/template-go--module-blue

[breaker]: https://github.com/kamilsk/breaker
[cli]: https://github.com/kamilsk/try
[cli.demo]: https://asciinema.org/a/150367
[cli.preview]: https://asciinema.org/a/150367.png
[context]: https://pkg.go.dev/context
[design]: https://www.notion.so/octolab/retry-cab5722faae445d197e44fbe0225cc98?r=0b753cbf767346f5a6fd51194829a2f3
[egg]: https://github.com/kamilsk/egg
[promo]: https://github.com/kamilsk/retry

[tmp.docs]: https://nicedoc.io/kamilsk/retry?theme=dark
[tmp.history]: https://github.githistory.xyz/kamilsk/retry/blob/v4/README.md

0 comments on commit 46ba329

Please sign in to comment.