Skip to content

Commit 500e7ca

Browse files
authored
Cleanup, ::error:: usage, README updates (#27)
1 parent 4babc19 commit 500e7ca

2 files changed

Lines changed: 67 additions & 54 deletions

File tree

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ package.
1313
By default it processes the coverage data gathered during the action
1414
[gap-actions/run-test-for-packages](https://github.com/gap-actions/run-pkg-tests).
1515

16+
When using `codecov/codecov-action`, we recommend setting the (optional) input
17+
`fail_ci_if_error` to `true`, as otherwise uploads may silently fail. Moreover, it
18+
might be necessary to [add an upload token for Codecov](https://docs.codecov.com/docs/codecov-tokens).
19+
20+
1621
### What's new in v3
1722

1823
This action now requires `gap-actions/setup-gap@v3`.
@@ -37,12 +42,20 @@ jobs:
3742
steps:
3843
- uses: actions/checkout@v5
3944
- uses: gap-actions/setup-gap@v3
40-
- uses: gap-actions/build-pkg@v1
41-
- uses: gap-actions/run-pkg-tests@v2
45+
- uses: gap-actions/build-pkg@v2
46+
- uses: gap-actions/run-pkg-tests@v4
4247
- uses: gap-actions/process-coverage@v3
4348
- uses: codecov/codecov-action@v5
4449
```
4550
51+
The recommended configuration for `codecov/codecov-action` is as follows:
52+
```yaml
53+
- uses: codecov/codecov-action@v5
54+
with:
55+
fail_ci_if_error: true
56+
token: ${{ secrets.CODECOV_TOKEN }}
57+
```
58+
4659
## Contact
4760
Please submit bug reports, suggestions for improvements and patches via
4861
the [issue tracker](https://github.com/gap-actions/process-coverage/issues).

action.yml

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,58 +4,58 @@ description: 'Process coverage data'
44
runs:
55
using: "composite"
66
steps:
7-
- name: "Build io and profiling packages if necessary"
8-
shell: bash
9-
run: |
10-
# the following somewhat awkward `cd` invocation ensures
11-
# compatibility with both GAP <= 4.11 (with package dir names like
12-
# `pkg/io-1.2.3`) and GAP >= 4.12 (where it is `pkg/io`)
13-
cd $GAPROOT/pkg/io || cd $GAPROOT/pkg/io-*
14-
if [[ ! -f config.status ]] ; then
15-
./configure --with-gaproot=$GAPROOT
16-
fi
17-
make -j$(nproc)
7+
- name: "Build io and profiling packages if necessary"
8+
shell: bash
9+
run: |
10+
# the following somewhat awkward `cd` invocation ensures
11+
# compatibility with both GAP <= 4.11 (with package dir names like
12+
# `pkg/io-1.2.3`) and GAP >= 4.12 (where it is `pkg/io`)
13+
cd $GAPROOT/pkg/io || cd $GAPROOT/pkg/io-*
14+
if [[ ! -f config.status ]] ; then
15+
./configure --with-gaproot=$GAPROOT
16+
fi
17+
make -j$(nproc)
1818
19-
cd $GAPROOT/pkg/profiling || cd $GAPROOT/pkg/profiling-*
20-
if [[ ! -f Makefile ]] ; then
21-
if [[ -f configure.ac ]] ; then
22-
./configure --with-gaproot=$GAPROOT
23-
else
24-
./configure $GAPROOT
25-
fi
26-
fi
27-
make -j$(nproc)
19+
cd $GAPROOT/pkg/profiling || cd $GAPROOT/pkg/profiling-*
20+
if [[ ! -f Makefile ]] ; then
21+
if [[ -f configure.ac ]] ; then
22+
./configure --with-gaproot=$GAPROOT
23+
else
24+
./configure $GAPROOT
25+
fi
26+
fi
27+
make -j$(nproc)
2828
29-
- name: "Process coverage data"
30-
shell: bash
31-
run: |
32-
# generate library coverage reports
33-
$GAP -q <<GAPInput
34-
if LoadPackage("profiling") <> true then
35-
Print("ERROR: could not load profiling package");
36-
FORCE_QUIT_GAP(1);
37-
fi;
38-
d := Directory("coverage");
39-
covs := [];
40-
files := DirectoryContents(d);
41-
if files = fail then
42-
Print("no coverage data found\n");
43-
QUIT_GAP(0);
44-
fi;
45-
for f in files do
46-
if f in [".", ".."] then continue; fi;
47-
Add(covs, Filename(d, f));
48-
od;
49-
Print("Merging coverage results from ", covs, "\n");
50-
r := MergeLineByLineProfiles(covs);;
51-
# filtered out unwanted other packages to avoid bad coverage interaction
52-
r.line_info := Filtered(r.line_info, x -> not StartsWith( x[1], "$GAPROOT/" ) );;
53-
Print("Outputting JSON\n");
54-
OutputJsonCoverage(r, "gap-coverage.json");
55-
QUIT_GAP(0);
56-
GAPInput
29+
- name: "Process coverage data"
30+
shell: bash
31+
run: |
32+
# generate library coverage reports
33+
$GAP -q <<GAPInput
34+
if LoadPackage("profiling") <> true then
35+
Exec("echo \"::error::Could not load profiling package\"");
36+
FORCE_QUIT_GAP(1);
37+
fi;
38+
d := Directory("coverage");
39+
covs := [];
40+
files := DirectoryContents(d);
41+
if files = fail then
42+
Exec("echo \"::warning::No coverage data found\"");
43+
QUIT_GAP(0);
44+
fi;
45+
for f in files do
46+
if f in [".", ".."] then continue; fi;
47+
Add(covs, Filename(d, f));
48+
od;
49+
Print("Merging coverage results from ", covs, "\n");
50+
r := MergeLineByLineProfiles(covs);;
51+
# filtered out unwanted other packages to avoid bad coverage interaction
52+
r.line_info := Filtered(r.line_info, x -> not StartsWith( x[1], "$GAPROOT/" ) );;
53+
Print("Outputting JSON\n");
54+
OutputJsonCoverage(r, "gap-coverage.json");
55+
QUIT_GAP(0);
56+
GAPInput
5757
58-
- name: "generate source coverage reports by running gcov"
59-
shell: bash
60-
run: |
61-
find . -type f -name '*.gcno' -exec gcov -pb {} +
58+
- name: "generate source coverage reports by running gcov"
59+
shell: bash
60+
run: |
61+
find . -type f -name '*.gcno' -exec gcov -pb {} +

0 commit comments

Comments
 (0)