Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variant dictionary support #135

Merged
merged 22 commits into from Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
21c114e
New NcmVarDict boxed object describing a dict of str keys and basic t…
vitenti Jan 17, 2024
a8681a6
Changing Variant type of object to tuples.
vitenti Jan 17, 2024
40f7842
Finished update of Object variant type. Added tests for data files.
vitenti Jan 17, 2024
2d34908
Finish support for VarDict as object properties.
vitenti Jan 17, 2024
7df84b9
Fixing line too long.
vitenti Jan 18, 2024
70faeda
Updated conda envirnment file to use openblas compatible with openmp.
vitenti Jan 18, 2024
d0727f1
Fixing problem with fft wisdow when MKL is being used.
vitenti Jan 18, 2024
1ceecf3
Updated priors to use named parameters. Improved Model and MSet objec…
vitenti Jan 19, 2024
d6f29ed
Testing CodeCov.
vitenti Jan 19, 2024
e4c2594
Testing codecov.
vitenti Jan 20, 2024
ae83e39
Improving reports to codecov.
vitenti Jan 20, 2024
7658d7b
Using conda build for coverage.
vitenti Jan 20, 2024
e6c4a59
Fixed wrong signness comparison and coverage .
vitenti Jan 20, 2024
18b7f82
Testing lcov 1.16 options.
vitenti Jan 20, 2024
a7ebb4e
Removing timeout for coverage tests.
vitenti Jan 20, 2024
16de503
Removing external codes from coverage.
vitenti Jan 20, 2024
277bb43
Disabling documentation build in CI.
vitenti Jan 20, 2024
6902dcf
Removing G_DECLARE_ from coverage.
vitenti Jan 20, 2024
606745c
Ignoring G_DEFINE_ in coverage.
vitenti Jan 20, 2024
d2740e1
Using lcov for coveralls.
vitenti Jan 20, 2024
078732d
Disabling branch detection.
vitenti Jan 20, 2024
89e3e21
Extra tests for NcmMSet and adding tests back to coverage.
vitenti Jan 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
112 changes: 78 additions & 34 deletions .github/workflows/build_check.yml
Expand Up @@ -11,10 +11,8 @@ on:
jobs:

build-gcc-ubuntu:

name: NumCosmo (ubuntu, apt)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install pre-requisites
Expand All @@ -25,7 +23,7 @@ jobs:
- name: Ensure clear Jupyter Notebooks
uses: ResearchSoftwareActions/EnsureCleanNotebooksAction@1.1
- name: Configure NumCosmo
run: meson setup build -Ddebug=true -Dnumcosmo_py=true --prefix=/usr || (cat build/meson-logs/meson-log.txt && exit 1)
run: meson setup build -Dbuildtype=release -Dnumcosmo_py=true -Dgtkdoc=disabled --prefix=/usr || (cat build/meson-logs/meson-log.txt && exit 1)
- name: Building NumCosmo
run: meson compile -C build
- name: Test python examples
Expand Down Expand Up @@ -60,36 +58,7 @@ jobs:
./example_simple
./example_ca

coveralls-gcc-ubuntu:
name: NumCosmo (ubuntu, apt, coveralls)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install pre-requisites
run: |
sudo apt-get update
sudo apt-get install gobject-introspection gir1.2-glib-2.0 libgirepository1.0-dev gcc gfortran gcovr pkg-config libglib2.0-dev libgmp3-dev libmpfr-dev libgsl0-dev libfftw3-dev libopenblas-dev libflint-arb-dev libcfitsio-dev libfyaml-dev libnlopt-dev libhdf5-dev python3-setuptools gtk-doc-tools libopenmpi-dev
pip install meson ninja pytest pytest-tap numpy astropy scipy
- name: Configure NumCosmo
run: meson setup build -Ddebug=true -Db_coverage=true -Db_lto=false -Dnumcosmo_py=true --prefix=/usr || (cat build/meson-logs/meson-log.txt && exit 1)
- name: Building NumCosmo
run: meson compile -C build
- name: Check NumCosmo
run: meson test -C build || (cat build/meson-logs/testlog.txt && exit 1)
- name: Generate coverage
# For some reason, gcovr is ignoring the configured gcovr.cfg file
# ninja coverage -C build -v -d stats -d explain
run: |
gcovr --root . --object-directory build --config gcovr.cfg --xml-pretty -o build/meson-logs/coverage.xml
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
files: build/meson-logs/coverage.xml
github-token: ${{ secrets.GITHUB_TOKEN }}

build-gcc-macos:

name: NumCosmo (macos, brew)
runs-on: macos-latest
env:
Expand Down Expand Up @@ -117,7 +86,7 @@ jobs:
uses: ResearchSoftwareActions/EnsureCleanNotebooksAction@1.1
- name: Configure NumCosmo
run: |
meson setup build -Ddebug=true -Dnumcosmo_py=true --prefix=/usr || (cat build/meson-logs/meson-log.txt && exit 1)
meson setup build -Dbuildtype=release -Dnumcosmo_py=true --prefix=/usr || (cat build/meson-logs/meson-log.txt && exit 1)
- name: Building NumCosmo
run: |
meson compile -C build
Expand Down Expand Up @@ -172,7 +141,7 @@ jobs:
[[ -e $GCC_AR ]] && AR=$GCC_AR
[[ -e $GCC_NM ]] && NM=$GCC_NM
[[ -e $GCC_RANLIB ]] && RANLIB=$GCC_RANLIB
meson setup build -Ddebug=true -Dnumcosmo_py=true --libdir=$CONDA_PREFIX/lib --prefix=$CONDA_PREFIX || (cat build/meson-logs/meson-log.txt && exit 1)
meson setup build -Dbuildtype=release -Dnumcosmo_py=true --libdir=$CONDA_PREFIX/lib --prefix=$CONDA_PREFIX || (cat build/meson-logs/meson-log.txt && exit 1)
- name: Building NumCosmo
run: |
meson compile -C build
Expand All @@ -196,3 +165,78 @@ jobs:
# pylint --rcfile .pylintrc numcosmo_py
- name: Check NumCosmo
run: meson test -C build || (cat build/meson-logs/testlog.txt && exit 1)

build-miniforge-coverage:
name: NumCosmo-Coverage (${{ matrix.os }}, python-${{ matrix.python-version }}, Miniforge)
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["ubuntu"]
python-version: ["3.9"]
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v3
- name: Setup miniforge
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: numcosmo_developer
python-version: ${{ matrix.python-version }}
miniforge-variant: Mambaforge
show-channel-urls: true
use-mamba: true
- name: Cache date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda env
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs
key: coverage-miniforge-${{ runner.os }}--${{ runner.arch }}--python-${{ matrix.python-version }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('devel_environment.yml') }}-${{ env.CACHE_NUMBER }}
env:
CACHE_NUMBER: 0
id: cache
- name: Update environment
run: |
conda env update -q -v -n numcosmo_developer -f devel_environment.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Setting up NumCosmo
run: |
conda activate numcosmo_developer
[[ -e $GCC_AR ]] && AR=$GCC_AR
[[ -e $GCC_NM ]] && NM=$GCC_NM
[[ -e $GCC_RANLIB ]] && RANLIB=$GCC_RANLIB
meson setup build -Dbuildtype=debug -Db_coverage=true -Db_lto=false -Dnumcosmo_py=true --libdir=$CONDA_PREFIX/lib --prefix=$CONDA_PREFIX || (cat build/meson-logs/meson-log.txt && exit 1)
- name: Building NumCosmo
run: |
meson compile -C build
- name: Check and coverage
# First run to generate the coverage base
# Second run to generate the coverage for the tests
# Third run to merge the coverage base and the coverage for the tests
run: |
lcov --config-file .lcovrc --no-external --capture --initial --directory build --directory numcosmo --directory tests --base-directory $(pwd)/build --output-file numcosmo-coverage-base.info
meson test -C build --timeout-multiplier 0 || (cat build/meson-logs/testlog.txt && exit 1)
lcov --config-file .lcovrc --no-external --capture --directory build --directory numcosmo --directory tests --base-directory $(pwd)/build --output-file numcosmo-coverage-tests.info
lcov --config-file .lcovrc --add-tracefile numcosmo-coverage-base.info --add-tracefile numcosmo-coverage-tests.info --output-file numcosmo-coverage-full.info
lcov --config-file .lcovrc --remove numcosmo-coverage-full.info '*/class/*' '*/levmar/*' '*/libcuba/*' '*/plc/*' '*/sundials/*' '*/toeplitz/*' '*/tools/*' --output-file numcosmo-coverage.info
- name: CodeCov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./numcosmo-coverage.info
#- name: Generate coverage
# # For some reason, gcovr is ignoring the configured gcovr.cfg file
# # ninja coverage -C build -v -d stats -d explain
# run: |
# gcovr --root . --object-directory build --config gcovr.cfg --xml-pretty -o build/meson-logs/coverage.xml
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
files: ./numcosmo-coverage.info
format: lcov
github-token: ${{ secrets.GITHUB_TOKEN }}


23 changes: 11 additions & 12 deletions .lcovrc
Expand Up @@ -2,26 +2,25 @@
# See http://ltp.sourceforge.net/coverage/lcov/lcovrc.5.php

# Always enable branch coverage
lcov_branch_coverage = 1
lcov_branch_coverage = 0

# Exclude precondition assertions, as we can never reasonably get full branch
# coverage of them, as they should never normally fail.
# See https://github.com/linux-test-project/lcov/issues/44
lcov_excl_br_line = LCOV_EXCL_BR_LINE|g_return_if_fail|g_return_val_if_fail|g_assert|g_assert_|g_warn_if_fail|g_clear_|ncm_assert_|NCM_TEST_FREE
lcov_excl_br_line = LCOV_EXCL_BR_LINE|g_return_if_fail|g_return_val_if_fail|g_assert|g_assert_|g_warn_if_fail|g_clear_|ncm_assert_|NCM_TEST_FREE|G_DECLARE_|G_DEFINE_

# Similarly for unreachable assertions.
lcov_excl_line = LCOV_EXCL_LINE|g_return_if_reached|g_return_val_if_reached|g_assert_not_reached|g_error|G_OBJECT_WARN

# Excluding external projects
ignore_errors = unused
ignore_errors = empty

exclude = ncm_fit_nlopt_enum.*
exclude = ncm_enum_types.*
exclude = nc_enum_types.*
exclude = class/
exclude = levmar/
exclude = libcuba/
exclude = plc/
exclude = sundials/
exclude = toeplitz/
exclude = tools/
# This will not work with lcov 1.16 or earlier
#exclude = */class/*
#exclude = */levmar/*
#exclude = */libcuba/*
#exclude = */plc/*
#exclude = */sundials/*
#exclude = */toeplitz/*
#exclude = */tools/*
2 changes: 1 addition & 1 deletion data/BBN_2017_marcucci_spline2d.obj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/BBN_2017_spline2d.obj

Large diffs are not rendered by default.