Skip to content

Commit

Permalink
Add simple CI based on GitHub Actions: run the test suite + ensure cl…
Browse files Browse the repository at this point in the history
…ean `make uninstall` + protect against introduction of new spelling errors (#349)

* Make GitHub Actions cover "make check" and "make uninstall"

Signed-off-by: Sebastian Pipping <[email protected]>

* Make GitHub Dependabot keep our GitHub Actions up to date

.. by sending us pull requests

Signed-off-by: Sebastian Pipping <[email protected]>

* Fix more typos

Signed-off-by: Sebastian Pipping <[email protected]>

* Make GitHub Actions enforce codespell-error clean code

Signed-off-by: Sebastian Pipping <[email protected]>

---------

Signed-off-by: Sebastian Pipping <[email protected]>
  • Loading branch information
hartwork authored Dec 18, 2024
1 parent 74342ef commit e4b3129
Show file tree
Hide file tree
Showing 13 changed files with 185 additions and 13 deletions.
29 changes: 29 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# Copyright (c) 2024 Sebastian Pipping <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see
# <http://www.gnu.org/licenses/>.
#
version: 2
updates:

- package-ecosystem: "github-actions"
commit-message:
include: "scope"
prefix: "Actions"
directory: "/"
labels:
- "enhancement"
schedule:
interval: "weekly"
45 changes: 45 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright (c) 2024 Sebastian Pipping <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see
# <http://www.gnu.org/licenses/>.
#
name: Enforce codespell-clean spelling

on:
pull_request:
push:
schedule:
- cron: '0 14 * * 5' # Every Friday 2pm
workflow_dispatch:

# Drop permissions to minimum for security
permissions:
contents: read

jobs:
codespell:
name: Enforce codespell-clean spelling
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- uses: codespell-project/actions-codespell@v2
with:
# "bu" is man page markup (file man/genhtml.1 and man/lcov.1)
# "MIS" is an abbreviation code of "Missed" (file bin/genhtml)
# "nd" is variable $nd (file bin/genhtml)
# "numbrs" is a variable name related to "branches" (file tests/bin/mkinfo)
# Words need to be (1) separated by a comma and (2) all lowercase!
ignore_words_list: bu,mis,nd,numbrs
98 changes: 98 additions & 0 deletions .github/workflows/run_test_suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#
# Copyright (c) 2024 Sebastian Pipping <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see
# <http://www.gnu.org/licenses/>.
#
name: Run the test suite

on:
pull_request:
push:
schedule:
- cron: '0 14 * * 5' # Every Friday 2pm
workflow_dispatch:

# Drop permissions to minimum for security
permissions:
contents: read

jobs:
test_suite:
name: Run the test suite
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |-
ubuntu_packages=(
# Perl runtime dependencies as documented in README
libcapture-tiny-perl # CPAN Capture::Tiny
libdatetime-perl # CPAN DateTime
libdevel-cover-perl # CPAN Devel::Cover
libdigest-md5-file-perl # CPAN Digest::MD5
libfile-spec-native-perl # CPAN File::Spec
libjson-xs-perl # CPAN JSON::XS
# CPAN Memory::Process, see below
# CPAN Module::Load::Conditional
libscalar-list-utils-perl # CPAN Scalar::Util
# CPAN Time::HiRes
# Non-Perl runtime dependencies as documented in README
llvm # for command "llvm-profdata"
python3-coverage # PyPI coverage
python3-xlsxwriter # PyPI xlsxwriter
# Additional dependencies for "make check"
libgd-perl # CPAN GD
)
set -x
sudo apt-get update
sudo apt-get install --no-install-recommends --yes -V "${ubuntu_packages[@]}"
sudo perl -MCPAN -e 'install(Memory::Process)' # no package in Ubuntu
sudo ln -s python3-coverage /usr/bin/coverage # until issue #347 is fixed
- name: make install
run: |-
set -x -o pipefail
make install PREFIX=/usr CFG_DIR=/etc DESTDIR="${PWD}/ROOT"
find ROOT/ | sort | xargs -r ls -ld
- name: make uninstall
run: |-
set -x -o pipefail
make uninstall PREFIX=/usr CFG_DIR=/etc DESTDIR="${PWD}/ROOT"
find ROOT/ | sort | xargs -r ls -ld
diff -u0 <(echo 'total 0') <(ls -l ROOT/) # i.e. fail CI if leftovers
- name: make check
run: |-
set -x -o pipefail
# NOTE: There are two things going on in this hackery:
# - So far "make check" exits with code 0 despite failures —
# see issue #348 — so we need a more manual approach to detect
# failing tests
# - We compare the number of failing tests to the known status
# quo — see issue #343 — so that
# - we have a chance for a green CI while also
# - we will notice when more of the existing tests start
# to fail.
make check |& tee /dev/stderr \
| grep -F ' failed, ' | tee /dev/stderr \
| grep -F -q ', 3 failed, ' \
|| { echo 'Number of tests expected to fail^^ does not match -- did you break an existing test?' >&2 ; false ; }
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ LCOV features and capabilities fall into 7 major categories:
to lcov format.

See "llvm2lcov --help" for brief instruction on how to use the
translator. Note tha llvm2lcov uses a similar set of command line
translator. Note that llvm2lcov uses a similar set of command line
and configuration file options as lcov, genhtml, and geninfo.

- py2lcov:
Expand Down
4 changes: 2 additions & 2 deletions bin/genhtml
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,7 @@ sub secondaryElementFileData
}

package CovTypeSummaryCallback;
# callback class to return total branches in each TLA categroy
# callback class to return total branches in each TLA category
sub new
{
my ($class, $summary, $covType) = @_;
Expand Down Expand Up @@ -6162,7 +6162,7 @@ sub compute_one
!$main::show_tla) {
$summary->[SummaryInfo::FILE_DETAILS] = undef;
} elsif ($main::show_tla) {
# just store the location fo the first coverpoint in each display
# just store the location of the first coverpoint in each display
# group - rather than returning the whole detail structure?
$summary->[SummaryInfo::FILE_DETAILS]->simplify();
}
Expand Down
2 changes: 1 addition & 1 deletion example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ test_differential:
@echo "point your browser to `realpath $(REPO)`/differential/index.html"

@echo "Step 7: Generate subset report for code review:"
@echo " (re-use revision control data cached in previous step)"
@echo " (reuse revision control data cached in previous step)"
(cd $(REPO) ; \
$(GENHTML) -o review --baseline-file baseline.info \
--diff-file udiff.txt --show-owners \
Expand Down
4 changes: 2 additions & 2 deletions lcovrc
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ mcdc_coverage = 0
# specify path to version identification script
#version_script = path_to_my_executable

# tell the tool to genenerate missing file version information when
# tell the tool to generate missing file version information when
# readind coverage DB file
# compute_file_version = 0 | 1

Expand All @@ -458,7 +458,7 @@ lcov_json_module = auto
# giving up
# max_fork_fails = 5

# Throtting control: the maximum number of files that genhtml will
# Throttling control: the maximum number of files that genhtml will
# handle in a single (parallel) thread
# max_tasks_per_core = 20

Expand Down
2 changes: 1 addition & 1 deletion lib/lcovutil.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7946,7 +7946,7 @@ sub _processParallelChunk
# collect pattern counts
my @pcounts;
foreach my $l (@{$save->[0]}) {
my @c = map({ $_->[-1] } @$l); # grap the counts
my @c = map({ $_->[-1] } @$l); # grab the counts
push(@pcounts, \@c);
}
$save->[0] = \@pcounts;
Expand Down
2 changes: 1 addition & 1 deletion man/lcov.1
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ Apply all substitution patterns in order - the result of the first pattern is us
If a file corresponding to the resulting name exists: return it.
.PP
.IP 3. 3
Apply the 'resolve' callback ot the final result of pattern substitutions.
Apply the 'resolve' callback to the final result of pattern substitutions.
.br
If a file corresponding to the resulting name exists: return it.
.PP
Expand Down
4 changes: 2 additions & 2 deletions man/lcovrc.5
Original file line number Diff line number Diff line change
Expand Up @@ -2843,7 +2843,7 @@ the
config file entry
or
.I \-\-source\=directory
command line option, used to searh for source files.
command line option, used to search for source files.
.PP
.RE

Expand Down Expand Up @@ -2903,7 +2903,7 @@ The select script is called as:

.B " select_script"
[callback_args]
.I lineDataJson annotateDataJson filenName lineNumber
.I lineDataJson annotateDataJson fileName lineNumber

or as:

Expand Down
2 changes: 1 addition & 1 deletion scripts/p4annotate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# of cached files - and may result in out-of-sync annotated file data.
#
# The '--verify' flag tells the tool to do some additional consistency
# checking whe merging local edits into the annotated file.
# checking when merging local edits into the annotated file.
#
# The '--log' flag specifies a file where the tool writes various annotation-
# related log messages.
Expand Down
2 changes: 1 addition & 1 deletion tests/lcov/errs/errs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ fi
# data consistency errors:
# - function marked 'hit' but no contained lines are hit
# - function marked 'not hit' but some contained line is hit
# - line marked 'hit' but no contained braches have been evaluated
# - line marked 'hit' but no contained branches have been evaluated
# - line marked 'not hit' but at least one contained branch has been evaluated
for i in funcNoLine lineNoFunc branchNoLine lineNoBranch ; do
Expand Down
2 changes: 1 addition & 1 deletion tests/lcov/extract/testContext.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

if [ 'die' = "$1" ] ; then
echo "dieing"
echo "dying"
exit 1
fi

Expand Down

0 comments on commit e4b3129

Please sign in to comment.