Skip to content

Commit c4ddcc9

Browse files
committed
Merge branch 'main' of https://github.com/fortran-lang/minpack into test-refactoring
2 parents 9081a39 + 96c279d commit c4ddcc9

File tree

3 files changed

+47
-7
lines changed

3 files changed

+47
-7
lines changed

.codecov.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fixes:
2+
- "/home/runner/work/minpack/minpack::"
3+
4+
ignore:
5+
- "python/**/test_*.py"
6+
- "test/**"
7+
- "examples/**"

.github/workflows/CI.yml

+21-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ jobs:
1010
build: [fpm, meson]
1111
os: [ubuntu-latest, macos-latest, windows-latest]
1212
gcc: [10] # Version of GFortran we want to use.
13+
build-type: [debug]
14+
include:
15+
- build: meson
16+
os: ubuntu-latest
17+
gcc: 10
18+
build-type: coverage
19+
1320
defaults:
1421
run:
1522
shell: ${{ contains(matrix.os, 'windows') && 'powershell' || 'bash -l {0}' }}
@@ -61,6 +68,8 @@ jobs:
6168
uses: mamba-org/provision-with-micromamba@main
6269
with:
6370
environment-file: config/ci/${{ matrix.build }}-env.yaml
71+
extra-specs: |
72+
${{ matrix.build-type == 'coverage' && 'gcovr' || '' }}
6473
6574
- name: Compile (fpm)
6675
if: ${{ matrix.build == 'fpm' }}
@@ -80,14 +89,17 @@ jobs:
8089
meson setup _build
8190
--libdir=lib
8291
--prefix=${{ contains(matrix.os, 'windows') && '$pwd\_dist' || '$PWD/_dist' }}
92+
${{ matrix.build-type == 'coverage' && '-Db_coverage=true' || '' }}
8393
8494
- name: Compile project (meson)
8595
if: ${{ matrix.build == 'meson' }}
8696
run: meson compile -C _build
8797

8898
- name: Run testsuite (meson)
8999
if: ${{ matrix.build == 'meson' }}
90-
run: meson test -C _build --no-rebuild --print-errorlogs
100+
run: |
101+
meson test -C _build --no-rebuild --print-errorlogs
102+
${{ matrix.build-type == 'coverage' && 'ninja -C _build coverage' || '' }}
91103
92104
- name: Install project (meson)
93105
if: ${{ matrix.build == 'meson' }}
@@ -112,12 +124,16 @@ jobs:
112124
OUTPUT: minpack-${{ matrix.os }}.tar
113125

114126
- name: Upload package
115-
if: ${{ matrix.build == 'meson' }}
127+
if: ${{ matrix.build == 'meson' && matrix.build-type != 'coverage' }}
116128
uses: actions/upload-artifact@v2
117129
with:
118130
name: ${{ env.MINPACK_OUTPUT }}
119131
path: ${{ env.MINPACK_OUTPUT }}
120132

133+
- name: Upload coverage report
134+
if: ${{ matrix.build-type == 'coverage' }}
135+
uses: codecov/codecov-action@v2
136+
121137

122138
Python:
123139
needs:
@@ -232,6 +248,9 @@ jobs:
232248
LD_LIBRARY_PATH: ${{ env.LD_LIBRARY_PATH }}:${{ env.MINPACK_PREFIX }}/lib
233249
DYLD_LIBRARY_PATH: ${{ env.DYLD_LIBRARY_PATH }}:${{ env.MINPACK_PREFIX }}/lib
234250

251+
- name: Upload coverage report
252+
uses: codecov/codecov-action@v2
253+
235254

236255
Docs:
237256
runs-on: ubuntu-latest

meson.build

+19-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,25 @@ project(
88
'buildtype=debugoptimized',
99
],
1010
)
11-
has_cc = add_languages('c', required: get_option('python'), native: false)
11+
fc_nested_functions = meson.get_compiler('fortran').run(
12+
'call a(); contains; subroutine a(); print "(a)", "Nested functions supported"; end; end',
13+
).returncode() == 0
14+
if fc_nested_functions
15+
has_cc = add_languages('c', required: get_option('python'), native: false)
16+
else
17+
has_cc = false
18+
if get_option('python')
19+
error('Cannot compile Python API, Fortran compiler does not support nested functions')
20+
else
21+
warning('Fortran compiler does not support nested functions, C API is disabled')
22+
endif
23+
endif
1224

1325
minpack_lib = library(
1426
meson.project_name(),
1527
sources: files(
1628
'src/minpack.f90',
17-
'src/minpack_capi.f90',
29+
fc_nested_functions ? 'src/minpack_capi.f90' :,
1830
),
1931
install: true,
2032
)
@@ -38,9 +50,11 @@ install_data(
3850
install_dir: get_option('datadir')/'licenses'/meson.project_name()
3951
)
4052

41-
install_headers(
42-
minpack_header,
43-
)
53+
if fc_nested_functions
54+
install_headers(
55+
minpack_header,
56+
)
57+
endif
4458

4559
module_id = meson.project_name()
4660
meson.add_install_script(

0 commit comments

Comments
 (0)