|
Packit |
0b5880 |
Coding Standards
|
|
Packit |
0b5880 |
================
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Please try and stick to the GNU coding standards. A lot of hard work
|
|
Packit |
0b5880 |
went into making Check compatible with the standards, and would be
|
|
Packit |
0b5880 |
nice if that work didn't erode. I decided on the standards because
|
|
Packit |
0b5880 |
they work well for a lot of programs much bigger than Check. Ok,
|
|
Packit |
0b5880 |
since you're wondering, the advantages of sticking to the standards
|
|
Packit |
0b5880 |
are three-fold:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
1) consistent style within the project
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
2) being familiar with the standards lets you work on lots of
|
|
Packit |
0b5880 |
different GNU standards-compliant projects pretty easily
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
3) it reduces the number of decisions that must be made
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Release Process
|
|
Packit |
0b5880 |
===============
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
To create a release one will need to be a member of the libcheck organization
|
|
Packit |
0b5880 |
on GitHub. If you are not a member, a current member can add you
|
|
Packit |
0b5880 |
by going to:
|
|
Packit |
0b5880 |
https://github.com/orgs/libcheck/people
|
|
Packit |
0b5880 |
and submitting an invite.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
1) To create a release, start in a configured in-place
|
|
Packit |
0b5880 |
checkout of the Check project:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
$ git clone https://github.com/libcheck/check.git
|
|
Packit |
0b5880 |
$ cd check
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
2) Determine the version of Check to release, and update
|
|
Packit |
0b5880 |
the configure.ac script:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
AC_INIT([Check], [0.10.1], [check-devel at lists dot sourceforge dot net])
|
|
Packit |
0b5880 |
CHECK_MAJOR_VERSION=0
|
|
Packit |
0b5880 |
CHECK_MINOR_VERSION=10
|
|
Packit |
0b5880 |
CHECK_MICRO_VERSION=1
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
(Remember to update both the AC_INIT line and each of the CHECK_*_VERSION fields).
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
3) Update the header in the NEWS file to mention the release:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Sun Aug 2, 2015: Released Check 0.10.1
|
|
Packit |
0b5880 |
2015-08-02 19:21:14 +0000
|
|
Packit |
0b5880 |
based on hash f399542eeceb97703bca496b68bb39044e8baa01
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
4) Update index.html mentioning the release. Look for the following:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
5) Attempt to build the release locally
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
$ autoreconf -i
|
|
Packit |
0b5880 |
$ ./configure
|
|
Packit |
0b5880 |
$ make distcheck
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
If this passes, a tarball with the current release number will be in the current
|
|
Packit |
0b5880 |
directory. Make note of this, as it will be uploaded to GitHub later.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
6) Commit the changes to configure.ac, NEWS, and index.html to the Check project's
|
|
Packit |
0b5880 |
master branch, with the commit message:
|
|
Packit |
0b5880 |
"Update for release"
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
7) Log On to GitHub and navigate to:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
https://github.com/libcheck/check/releases
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Click "Draft a New Release".
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Enter the release version to the Tag Version box, and enter the
|
|
Packit |
0b5880 |
git hash into the Target selector.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Fill in the Release Title field.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Describe the release with something similar to the following:
|
|
Packit |
0b5880 |
=====
|
|
Packit |
0b5880 |
<some sentence about the release, e.g. "This is a bug fix release.">
|
|
Packit |
0b5880 |
Please test it out and report any problems you might have.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Changes:
|
|
Packit |
0b5880 |
<paste contents of NEWS here for the release>
|
|
Packit |
0b5880 |
=====
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Attach the tarball for the release, then publish the release.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
8) Use the following template to announce the release via email:
|
|
Packit |
0b5880 |
=====
|
|
Packit |
0b5880 |
Subject: check-X.Y.Z released
|
|
Packit |
0b5880 |
Hi,
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
<some sentence about the release, e.g. "This is a bug fix release.">
|
|
Packit |
0b5880 |
Please test it out and report any problems you might have.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
https://github.com/libcheck/check/releases
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Thanks,
|
|
Packit |
0b5880 |
`whoami`
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
<paste contents of NEWS for the release here>
|
|
Packit |
0b5880 |
=====
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
9) Update the development header in the NEWS file and commit the result.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
10) Push updated website (see section below)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Congratulations, you are done!
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Update website
|
|
Packit |
0b5880 |
==============
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
The Check website is automatically hosted from the contents of
|
|
Packit |
0b5880 |
the gh-pages branch in the Check git repository. To update
|
|
Packit |
0b5880 |
the website, merge the contents of the master branch into
|
|
Packit |
0b5880 |
the gh-pages branch.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
To update the generated documentation for the website:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
$ git remote -v
|
|
Packit |
0b5880 |
github https://github.com/libcheck/check.git (fetch)
|
|
Packit |
0b5880 |
github https://github.com/libcheck/check.git (push)
|
|
Packit |
0b5880 |
$ git fetch github
|
|
Packit |
0b5880 |
$ git checkout github/gh-pages -b gh-pages
|
|
Packit |
0b5880 |
Branch gh-pages set up to track remote branch gh-pages from github.
|
|
Packit |
0b5880 |
Switched to a new branch 'gh-pages'
|
|
Packit |
0b5880 |
$ git merge github/master
|
|
Packit |
0b5880 |
First, rewinding head to replay your work on top of it...
|
|
Packit |
0b5880 |
Fast-forwarded gh-pages to github/master.
|
|
Packit |
0b5880 |
$ autoreconf -i
|
|
Packit |
0b5880 |
$ ./configure
|
|
Packit |
0b5880 |
$ make clean
|
|
Packit |
0b5880 |
$ make
|
|
Packit |
0b5880 |
$ make doc/check_html
|
|
Packit |
0b5880 |
$ make doc/doxygen
|
|
Packit |
0b5880 |
$ git add doc
|
|
Packit |
0b5880 |
$ git commit -m “Update documentation”
|
|
Packit |
0b5880 |
$ git push github gh-pages:gh-pages
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Automatic building of pull requests
|
|
Packit |
0b5880 |
===============
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
The GitHub project is configured to build pull requests either when
|
|
Packit |
0b5880 |
asked or automatically. This is done using the GitHub Pull Request
|
|
Packit |
0b5880 |
Builder Plugin. Documentation here:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
When a new pull request is opened in the project and the author of the pull request
|
|
Packit |
0b5880 |
isn't white-listed, builder will ask "Can one of the admins verify this patch?".
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
An admin can add one of the following comments to the pull request:
|
|
Packit |
0b5880 |
"ok to test" to accept this pull request for testing
|
|
Packit |
0b5880 |
"test this please" for a one time test run
|
|
Packit |
0b5880 |
"add to whitelist" to add the author to the whitelist
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
If the build fails for other various reasons you can rebuild.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
"retest this please" to start a new build
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
When a build is triggered a job on the Jenkins instance will start:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
https://check.ci.cloudbees.com/job/github-merge-builder/
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
When complete, a comment will be added to the pull request, informing
|
|
Packit |
0b5880 |
of the result.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
An admin can be added to the Jenkins instance by adding a username
|
|
Packit |
0b5880 |
to the "Admin list" setting under the "GitHub Pull Request Builder"
|
|
Packit |
0b5880 |
section here:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
https://check.ci.cloudbees.com/configure
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
This works because there is a user in the libcheck organization,
|
|
Packit |
0b5880 |
"check-builder", which the Jenkins instance uses to install a
|
|
Packit |
0b5880 |
git hook and push comments to pull requests.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Using gcov
|
|
Packit |
0b5880 |
===============
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
The gcov tool can be used to determine the unit test coverage in Check
|
|
Packit |
0b5880 |
itself. This is currently supported on GNU/Linux only. To enable the
|
|
Packit |
0b5880 |
necessary build time flags, add the following argument to the
|
|
Packit |
0b5880 |
configure script:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
--enable-gcov
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Once the unit tests have been run with
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
$ make check
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
assuming the terminal is in the top src directory, the following will
|
|
Packit |
0b5880 |
generate summary information using gcov:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
$ cp src/*.c src/.libs/
|
|
Packit |
0b5880 |
$ cd src/.libs
|
|
Packit |
0b5880 |
$ for file in `ls *.c`; do
|
|
Packit |
0b5880 |
gcov -f $file > $file.gcov.summary.txt
|
|
Packit |
0b5880 |
mv $file.gcov $file.gcov.txt
|
|
Packit |
0b5880 |
done
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
The *.gcov.txt files will contain the source code annotated with
|
|
Packit |
0b5880 |
the number of times each line was executed. The .*gcov.summary.txt
|
|
Packit |
0b5880 |
files will contain a line execution summary per function.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
To determine the line execution summary for all of Check, either
|
|
Packit |
0b5880 |
the gcovr tool can be used, or the following quick-and-dirty script:
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
$ for file in ls *.summary.txt; do cat $file; done \
|
|
Packit |
0b5880 |
| grep "Lines executed" | cut -d ":" -f 2 | tr -d "%" \
|
|
Packit |
0b5880 |
| awk '{checked+=$1*$3/100; total+=$3} END {print checked/total*100}'
|