Skip to content

Commit

Permalink
Set up continuous integration
Browse files Browse the repository at this point in the history
Continuous integration through Travis CI, and code coverage through
CodeCov have been set up. An integration build target has been developed
that can be used by Travis CI and CodeCov to perform continuous
integration and code coverage reporting on the GitHub repository of the
Sol Library.

Support for Clang was attempted, but failed the integration build owing
to a mismatch between Clang and Gcov. This will need to be addressed in
a subsequent issue.

This commit was squashed from the issue/14 branch.
  • Loading branch information
achakravarti committed Feb 3, 2019
1 parent a0f54ba commit 96eb3fc
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Build directory
bld/

# Prerequisites
*.d

Expand Down Expand Up @@ -42,6 +45,11 @@
*.idb
*.pdb

# Profiling files
*.gcno
*.gcda
*.gcov

# Kernel Module Compile Results
*.mod*
*.cmd
Expand All @@ -50,3 +58,4 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf

76 changes: 76 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
################################################################################
# SOL LIBRARY v1.0.0+41
#
# File: sol/.travis.yml
#
# Description:
# This YAML file is part of the Sol Library. It defines the Travis-CI
# build matrix.
#
# Authors:
# Abhishek Chakravarti <abhishek@taranjali.org>
#
# Copyright:
# (c) 2019, Abhishek Chakravarti.
# <abhishek@taranjali.org>
#
# License:
# Released under the GNU General Public License version 3 (GPLv3).
# <http://opensource.org/licenses/GPL-3.0>
# See the accompanying README.md file for complete licensing details.
#
# By continuing to use and/or distribute this file, you acknowledge that
# you have understood these license terms and accept them.
################################################################################




# Set programming language
language: c




# Set compilers; we're using only GCC for the time being
compiler:
- gcc




# Update GCC and GCov to version 8; this is needed for gcov to work
# properly; refer to the following site:
# https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91
before_install:
- sudo apt-get update
- sudo apt-get install build-essential software-properties-common -y
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update
- sudo apt-get install gcc-snapshot -y
- sudo apt-get update
- sudo apt-get install gcc-8 -y
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/gcov gcov /usr/bin/gcov-8




# Build target
script:
- make integration




# Generate coverage statistics for CodeCov
after_success:
- bash <(curl -s https://codecov.io/bash)




################################################################################
# EOF
# Built on hyperion [Tue Jan 29 02:37:24 UTC 2019]
################################################################################

119 changes: 119 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
################################################################################
# SOL LIBRARY v1.0.0+41
#
# File: sol/Makefile
#
# Description:
# This Makefile is part of the Sol Library. It defines the build rules
#
# Authors:
# Abhishek Chakravarti <abhishek@taranjali.org>
#
# Copyright:
# (c) 2018, Abhishek Chakravarti.
# <abhishek@taranjali.org>
#
# License:
# Released under the GNU General Public License version 3 (GPLv3).
# <http://opensource.org/licenses/GPL-3.0>
# See the accompanying README.md file for complete licensing details.
#
# By continuing to use and/or distribute this file, you acknowledge that
# you have understood these license terms and accept them.
################################################################################




# Set directory paths
DIR_BLD = bld
DIR_SRC = src
DIR_TEST = test




# Set commands
CMD_CC = $(CC)
CMD_SO = $(CC)
CMD_LD = $(CC)
CMD_COV = gcov




# Set command options
OPT_CC = -c -fPIC -std=c99 -Wall -g -O0 -coverage
OPT_SO = -shared -g -O0 -coverage
OPT_LD = -std=c99 -Wall -g -O0 -coverage
OPT_COV = -o $(DIR_BLD)




# Set command inputs
INP_SO = $(DIR_BLD)/test.o
INP_LD = $(DIR_TEST)/runner.c
INP_COV = $(DIR_BLD)/runner.gcda $(DIR_BLD)/test.gcda




# Set command dependencies
DEP_LD = $(OUT_SO) -lgcov
DEP_COV = *.gcno *.gcda




# Set command outputs
OUT_SO = $(DIR_BLD)/libsol.so
OUT_LD = $(DIR_BLD)/runner
OUT_COV = *.gcov




# Set rule to build test runner
$(OUT_LD): $(OUT_SO) $(INP_LD)
$(CMD_LD) $(OPT_LD) $(INP_LD) $(DEP_LD) -o $@




# Set rule to build shared library
$(OUT_SO): $(INP_SO)
$(CMD_SO) $(OPT_SO) $(INP_SO) -o $@




# Set rule to build objects for shared library
$(DIR_BLD)/%.o: $(DIR_SRC)/%.c
mkdir -p $(DIR_BLD); $(CMD_CC) $(OPT_CC) $< -o $@




# Rule to generate integration build
integration: $(OUT_LD)
./$(OUT_LD)
mv $(DEP_COV) $(DIR_BLD)
$(CMD_COV) $(OPT_COV) $(INP_COV)
mv $(OUT_COV) $(DIR_BLD)




# Rule to clean build artefacts
clean:
rm -rf $(DIR_BLD)




################################################################################
# EOF
# Built on hyperion [Tue Jan 29 02:37:24 UTC 2019]
################################################################################

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[![GitHub license](https://img.shields.io/github/license/achakravarti/sol.svg)](https://github.com/achakravarti/sol/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/achakravarti/sol.svg)](https://img.shields.io/github/release/achakravarti/sol) [![GitHub release date](https://img.shields.io/github/release-date/achakravarti/sol.svg)](https://img.shields.io/github/release-date/achakravarti/sol)
[![Build Status](https://travis-ci.org/achakravarti/sol.svg?branch=master)](https://travis-ci.org/achakravarti/sol) [![codecov](https://codecov.io/gh/achakravarti/sol/branch/master/graph/badge.svg)](https://codecov.io/gh/achakravarti/sol) [![GitHub last commit](https://img.shields.io/github/last-commit/achakravarti/sol.svg)](https://github.com/achakravarti/sol/graphs/commit-activity) [![Issues](http://img.shields.io/github/issues/achakravarti/sol.svg)](https://github.com/achakravarti/sol/issues) [![GitHub issues-closed](https://img.shields.io/github/issues-closed/achakravarti/sol.svg)](https://github.com/achakravarti/sol/issues?q=is%3Aissue+is%3Aclosed)
[![Build Status](https://travis-ci.com/achakravarti/sol.svg?branch=master)](https://travis-ci.com/achakravarti/sol) [![codecov](https://codecov.io/gh/achakravarti/sol/branch/master/graph/badge.svg)](https://codecov.io/gh/achakravarti/sol) [![GitHub last commit](https://img.shields.io/github/last-commit/achakravarti/sol.svg)](https://github.com/achakravarti/sol/graphs/commit-activity) [![Issues](http://img.shields.io/github/issues/achakravarti/sol.svg)](https://github.com/achakravarti/sol/issues) [![GitHub issues-closed](https://img.shields.io/github/issues-closed/achakravarti/sol.svg)](https://github.com/achakravarti/sol/issues?q=is%3Aissue+is%3Aclosed)
[![GitHub pull-requests](https://img.shields.io/github/issues-pr/achakravarti/sol.svg)](https://github.com/achakravarti/sol/pull/) [![GitHub pull-requests closed](https://img.shields.io/github/issues-pr-closed/achakravarti/sol.svg)](https://github.com/achakravart/sol/pull/) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg)](http://makeapullrequest.com) [![GitHub contributors](https://img.shields.io/github/contributors/achakravarti/sol.svg)](https://github.com/achakravarti/sol/graphs/contributors/)


Expand Down
10 changes: 10 additions & 0 deletions test/runner.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <stdio.h>

#include "../inc/error.h"
#include "../inc/test.h"

int main(void)
{
return 0;
}

0 comments on commit 96eb3fc

Please sign in to comment.