Skip to content

Commit

Permalink
Add coveralls instead of codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
iliafrenkel committed Aug 1, 2021
1 parent 756fb1d commit 7a20754
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ jobs:
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.txt
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Send coverage report to Coveralls
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=coverage.txt -service=github

services:
postgres:
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
<h1>Go PB - Pastebin alternative, written in Go</h1>

[![License MIT](https://img.shields.io/badge/license-MIT-green)](./LICENSE.txt)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](./docs/CODE_OF_CONDUCT.md)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](./docs/CODE_OF_CONDUCT.md)

![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/iliafrenkel/go-pb?include_prereleases&sort=semver)
[![codecov](https://codecov.io/gh/iliafrenkel/go-pb/branch/main/graph/badge.svg?token=WR1DWNVE58)](https://codecov.io/gh/iliafrenkel/go-pb)
[![Test](https://github.com/iliafrenkel/go-pb/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/iliafrenkel/go-pb/actions/workflows/test.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/iliafrenkel/go-pb)](https://goreportcard.com/report/github.com/iliafrenkel/go-pb)

</div>

Expand Down
17 changes: 7 additions & 10 deletions src/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ func (p *Paste) Expiration() string {
}
// Seconds-based time units
const (
Minute = 60
Hour = 60 * Minute
Day = 24 * Hour
Week = 7 * Day
Month = 30 * Day
Year = 12 * Month
LongTime = 37 * Year
Minute = 60
Hour = 60 * Minute
Day = 24 * Hour
Week = 7 * Day
Month = 30 * Day
Year = 12 * Month
)

diff := time.Until(p.Expires) / time.Second
Expand Down Expand Up @@ -79,9 +78,7 @@ func (p *Paste) Expiration() string {
return fmt.Sprintf("%d months", diff/Month)
case diff < 18*Month:
return "~1 year"
case diff < 2*Year:
return "~2 years"
case diff < LongTime:
case diff < 20*Year:
return fmt.Sprintf("%d years", diff/Year)
}

Expand Down

0 comments on commit 7a20754

Please sign in to comment.