Skip to content

Commit e581804

Browse files
Merge pull request #5 from jacobwilliams/coverage
Coverage
2 parents 6a39c41 + 4b01ef0 commit e581804

File tree

9 files changed

+54
-29
lines changed

9 files changed

+54
-29
lines changed

.github/workflows/CI.yml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ jobs:
99
matrix:
1010
os: [ubuntu-latest]
1111
gcc_v: [10] # Version of GFortran we want to use.
12-
python-version: [3.7]
12+
python-version: [3.9]
1313
env:
1414
FC: gfortran-${{ matrix.gcc_v }}
1515
GCC_V: ${{ matrix.gcc_v }}
1616

1717
steps:
1818
- name: Checkout code
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3.0.2
2020
with:
2121
submodules: recursive
2222

@@ -29,7 +29,7 @@ jobs:
2929
uses: ts-graphviz/setup-graphviz@v1
3030

3131
- name: Setup Fortran Package Manager
32-
uses: fortran-lang/setup-fpm@v3
32+
uses: fortran-lang/setup-fpm@v4
3333
with:
3434
github-token: ${{ secrets.GITHUB_TOKEN }}
3535

@@ -43,25 +43,38 @@ jobs:
4343
- name: Install GFortran Linux
4444
if: contains( matrix.os, 'ubuntu')
4545
run: |
46-
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
47-
sudo apt-get update
48-
sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V}
49-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
50-
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
51-
--slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}
46+
sudo apt-get install lcov
47+
sudo update-alternatives \
48+
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc_v }} 100 \
49+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.gcc_v }} \
50+
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc_v }}
5251
53-
- name: Compile
54-
run: fpm build --profile release
52+
# - name: Compile
53+
# run: fpm build --profile release
5554

56-
- name: Run test
57-
run: fpm test
55+
- name: Run tests
56+
run: fpm test --profile debug --flag -coverage
57+
58+
- name: Create coverage report
59+
run: |
60+
mkdir -p ${{ env.COV_DIR }}
61+
lcov --capture --initial --base-directory . --directory build/gfortran_*/ --output-file ${{ env.COV_DIR }}/coverage.base
62+
lcov --capture --base-directory . --directory build/gfortran_*/ --output-file ${{ env.COV_DIR }}/coverage.capture
63+
lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info
64+
env:
65+
COV_DIR: build/coverage
66+
67+
- name: Upload coverage report
68+
uses: codecov/codecov-action@v2
69+
with:
70+
files: build/coverage/coverage.info
5871

5972
- name: Build documentation
6073
run: ford ./lsqr.md
6174

6275
- name: Deploy Documentation
6376
if: github.ref == 'refs/heads/master'
64-
uses: JamesIves/github-pages-deploy-action@4.1.0
77+
uses: JamesIves/github-pages-deploy-action@v4.3.3
6578
with:
6679
branch: gh-pages # The branch the action should deploy to.
6780
folder: doc # The folder the action should deploy.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,7 @@ bin
3535
install
3636

3737
# mac
38-
.DS_Store
38+
.DS_Store
39+
40+
# tests
41+
/LSQR.LIS

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
![LSQR](media/logo.png)
22
============
33

4-
![Build Status](https://github.com/jacobwilliams/LSQR/actions/workflows/CI.yml/badge.svg)
4+
### Status
5+
[![GitHub release](https://img.shields.io/github/release/jacobwilliams/LSQR.svg)](https://github.com/jacobwilliams/LSQR/releases/latest)
6+
[![CI Status](https://github.com/jacobwilliams/LSQR/actions/workflows/CI.yml/badge.svg)](https://github.com/jacobwilliams/LSQR/actions)
7+
[![codecov](https://codecov.io/gh/jacobwilliams/LSQR/branch/master/graph/badge.svg)](https://codecov.io/gh/jacobwilliams/LSQR)
8+
[![last-commit](https://img.shields.io/github/last-commit/jacobwilliams/LSQR)](https://github.com/jacobwilliams/LSQR/commits/master)
59

610
### Brief Description
711

@@ -68,7 +72,7 @@ lsqr = { git="https://github.com/jacobwilliams/lsqr.git" }
6872

6973
### Documentation
7074

71-
The latest API documentation can be found [here](http://jacobwilliams.github.io/LSQR/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford).
75+
The latest API documentation can be found [here](https://jacobwilliams.github.io/LSQR/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford).
7276

7377
### License
7478

codecov.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
comment:
2+
layout: header, changes, diff, sunburst
3+
coverage:
4+
ignore:
5+
- test
6+
- doc
7+
status:
8+
patch:
9+
default:
10+
target: 20%
11+
project:
12+
default:
13+
target: 20%

fpm.toml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,10 @@ keywords = ["conjugate-gradient", "sparse", "linear systems", "least-squares"]
99
[build]
1010
auto-executables = false
1111
auto-examples = false
12-
auto-tests = false
12+
auto-tests = true
1313

1414
[library]
1515
source-dir = "src"
1616

1717
[install]
18-
library = true
19-
20-
[[test]]
21-
name = "lsqrtest_ez"
22-
source-dir = "tests"
23-
main = "lsqrtest_ez.f90"
24-
25-
[[test]]
26-
name = "lsqrtest"
27-
source-dir = "tests"
28-
main = "lsqrtest.f90"
18+
library = true
File renamed without changes.
File renamed without changes.

tests/lsqrtest_ez.f90 renamed to test/lsqrtest_ez.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@ program main
4141
write(*,'(1P,A,*(E16.6))') 'A*x = ', matmul(a_mat, x_vec)
4242
write(*,'(1P,A,*(E16.6))') 'A*x - b = ', matmul(a_mat, x_vec) - b_vec
4343

44+
if (any(abs(matmul(a_mat, x_vec) - b_vec) > 1.0e-12)) error stop 'TEST FAILED'
45+
4446
end program main
4547
!***************************************************************************************************
File renamed without changes.

0 commit comments

Comments
 (0)