Skip to content

Commit

Permalink
Add CI for code coverage and update README (#222)
Browse files Browse the repository at this point in the history
- Create coverage.yml
   - Add codecov.yml to ignore cmd and logs folders
- Update README.md
   - Add badges to show various CI status.
   - Add API Reference section and link to godoc.
   - Add Contributing section.
  • Loading branch information
fxamacker authored Nov 29, 2021
1 parent d4f41f5 commit 3d984d2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# coverage.yml Generate and upload Go code coverage report to Codecov.
# https://github.com/onflow/atree/blob/main/.github/workflows/coverage.yml
# 2021-11-26 Created.

name: coverage
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # allow GitHub to use latest v2.x of checkout
with:
fetch-depth: 2

- uses: actions/setup-go@v2 # allow GitHub to use latest v2.x of setup-go
with:
go-version: '1.17.x'

- name: Get dependencies
run: go get -v -t -d ./...

- name: Build project
run: go build ./...

- name: Generate coverage report
run: go test -timeout 60m -race -coverprofile=coverage.txt -covermode=atomic

- name: Upload coverage report to Codecov
uses: codecov/[email protected] # use v2.1.0, we can manually update uploader version if needed
with:
files: ./coverage.txt
fail_ci_if_error: false # we can set this to true after "Could not find a repository" upload error is fixed
verbose: true # optional (default = false)
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# Atree

[![](https://github.com/onflow/atree/workflows/ci/badge.svg)](https://github.com/onflow/atree/actions?query=workflow%3Aci)
[![](https://github.com/onflow/atree/workflows/linters/badge.svg)](https://github.com/onflow/atree/actions?query=workflow%3Alinters)
[![CodeQL](https://github.com/onflow/atree/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/onflow/atree/actions/workflows/codeql-analysis.yml)

Atree provides scalable arrays and scalable ordered maps. It is used by [Cadence](https://github.com/onflow/cadence) in the [Flow](https://github.com/onflow/flow-go) blockchain.

## API Reference

Atree's API is [documented](https://pkg.go.dev/github.com/onflow/atree#section-documentation) with godoc at pkg.go.dev and will be updated when new versions of Atree are tagged. Additional documentation will be added as time allows.

## Contributing

If you would like to contribute to Atree, have a look at the [contributing guide](https://github.com/onflow/atree/blob/main/CONTRIBUTING.md).

Additionally, all non-error code paths must be covered by tests. And pull requests should not lower the code coverage percent.

## License

The Atree library is licensed under the terms of the Apache license. See [LICENSE](LICENSE) for more information.
Expand Down
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ignore:
- "cmd/**/*"
- "logs/"

0 comments on commit 3d984d2

Please sign in to comment.