Skip to content

Commit

Permalink
add coverage badge, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
adwski committed Jan 31, 2024
1 parent 1f8910f commit 11673d2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
29 changes: 28 additions & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,31 @@ jobs:
- name: run tests
run: |
go test -v -count=1 -cover -coverpkg=./... -coverprofile=profile.cov --tags e2e ./...
go tool cover -func profile.cov
go tool cover -func=profile.cov
go tool cover -func=profile.cov -o=coverage.out
- name: coverage badge
uses: tj-actions/coverage-badge-go@v2
with:
filename: coverage.out

- name: verify changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files
with:
files: README.md

- name: commit badge
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore: update coverage badge"
- name: push badge
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.head_ref }}
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ test-nginx:

.PHONY: unittests
unittests:
go test ./... -v -count=1 -cover -coverpkg=./... -coverprofile=profile.cov ./...
go tool cover -func profile.cov
go test -v -count=1 ./...

.PHONY: cover
cover:
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Vidi

[![Coverage](https://img.shields.io/badge/Coverage-50.0%25-brightgreen)](https://github.com/tj-actions/coverage-badge-go/actions/workflows/test.yml)

WIP

This is a final project for Yandex Practicum's Go Course.
Expand Down Expand Up @@ -30,6 +32,17 @@ make docker-dev
make docker-dev-clean
```

### Tests

```bash
# run unit tests
make unittests

# run unit and end2end tests
# docker compose project should be stopped (it will be ran by the command)
make test-all
```

### Happy Path

User interaction flow is described [here](./docs/happy_path.md).

0 comments on commit 11673d2

Please sign in to comment.