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

Deployment and release updates #11

Merged
merged 54 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
6ebeb4b
CI: automatic update of nix lock file (#4016)
imincik Jul 10, 2024
152f493
nix: pin python version to 3.11 (#4017)
imincik Jul 10, 2024
2186ec5
CI(deps): Update actions/setup-python action to v5.1.1 (#4019)
renovate[bot] Jul 10, 2024
d41987c
style: Fix repeated-append (FURB113) (#4014)
echoix Jul 10, 2024
c9a1a17
i.segment: Fix uninitialized variable issue (#4023)
ShubhamDesai Jul 11, 2024
a3543cd
style: Fix if-exp-instead-of-or-operator (FURB110) (#4013)
echoix Jul 11, 2024
4aa61d7
style: Fix unnecessary-map (C417) (#4012)
echoix Jul 11, 2024
92cf465
style: Fix if-expr-min-max (FURB136) (#4026)
echoix Jul 11, 2024
6b38ffb
style: Fix too-many-newlines-at-end-of-file (W391) (#4025)
echoix Jul 11, 2024
169ca9b
style: Fix empty-comment (PLR2044) (#4024)
echoix Jul 11, 2024
ff453d2
style: Fix get-attr-with-constant (B009) (#4009)
echoix Jul 11, 2024
ff2da11
style: Fix unnecessary-comprehension-in-call (C419) (#4027)
echoix Jul 11, 2024
52a7fd7
style: Fix f-string-number-format (FURB116) (#4030)
echoix Jul 11, 2024
204903c
style: Fix is-literal (F632) (#4031)
echoix Jul 11, 2024
3ef2715
style: Fix print-empty-string (FURB105) (#4029)
echoix Jul 11, 2024
ee9fa48
doc: add Nix documentation (#3990)
imincik Jul 11, 2024
b3cb5db
CI(deps): Update github/codeql-action action to v3.25.12 (#4038)
renovate[bot] Jul 12, 2024
d31afbd
CI(deps): Update docker/dockerfile Docker tag to v1.9 (#4037)
renovate[bot] Jul 12, 2024
8f83c24
i.atcorr: Fix uninitialized variable (#4022)
ShubhamDesai Jul 13, 2024
cb0087e
style: Fix sorted-min-max (FURB192) (#4035)
echoix Jul 13, 2024
a751f93
style: Fix readlines-in-for (FURB129) (#4034)
echoix Jul 13, 2024
3b309db
style: Fix repeated-equality-comparison (PLR1714) (#4042)
echoix Jul 13, 2024
b01a67d
style: Fix unnecessary-assign (RET504) (#4043)
echoix Jul 13, 2024
d690d0c
style: Fix yoda-conditions (SIM300) (#4044)
echoix Jul 13, 2024
98222a2
style: Fix various FURB (small count) (#4046)
echoix Jul 13, 2024
7695805
style: Fix read-whole-file (FURB101) and write-whole-file (FURB103) (…
echoix Jul 13, 2024
b565924
style: repeated-global (FURB154) (#4048)
echoix Jul 14, 2024
1936cf0
style: Fix math-constant (FURB152) (#4049)
echoix Jul 14, 2024
951b71b
CI(deps): Lock file maintenance (#4057)
renovate[bot] Jul 15, 2024
793cc1b
CI(deps): Update docker/build-push-action action to v6.4.0 (#4059)
renovate[bot] Jul 15, 2024
2d055ab
CI: Configure Renovate update groups (#4053)
echoix Jul 15, 2024
f3681c5
CI(deps): Update ruff to v0.5.2 (#4061)
renovate[bot] Jul 15, 2024
f0497c5
style: fix numpy-deprecation-rules (NPY) (#4062)
ninsbl Jul 16, 2024
692e330
CI(deps): Update docker/build-push-action action to v6.4.1 (#4064)
renovate[bot] Jul 17, 2024
f99780c
style: Fix collapsible-else-if (PLR5501) (#4045)
echoix Jul 17, 2024
972bd32
CI(deps): Update softprops/action-gh-release action to v2.0.7 (#4066)
renovate[bot] Jul 17, 2024
0c3fded
raster: Fix uninitialized variable issue for C raster modules (#4065)
ShubhamDesai Jul 18, 2024
6fb030f
r.li manual: Update reference to fragstat paper (#4001)
ecodiv Jul 18, 2024
daa3b61
CI(deps): Update ruff to v0.5.3 (#4073)
renovate[bot] Jul 18, 2024
a35956f
CI(deps): Update softprops/action-gh-release action to v2.0.8 (#4074)
renovate[bot] Jul 19, 2024
7840f76
t.rast.neighbors: support all r.neighbors features and allow to appen…
ninsbl Jul 19, 2024
456546a
CI(deps): Update github/codeql-action action to v3.25.13 (#4075)
renovate[bot] Jul 19, 2024
c1f55e3
r.category: add JSON support (#4018)
kritibirda26 Jul 19, 2024
c223cd0
CI(deps): Update ruff to v0.5.4 (#4078)
renovate[bot] Jul 20, 2024
fdf087c
pytest: Collect all uncovered Python files in code coverage (#4077)
echoix Jul 21, 2024
1f6fa6c
style: Fix needless-bool (SIM103) (#4055)
echoix Jul 21, 2024
7b564ce
CI(deps): Lock file maintenance (#4080)
renovate[bot] Jul 22, 2024
4c672cb
CI(deps): Lock file maintenance (#4081)
renovate[bot] Jul 22, 2024
1dee2d6
CI(deps): Update docker/build-push-action action to v6.5.0 (#4082)
renovate[bot] Jul 22, 2024
660bdc6
CI(deps): Update docker/login-action action to v3.3.0 (#4083)
renovate[bot] Jul 22, 2024
eaae0d3
CI(deps): Update DeterminateSystems/nix-installer-action action to v1…
renovate[bot] Jul 23, 2024
36cc5b2
CI(deps): Update alpine:3.20 Docker digest to 0a4eaa0 (#4089)
renovate[bot] Jul 23, 2024
7f2b7bd
CI(deps): Update docker/setup-buildx-action action to v3.5.0 (#4084)
renovate[bot] Jul 23, 2024
d7b13e0
CI(deps): Update docker/setup-qemu-action action to v3.2.0 (#4085)
renovate[bot] Jul 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[run]
; branch = True
; dynamic_context = test_function
concurrency = multiprocessing,thread
parallel = True
data_file = ${INITIAL_PWD-.}/.coverage
omit =
${INITIAL_PWD-.}/testreport
${INITIAL_PWD-.}/.github/*
${INITIAL_PWD-.}/bin.*/*
${INITIAL_PWD-.}/dist.*/*
**/OBJ.*/*
source =
.
${INITIAL_PWD-.}/
${INITIAL_GISBASE-/usr/local/grass??}/

[paths]
root =
./
${INITIAL_GISBASE-/usr/local/grass??}/
/home/*/install/grass??/
python =
./python/
${INITIAL_GISBASE-/usr/local/grass??}/etc/python/
/home/*/install/grass??/etc/python/
special_d_mon =
./display/d.mon/
${INITIAL_GISBASE-/usr/local/grass??}/etc/d.mon/
/home/*/install/grass??/etc/d.mon/
special_r_in_wms =
./scripts/r.in.wms/
${INITIAL_GISBASE-/usr/local/grass??}/etc/r.in.wms/
/home/*/install/grass??/etc/r.in.wms/


[report]
; Since our file structure isn't an importable package, not all files are found
; This allows to find python files even if there is missing __init__.py files, but is slow
include_namespace_packages = True
skip_covered = False
; Regexes for lines to exclude from consideration
exclude_also =
; Don't complain about missing debug-only code:
def __repr__
if self\.debug

; Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

; Don't complain if non-runnable code isn't run:
; if 0:
; if __name__ == .__main__.:

; Don't complain about abstract methods, they aren't run:
@(abc\.)?abstractmethod

ignore_errors = True
precision = 2

[html]
directory = coverage_html_report
show_contexts = true
2 changes: 1 addition & 1 deletion .github/workflows/additional_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
exclude: mswindows .*\.bat .*/testsuite/data/.*

- name: Set up Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: '3.10'

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: '3.x'
- name: Install non-Python dependencies
Expand All @@ -56,7 +56,7 @@ jobs:
if: ${{ matrix.language == 'c-cpp' }}

- name: Initialize CodeQL
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
uses: github/codeql-action/init@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
Expand All @@ -81,6 +81,6 @@ jobs:
run: .github/workflows/build_ubuntu-22.04.sh "${HOME}/install"

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
uses: github/codeql-action/analyze@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13
with:
category: "/language:${{matrix.language}}"
4 changes: 2 additions & 2 deletions .github/workflows/create_release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: '3.11'
- name: Create output directory
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
sha256sum ${{ env.GRASS }}.tar.xz > ${{ env.GRASS }}.tar.xz.sha256
- name: Publish draft distribution to GitHub (for tags only)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 # v2.0.6
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with:
name: GRASS GIS ${{ github.ref_name }}
body: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ jobs:
latest=false
suffix=-${{ matrix.os }}
- name: Set up QEMU
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
uses: docker/setup-buildx-action@aa33708b10e362ff993539393ff100fa93ed6a27 # v3.5.0
- name: Login to DockerHub
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0
with:
push: true
pull: true
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ matrix.python-version }}
cache: pip
Expand Down Expand Up @@ -89,10 +89,21 @@ jobs:
run: |
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 \
export INITIAL_GISBASE="$(grass --config path)"
INITIAL_PWD="${PWD}" pytest --verbose --color=yes --durations=0 --durations-min=0.5 \
--cov \
--cov-context=test \
-ra . \
-m 'needs_solo_run'
- name: Fix non-standard installed script paths in coverage data
run: |
export PYTHONPATH=`grass --config python_path`:$PYTHONPATH
export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH
export INITIAL_GISBASE="$(grass --config path)"
export INITIAL_PWD="${PWD}"
python utils/coverage_mapper.py
coverage combine
coverage html

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
Expand All @@ -101,6 +112,13 @@ jobs:
flags: pytest-python-${{ matrix.python-version }}
name: pytest-python-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
- name: Make python-only code coverage test report available
if: ${{ !cancelled() }}
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: python-codecoverage-report-${{ matrix.os }}-${{ matrix.python-version }}
path: coverage_html_report
retention-days: 1

pytest-success:
name: pytest Result
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
# renovate: datasource=pypi depName=bandit
BANDIT_VERSION: "1.7.9"
# renovate: datasource=pypi depName=ruff
RUFF_VERSION: "0.5.1"
RUFF_VERSION: "0.5.4"

runs-on: ${{ matrix.os }}
permissions:
Expand All @@ -57,7 +57,7 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
path: bandit.sarif

- name: Upload SARIF File into Security Tab
uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
uses: github/codeql-action/upload-sarif@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13
with:
sarif_file: bandit.sarif

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
push:
tags:
- '*'
pull_request:
paths:
- 'flake.nix'
- 'flake.lock'
- 'package.nix'
- '.github/workflows/test-nix.yml'
workflow_dispatch:

concurrency:
Expand All @@ -25,7 +31,7 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Install nix
uses: DeterminateSystems/nix-installer-action@7993355175c2765e5733dae74f3e0786fe0e5c4f # v12
uses: DeterminateSystems/nix-installer-action@ab6bcb2d5af0e904d04aea750e2089e9dc4cbfdd # v13

- name: Setup cachix
uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ lib/*/latex/
*.gcno
*.gcda
.coverage
.coverage.*
coverage.xml
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repos:
)
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.1
rev: v0.5.4
hooks:
# Run the linter.
- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.8@sha256:e87caa74dcb7d46cd820352bfea12591f3dba3ddc4285e19c7dcd13359f7cefd
# syntax=docker/dockerfile:1.9@sha256:fe40cf4e92cd0c467be2cfc30657a680ae2398318afd50b0c80585784c604f28

# Note: This file must be kept in sync in ./Dockerfile and ./docker/ubuntu/Dockerfile.
# Changes to this file must be copied over to the other file.
Expand Down
9 changes: 5 additions & 4 deletions display/d.text/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Author: Owen Smith - Rewritten from test.pl by Huidae Cho
# Run: d.mon start=wx0 && ./test.py | d.text at=0,100
import math
from pathlib import Path
import re

# Quiet black syntax checking for fonts and colors to keep the code printed to
Expand Down Expand Up @@ -55,8 +56,8 @@ def text(in_text):
rotate(i * 10)
color(colors[i % len(colors)])
xy(
(80 + 10 * math.cos(i * 10 / 180 * 3.141593)),
(50 + 10 * 640 / 480 * math.sin(i * 10 / 180 * 3.141593)),
(80 + 10 * math.cos(i * 10 / 180 * math.pi)),
(50 + 10 * 640 / 480 * math.sin(i * 10 / 180 * math.pi)),
)
text(fonts[int(i % len(fonts))])

Expand All @@ -66,8 +67,8 @@ def text(in_text):
color("gray")
rc(1, 1)

with open(__file__) as f:
src = f.read()

src = Path(__file__).read_text()

print(
".L 0\n"
Expand Down
103 changes: 103 additions & 0 deletions doc/NIX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# How to use Nix

## What is Nix

[Nix](https://nixos.org/) is a powerful package manager and system configuration
tool that aims to make software deployment fully reproducible.

## Nix installation

- Install Nix
[(learn more about this installer)](https://zero-to-nix.com/start/install)

```bash
curl --proto '=https' --tlsv1.2 -sSf \
-L https://install.determinate.systems/nix \
| sh -s -- install
```

## Create GRASS GIS development environment

Nix provides a development environment containing all required dependencies.

- Launch development environment

```bash
nix develop
```

- Optionally, use [direnv](https://direnv.net) to activate environment
automatically when entering the source code directory

```bash
echo "use flake" > .envrc
direnv allow
```

## Launch GRASS GIS directly from the source code

Nix allows to run a program directly from git source code repository using
following command:

```bash
nix run \
github:<OWNER>/<REPO>/<REVISION|BRANCH|TAG>#<PACKAGE-NAME> -- <PROGRAM-ARGUMENTS>
```

- Launch latest version of GRASS from `main` branch

```bash
nix run github:OSGeo/grass#grass
```

- Launch GRASS from specific Git revision, branch or tag

```bash
nix run github:OSGeo/grass/<REVISION|BRANCH|TAG>#grass
```

- Launch GRASS from pull request

```bash
nix run github:<PR-OWNER>/grass/<PR-BRANCH>#grass
```

## Install GRASS GIS directly from the source code

To install a program permanently, use following command:

```bash
nix profile install \
github:<OWNER>/<REPO>/<REVISION|TAG|BRANCH>#<PACKAGE-NAME> -- <PROGRAM-ARGUMENTS>
```

- Install latest version of GRASS from `main` branch

```bash
nix profile install github:OSGeo/grass#grass
```

- Install GRASS from specific Git revision, branch or tag

```bash
nix profile install github:OSGeo/grass/<REVISION|BRANCH|TAG>#grass
```

## Uninstall GRASS GIS

- List installed programs

```bash
nix profile list
```

- Uninstall a program

```bash
nix profile remove <INDEX-NUMBER>
```

## Nix documentation

- [nix.dev](https://nix.dev)
- [Zero to Nix](https://zero-to-nix.com)
2 changes: 1 addition & 1 deletion docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.20@sha256:b89d9c93e9ed3597455c90a0b88a8bbb5cb7188438f70953fede212a0c4394e0 as common
FROM alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5 as common

# Based on:
# https://github.com/mundialis/docker-grass-gis/blob/master/Dockerfile
Expand Down
Loading
Loading