Skip to content

Commit e4b3129

Browse files
authored
Add simple CI based on GitHub Actions: run the test suite + ensure clean 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]>
1 parent 74342ef commit e4b3129

File tree

13 files changed

+185
-13
lines changed

13 files changed

+185
-13
lines changed

.github/dependabot.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Copyright (c) 2024 Sebastian Pipping <[email protected]>
3+
#
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation; either version 2 of the License, or (at
7+
# your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful, but
10+
# WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program; if not, see
16+
# <http://www.gnu.org/licenses/>.
17+
#
18+
version: 2
19+
updates:
20+
21+
- package-ecosystem: "github-actions"
22+
commit-message:
23+
include: "scope"
24+
prefix: "Actions"
25+
directory: "/"
26+
labels:
27+
- "enhancement"
28+
schedule:
29+
interval: "weekly"

.github/workflows/codespell.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Copyright (c) 2024 Sebastian Pipping <[email protected]>
3+
#
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation; either version 2 of the License, or (at
7+
# your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful, but
10+
# WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program; if not, see
16+
# <http://www.gnu.org/licenses/>.
17+
#
18+
name: Enforce codespell-clean spelling
19+
20+
on:
21+
pull_request:
22+
push:
23+
schedule:
24+
- cron: '0 14 * * 5' # Every Friday 2pm
25+
workflow_dispatch:
26+
27+
# Drop permissions to minimum for security
28+
permissions:
29+
contents: read
30+
31+
jobs:
32+
codespell:
33+
name: Enforce codespell-clean spelling
34+
runs-on: ubuntu-24.04
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: codespell-project/actions-codespell@v2
39+
with:
40+
# "bu" is man page markup (file man/genhtml.1 and man/lcov.1)
41+
# "MIS" is an abbreviation code of "Missed" (file bin/genhtml)
42+
# "nd" is variable $nd (file bin/genhtml)
43+
# "numbrs" is a variable name related to "branches" (file tests/bin/mkinfo)
44+
# Words need to be (1) separated by a comma and (2) all lowercase!
45+
ignore_words_list: bu,mis,nd,numbrs

.github/workflows/run_test_suite.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#
2+
# Copyright (c) 2024 Sebastian Pipping <[email protected]>
3+
#
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation; either version 2 of the License, or (at
7+
# your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful, but
10+
# WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program; if not, see
16+
# <http://www.gnu.org/licenses/>.
17+
#
18+
name: Run the test suite
19+
20+
on:
21+
pull_request:
22+
push:
23+
schedule:
24+
- cron: '0 14 * * 5' # Every Friday 2pm
25+
workflow_dispatch:
26+
27+
# Drop permissions to minimum for security
28+
permissions:
29+
contents: read
30+
31+
jobs:
32+
test_suite:
33+
name: Run the test suite
34+
runs-on: ubuntu-24.04
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Install dependencies
39+
run: |-
40+
ubuntu_packages=(
41+
# Perl runtime dependencies as documented in README
42+
libcapture-tiny-perl # CPAN Capture::Tiny
43+
libdatetime-perl # CPAN DateTime
44+
libdevel-cover-perl # CPAN Devel::Cover
45+
libdigest-md5-file-perl # CPAN Digest::MD5
46+
libfile-spec-native-perl # CPAN File::Spec
47+
libjson-xs-perl # CPAN JSON::XS
48+
# CPAN Memory::Process, see below
49+
# CPAN Module::Load::Conditional
50+
libscalar-list-utils-perl # CPAN Scalar::Util
51+
# CPAN Time::HiRes
52+
53+
# Non-Perl runtime dependencies as documented in README
54+
llvm # for command "llvm-profdata"
55+
python3-coverage # PyPI coverage
56+
python3-xlsxwriter # PyPI xlsxwriter
57+
58+
# Additional dependencies for "make check"
59+
libgd-perl # CPAN GD
60+
)
61+
set -x
62+
63+
sudo apt-get update
64+
sudo apt-get install --no-install-recommends --yes -V "${ubuntu_packages[@]}"
65+
66+
sudo perl -MCPAN -e 'install(Memory::Process)' # no package in Ubuntu
67+
68+
sudo ln -s python3-coverage /usr/bin/coverage # until issue #347 is fixed
69+
70+
- name: make install
71+
run: |-
72+
set -x -o pipefail
73+
make install PREFIX=/usr CFG_DIR=/etc DESTDIR="${PWD}/ROOT"
74+
find ROOT/ | sort | xargs -r ls -ld
75+
76+
- name: make uninstall
77+
run: |-
78+
set -x -o pipefail
79+
make uninstall PREFIX=/usr CFG_DIR=/etc DESTDIR="${PWD}/ROOT"
80+
find ROOT/ | sort | xargs -r ls -ld
81+
diff -u0 <(echo 'total 0') <(ls -l ROOT/) # i.e. fail CI if leftovers
82+
83+
- name: make check
84+
run: |-
85+
set -x -o pipefail
86+
# NOTE: There are two things going on in this hackery:
87+
# - So far "make check" exits with code 0 despite failures —
88+
# see issue #348 — so we need a more manual approach to detect
89+
# failing tests
90+
# - We compare the number of failing tests to the known status
91+
# quo — see issue #343 — so that
92+
# - we have a chance for a green CI while also
93+
# - we will notice when more of the existing tests start
94+
# to fail.
95+
make check |& tee /dev/stderr \
96+
| grep -F ' failed, ' | tee /dev/stderr \
97+
| grep -F -q ', 3 failed, ' \
98+
|| { echo 'Number of tests expected to fail^^ does not match -- did you break an existing test?' >&2 ; false ; }

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ LCOV features and capabilities fall into 7 major categories:
450450
to lcov format.
451451

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

456456
- py2lcov:

bin/genhtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,7 @@ sub secondaryElementFileData
19091909
}
19101910

19111911
package CovTypeSummaryCallback;
1912-
# callback class to return total branches in each TLA categroy
1912+
# callback class to return total branches in each TLA category
19131913
sub new
19141914
{
19151915
my ($class, $summary, $covType) = @_;
@@ -6162,7 +6162,7 @@ sub compute_one
61626162
!$main::show_tla) {
61636163
$summary->[SummaryInfo::FILE_DETAILS] = undef;
61646164
} elsif ($main::show_tla) {
6165-
# just store the location fo the first coverpoint in each display
6165+
# just store the location of the first coverpoint in each display
61666166
# group - rather than returning the whole detail structure?
61676167
$summary->[SummaryInfo::FILE_DETAILS]->simplify();
61686168
}

example/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ test_differential:
212212
@echo "point your browser to `realpath $(REPO)`/differential/index.html"
213213

214214
@echo "Step 7: Generate subset report for code review:"
215-
@echo " (re-use revision control data cached in previous step)"
215+
@echo " (reuse revision control data cached in previous step)"
216216
(cd $(REPO) ; \
217217
$(GENHTML) -o review --baseline-file baseline.info \
218218
--diff-file udiff.txt --show-owners \

lcovrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ mcdc_coverage = 0
435435
# specify path to version identification script
436436
#version_script = path_to_my_executable
437437

438-
# tell the tool to genenerate missing file version information when
438+
# tell the tool to generate missing file version information when
439439
# readind coverage DB file
440440
# compute_file_version = 0 | 1
441441

@@ -458,7 +458,7 @@ lcov_json_module = auto
458458
# giving up
459459
# max_fork_fails = 5
460460

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

lib/lcovutil.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7946,7 +7946,7 @@ sub _processParallelChunk
79467946
# collect pattern counts
79477947
my @pcounts;
79487948
foreach my $l (@{$save->[0]}) {
7949-
my @c = map({ $_->[-1] } @$l); # grap the counts
7949+
my @c = map({ $_->[-1] } @$l); # grab the counts
79507950
push(@pcounts, \@c);
79517951
}
79527952
$save->[0] = \@pcounts;

man/lcov.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ Apply all substitution patterns in order - the result of the first pattern is us
791791
If a file corresponding to the resulting name exists: return it.
792792
.PP
793793
.IP 3. 3
794-
Apply the 'resolve' callback ot the final result of pattern substitutions.
794+
Apply the 'resolve' callback to the final result of pattern substitutions.
795795
.br
796796
If a file corresponding to the resulting name exists: return it.
797797
.PP

man/lcovrc.5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2843,7 +2843,7 @@ the
28432843
config file entry
28442844
or
28452845
.I \-\-source\=directory
2846-
command line option, used to searh for source files.
2846+
command line option, used to search for source files.
28472847
.PP
28482848
.RE
28492849

@@ -2903,7 +2903,7 @@ The select script is called as:
29032903

29042904
.B " select_script"
29052905
[callback_args]
2906-
.I lineDataJson annotateDataJson filenName lineNumber
2906+
.I lineDataJson annotateDataJson fileName lineNumber
29072907

29082908
or as:
29092909

0 commit comments

Comments
 (0)