Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update GalaxySDShape naming scheme and create support for sigma fitting with shapeHSM products #3175

Update GalaxySDShape naming scheme and create support for sigma fitting with shapeHSM products

Update GalaxySDShape naming scheme and create support for sigma fitting with shapeHSM products #3175

Workflow file for this run

name: Build and Check
on:
push:
branches:
- 'master'
pull_request:
branches:
- '*'
env:
CONDA_ENV: numcosmo_developer
CACHE_VERSION: 0
jobs:
build-gcc-ubuntu:
name: (ubuntu, apt, pip)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install pre-requisites
run: |
sudo apt-get update
sudo apt-get install gobject-introspection gir1.2-glib-2.0 gir1.2-glib-2.0-dev libgirepository-2.0-dev gcc gfortran pkg-config libglib2.0-dev libgmp3-dev libmpfr-dev libgsl0-dev libfftw3-dev libopenblas-dev libflint-dev libcfitsio-dev libfyaml-dev libnlopt-dev libhdf5-dev libopenmpi-dev libcairo2-dev uncrustify
pip install meson ninja pytest pytest-lazy-fixtures numpy scipy pygobject typer matplotlib --break-system-packages
- name: Ensure clear Jupyter Notebooks
uses: ResearchSoftwareActions/[email protected]
- name: Configure NumCosmo
run: meson setup build -Dbuildtype=release -Dnumcosmo_py=true -Dfftw-planner=estimate -Ddocumentation=false --prefix=/usr || (cat build/meson-logs/meson-log.txt && exit 1)
- name: Building NumCosmo
run: meson compile -C build
- name: Checking indentation
run: |
uncrustify -c numcosmo_uncrustify.cfg --check -q numcosmo/*.c numcosmo/*.h
uncrustify -c numcosmo_uncrustify.cfg --check -q numcosmo/math/*.c numcosmo/math/*.h
uncrustify -c numcosmo_uncrustify.cfg --check -q numcosmo/model/*.c numcosmo/model/*.h
uncrustify -c numcosmo_uncrustify.cfg --check -q numcosmo/xcor/*.c numcosmo/xcor/*.h
- name: Test python examples
run: |
source build/numcosmo_export.sh
cd examples
python example_simple.py
python example_cbe.py
- name: Test example compilation using non-installed library
run: |
source build/numcosmo_export.sh
cd examples
gcc -D_GNU_SOURCE -Wall example_simple.c -o example_simple -lnumcosmo -lgsl -lm $(pkg-config glib-2.0 gobject-2.0 --libs --cflags)
gcc -D_GNU_SOURCE -Wall example_ca.c -o example_ca -lnumcosmo -lgsl -lm $(pkg-config glib-2.0 gobject-2.0 --libs --cflags)
./example_simple
./example_ca
- name: Check NumCosmo
run: meson test -v -C build --num-processes=2 || (cat build/meson-logs/testlog.txt && exit 1)
- name: Create a NumCosmo tarball
run: meson dist -C build --no-tests
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: release
path: build/meson-dist/numcosmo-*.tar.xz
- name: Test example compilation using installed library
run: |
meson install -C build --destdir=install_tmp
sudo cp -a build/install_tmp/* /
cd examples
gcc -D_GNU_SOURCE -Wall example_simple.c -o example_simple $(pkg-config numcosmo --libs --cflags)
gcc -D_GNU_SOURCE -Wall example_ca.c -o example_ca $(pkg-config numcosmo --libs --cflags)
./example_simple
./example_ca
build-gcc-macos:
name: (macos, brew, pip)
runs-on: macos-latest
env:
CC: gcc-14
FC: gfortran-14
F77: gfortran-14
F90: gfortran-14
LIBRARY_PATH: /usr/local/lib:/opt/homebrew/Cellar/gmp/6.3.0/lib
LD_LIBRARY_PATH: /usr/local/lib:/opt/homebrew/Cellar/gmp/6.3.0/lib
DYLD_LIBRARY_PATH: /usr/local/lib:/opt/homebrew/Cellar/gmp/6.3.0/lib
CPATH: /usr/local/include
steps:
- uses: actions/checkout@v4
- name: Brew install pre-requisites
run: |
brew uninstall --ignore-dependencies --force [email protected]
brew install python3 gobject-introspection pygobject3 numpy scipy python-matplotlib meson ninja gsl gmp mpfr fftw cfitsio libfyaml nlopt gfortran glib openblas
- name: Pip install pre-requisites
run: |
python3 -m pip install pytest pytest-lazy-fixtures typer pydantic --break-system-packages
- name: Ensure clear Jupyter Notebooks
uses: ResearchSoftwareActions/[email protected]
- name: Fix libfyaml.pc
run: |
pc=$(pkg-config --variable=pcfiledir libfyaml)/libfyaml.pc
sed -i '' 's/none required//g' "$pc" || true
- name: Dump pkg-config info (cfitsio + libfyaml)
run: |
set -x
echo "which pkg-config:"
which pkg-config || true
echo "version:"
pkg-config --version || true
echo "env:"
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
echo "PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR"
echo "---- cfitsio ----"
pkg-config --libs cfitsio || true
pkg-config --cflags cfitsio || true
pkg-config --variable=pcfiledir cfitsio || true
pkg-config --debug --libs cfitsio || true
echo "---- libfyaml ----"
pkg-config --libs libfyaml || true
pkg-config --cflags libfyaml || true
pkg-config --variable=pcfiledir libfyaml || true
pkg-config --debug --libs libfyaml || true
- name: Configure NumCosmo
run: |
meson setup build -Dbuildtype=release -Dnumcosmo_py=true -Dfftw-planner=estimate -Dmpi=disabled --prefix=/usr || (cat build/meson-logs/meson-log.txt && exit 1)
- name: Building NumCosmo
run: |
meson compile -C build
- name: Test python examples
run: |
source build/numcosmo_export.sh
cd examples
python3 example_simple.py
python3 example_cbe.py
cd ..
pytest -xvs tests/python --run-sphere-map -m sphere_map
- name: Check NumCosmo
run: |
meson test -v -C build --num-processes=2 || (cat build/meson-logs/testlog.txt && exit 1)
build-miniforge:
name: (${{ matrix.os }}, py${{ matrix.python-version }}, ${{ matrix.mpi }}, Miniforge)
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["ubuntu", "macos"]
python-version: ["3.12"]
mpi: ["openmpi", "mpich"]
exclude:
- os: "macos"
mpi: "openmpi"
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- name: Setup miniforge
uses: conda-incubator/setup-miniconda@v4
with:
miniforge-version: latest
python-version: ${{ matrix.python-version }}
activate-environment: ${{ env.CONDA_ENV }}
- name: Cache date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda env
uses: actions/cache/restore@v4
id: cache
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ matrix.mpi }}-${{ steps.get-date.outputs.today }}-${{ hashFiles('environment.yml') }}-v${{ env.CACHE_VERSION }}
- name: Update environment
if: steps.cache.outputs.cache-hit != 'true'
run: |
conda env update -q -v -n ${{ env.CONDA_ENV }} -f environment.yml
which python
conda list
conda remove -q -v -n numcosmo_developer openmpi
conda install -q -v -n numcosmo_developer ${{ matrix.mpi }}
conda install -q -v -n numcosmo_developer libfabric-devel
conda list
- name: Save conda-forge cache
if: steps.cache.outputs.cache-hit != 'true'
id: cache-primes-save
uses: actions/cache/save@v4
with:
path: ${{ env.CONDA }}/envs
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Setting up NumCosmo
run: |
conda activate numcosmo_developer
meson setup build -Dbuildtype=release -Dnumcosmo_py=true -Dfftw-planner=estimate --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: Installing NumCosmo
run: |
meson install -C build
cd examples
python example_simple.py
python example_cbe.py
numcosmo generate planck18 test_exp_gen.yaml --data-type TT
- name: Running black check
run: |
black --check numcosmo_py
- name: Running flake8
run: |
flake8 numcosmo_py
- name: Running mypy
run: |
mypy --exclude '.*meson.*|numcosmo_py/generate_stubs\.py' -p numcosmo_py
#- name: Checking indentation
# run: |
# uncrustify -c numcosmo_uncrustify.cfg --check -q numcosmo/*.c numcosmo/*.h
#- name: Running pylint
# run: |
# pylint --rcfile .pylintrc numcosmo_py
- name: Check NumCosmo
run: meson test -v -C build --num-processes=2 || (cat build/meson-logs/testlog.txt && exit 1)
build-miniforge-coverage:
name: Cov-${{ matrix.suites }} (py${{ matrix.python-version }}, openmpi)
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["ubuntu"]
python-version: ["3.12"]
suites: ["python", "c", "stats-dist", "fit-esmcmc", "powspec", "data-cluster-wl", "py-powspec", "py-xcor"]
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- name: Setup miniforge
uses: conda-incubator/setup-miniconda@v4
with:
miniforge-version: latest
python-version: ${{ matrix.python-version }}
activate-environment: ${{ env.CONDA_ENV }}
- name: Cache date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda env
uses: actions/cache/restore@v4
id: cache
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ steps.get-date.outputs.today }}-${{ hashFiles('environment.yml') }}-v${{ env.CACHE_VERSION }}
- name: Update environment
if: steps.cache.outputs.cache-hit != 'true'
run: |
conda env update -q -v -n ${{ env.CONDA_ENV }} -f environment.yml
conda list
- name: Save conda-forge cache
if: steps.cache.outputs.cache-hit != 'true'
id: cache-primes-save
uses: actions/cache/save@v4
with:
path: ${{ env.CONDA }}/envs
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Setting up NumCosmo
run: |
conda activate numcosmo_developer
meson setup build -Dbuildtype=debug -Db_coverage=true -Dnumcosmo_py=true -Dfftw-planner=estimate -Dnumcosmo_debug=disabled --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 -v -C build --timeout-multiplier 0 --num-processes=2 --suite=${{ matrix.suites }} || (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@v4
with:
disable_search: true
fail_ci_if_error: true
files: ./numcosmo-coverage.info,./build/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
#- 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 }}