Skip to content

Commit

Permalink
Tests coverage: add codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
polesskiy-dev committed Oct 18, 2023
1 parent e70712e commit e2e190c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
force_orphan: true
publish_branch: gh-pages

run-tests:
run-tests-with-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -42,4 +42,13 @@ jobs:
- name: Install dependencies
run: sudo apt-get install gcc make
- name: Run tests
run: make -C test tests
run: make
- name: Coverage data
run: gcov -bc src/**/*.c
- name: List coverage data
run: |
tree ./
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ html
# test coverage
*.gcda
*.gcno
*.gcov

# Linker output
*.ilk
Expand Down
8 changes: 4 additions & 4 deletions test/Makefile → Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Compiler
CC = gcc -std=c99 #-Wall -Wextra -Werror -pedantic -g
CC = gcc -std=c99 -fprofile-arcs -ftest-coverage -O0

# Directories
SRC_DIR = ../src
TEST_DIR = ./
UNITY_DIR = ../libraries/Unity/src
SRC_DIR = src
TEST_DIR = test
UNITY_DIR = libraries/Unity/src

# Source files and objects
SRCS = $(wildcard $(SRC_DIR)/**/*.c)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
![CI Status](https://github.com/polesskiy-dev/active-object-fsm/actions/workflows/ci.yml/badge.svg?branch=main)
[![codecov](https://codecov.io/gh/polesskiy-dev/active-object-fsm/graph/badge.svg?token=0MO4ODZ1HA)](https://codecov.io/gh/polesskiy-dev/active-object-fsm)
[![Documentation](https://img.shields.io/badge/docs-Doxygen-blue.svg)](https://polesskiy-dev.github.io/active-object-fsm/)
![GitHub release (with filter)](https://img.shields.io/github/v/release/polesskiy-dev/active-object-fsm)

Expand Down Expand Up @@ -54,10 +55,9 @@ $ brew install graphviz # install Graphviz (MacOS)
$ for file in ./**/*.gv; do dot -Tsvg "$file" > "${file%.gv}.svg"; done # dot -Tsvg file.gv > file.svg
```

### TODO: Code coverage
## Code coverage

Based on [Codecov](https://about.codecov.io/):

[How to Set Up Codecov with C and GitHub Actions in 2022](https://about.codecov.io/blog/how-to-set-up-codecov-with-c-and-github-actions/)
[Codecov](https://about.codecov.io/) Graph:

![codecov](https://codecov.io/gh/polesskiy-dev/active-object-fsm/graphs/sunburst.svg?token=0MO4ODZ1HA)

Binary file removed docs/active-object-typings.png
Binary file not shown.

0 comments on commit e2e190c

Please sign in to comment.