diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b307227c920..52b0cd8a808 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -53,7 +53,7 @@ jobs: python -m pip install --upgrade pip pip install -r .github/workflows/python_requirements.txt pip install -r .github/workflows/optional_requirements.txt - pip install pytest pytest-timeout pytest-github-actions-annotate-failures pytest-xdist + pip install pytest pytest-timeout pytest-github-actions-annotate-failures pytest-xdist pytest-cov - name: Create installation directory run: | @@ -70,6 +70,10 @@ jobs: run: | echo "$HOME/install/bin" >> $GITHUB_PATH + - name: Print installed versions + if: always() + run: .github/workflows/print_versions.sh + - name: Test executing of the grass command run: .github/workflows/test_simple.sh @@ -86,12 +90,18 @@ jobs: export PYTHONPATH=`grass --config python_path`:$PYTHONPATH export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH pytest --verbose --color=yes --durations=0 --durations-min=0.5 \ + --cov \ -ra . \ -m 'needs_solo_run' - - name: Print installed versions - if: always() - run: .github/workflows/print_versions.sh + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 + with: + verbose: true + flags: pytest-python-${{ matrix.python-version }} + name: pytest-python-${{ matrix.python-version }} + token: ${{ secrets.CODECOV_TOKEN }} + pytest-success: name: pytest Result needs: diff --git a/.gitignore b/.gitignore index 0db3adb55f5..42fd7650544 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,9 @@ html/ latex/ lib/*/html/ lib/*/latex/ + +# Ignore code coverage files +*.gcov +*.gcno +*.gcda +.coverage diff --git a/Makefile b/Makefile index 497fb7045b3..be8834ecf42 100644 --- a/Makefile +++ b/Makefile @@ -115,11 +115,15 @@ cleandistdirs: cleanscriptstrings: rm -f locale/scriptstrings/*.c 2>/dev/null -clean: cleandistdirs cleanscriptstrings cleandocs +clean: cleandistdirs cleanscriptstrings cleandocs code-coverage-clean libsclean: cleandistdirs $(MAKE) clean-recursive SUBDIRS=$(LIBDIRS) +code-coverage-clean: + -find . -type f \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete + -rm -f .coverage + distclean: clean -rm -f config.cache config.log config.status config.status.$(ARCH) 2>/dev/null -rm -f ChangeLog ChangeLog.bak $(ERRORLOG) grass.pc diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000000..b4b97b01433 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,114 @@ +--- +# When modifying this file, please validate using +# curl -X POST --data-binary @codecov.yml https://codecov.io/validate + +coverage: + status: + project: + default: + target: auto # auto compares coverage to the previous base commit + informational: true + patch: + default: + informational: true + +# Disable PR comments initially, until it is possible to have the information as a job summary +comment: false + +github_checks: + # Until more tests are added, disable GitHub checks annotation when added lines aren't covered by tests + annotations: false + +component_management: + individual_components: + - component_id: modules_database # this is an identifier that should not be changed + name: db # this is a display name, and can be changed freely + paths: + - db/** + - lib/db/** + - scripts/db.*/** + - component_id: modules_display + name: display + paths: + - display/** + - lib/display/** + - scripts/d.*/** + - component_id: modules_general + name: general + paths: + - general/** + - scripts/g.*/** + - component_id: gui + name: gui + paths: + - gui/** + - component_id: modules_imagery + name: imagery + paths: + - imagery/** + - lib/imagery/** + - scripts/i.*/** + - component_id: man + name: man + paths: + - man/** + - component_id: modules_misc + name: imagery + paths: + - misc/** + - scripts/m.*/** + - component_id: modules_postscript + name: ps + paths: + - ps/** + - component_id: modules_raster + name: raster + paths: + - raster/** + - lib/raster/** + - scripts/r.*/** + - component_id: modules_raster3d + name: raster3d + paths: + - raster3d/** + - lib/raster3d/** + - scripts/r3.*/** + - component_id: modules_temporal + name: temporal + paths: + - temporal/** + - lib/temporal/** + - scripts/t.*/** + - component_id: modules_vector + name: vector + paths: + - vector/** + - lib/vector/** + - scripts/v.*/** + - component_id: utils + paths: + - utils/** + - component_id: scripts + paths: + - scripts/** + - component_id: library + name: lib + paths: + - lib/** + - component_id: python_pygrass + name: pygrass + paths: + - python/grass/pygrass/** + - component_id: python_gunittest + name: gunittest + paths: + - python/grass/gunittest/** + - component_id: notebooks + name: notebooks (jupyter) + paths: + - python/grass/jupyter/** + - "**/*.ipynb" + - component_id: python_library + name: python library + paths: + - python/grass/**