Skip to content

Commit 084f408

Browse files
committed
added github actions badge
1 parent 0dedc25 commit 084f408

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,38 @@ on:
88

99
jobs:
1010
build:
11-
strategy:
12-
matrix:
13-
compiler: [clang, gcc]
14-
1511
runs-on: ubuntu-latest
1612

1713
steps:
1814
- name: Checkout repository
19-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
2016

21-
- name: Install LCOV
17+
- name: Install dependencies
2218
run: |
2319
sudo apt-get update
24-
sudo apt-get install -y lcov
20+
sudo apt-get install -y gcc lcov libncurses5-dev
2521
26-
- name: Install coveralls-lcov
22+
- name: Build project
2723
run: |
28-
gem install coveralls-lcov
29-
30-
- name: Set up compiler ${{ matrix.compiler }}
31-
run: sudo apt-get install -y ${{ matrix.compiler }}
32-
33-
- name: Zero counters
34-
run: lcov --directory . --zerocounters
24+
make
3525
36-
- name: Build and run tests
26+
- name: Run tests
3727
run: |
38-
make
3928
./test-library.out
4029
4130
- name: Capture coverage info
42-
run: lcov --directory . --capture --output-file coverage.info
31+
run: |
32+
lcov --directory . --capture --output-file coverage.info
4333
4434
- name: Filter out system and test code
45-
run: lcov --remove coverage.info 'tests/*' '/usr/*' 'test-library*' --output-file coverage.info
35+
run: |
36+
lcov --remove coverage.info 'tests/*' '/usr/*' 'test-library*' --output-file coverage.info
4637
4738
- name: List coverage info
48-
run: lcov --list coverage.info
39+
run: |
40+
lcov --list coverage.info
4941
5042
- name: Upload coverage to Coveralls
51-
run: coveralls-lcov coverage.info
43+
run: |
44+
gem install coveralls-lcov
45+
coveralls-lcov coverage.info

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
[![Build Status](https://travis-ci.com/deftio/travis-ci-cpp-example.svg?branch=master)](https://travis-ci.com/deftio/travis-ci-cpp-example)
22
[![Coverage Status](https://coveralls.io/repos/github/deftio/travis-ci-cpp-example/badge.svg?branch=master)](https://coveralls.io/github/deftio/travis-ci-cpp-example?branch=master)
33
[![License](https://img.shields.io/badge/License-BSD%202--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)
4+
[![Github Actions Ci](https://github.com/deftio/C-and-Cpp-Tests-with-CI-CD-Example/actions/workflows/ci.yml/badge.svg)]
45

56
# Simple Example for C/C++ Testing with CI/CD
67

78
This repo covers setting up a basic testing suite with github badges for a C/C++ library. Its not meant to be deep tutorial on testing but just cover some basics of setting up unit tests, coverage tests, and continuous integration (in this case using either GitHub Actions or Travis-CI). The repo doesn't have a lot of code - there is a simple library which is tested for coverage and integration.
89

910
### Motivation
10-
I just wanted to make a small standalone test project to see tools and workflow for C (or C++) language testing.
11+
I just wanted to make a small standalone test project to show continuous integration tools and workflow for C (or C++) language testing.
1112

1213

1314

1415
## Features
1516

16-
The lib.h / lib.c files are broken out as examples of testing an embedded library. Most of the projects I work on are for embedded systems so I wanted a way to get a build badge for these embedded projects. Since many of those compilers and environments are not on Linux I wanted just a simple abstraction of how the Travis build project works without all the complexities of a "real" project.
17+
The lib.h / lib.c files are broken out as examples of testing an embedded library. Most of the projects I work on are for embedded systems so I wanted a way to get a build badge for these embedded projects. Since many of those compilers and environments are not on Linux I wanted just a simple abstraction of how the CI process works without all the complexities of a "real" project.
1718

1819

1920
## How it works

0 commit comments

Comments
 (0)