Skip to content

Commit

Permalink
pre-commit: add yamllint (#859)
Browse files Browse the repository at this point in the history
* max line-length is 120 
* lint warnings have been fixed in all yaml files
  • Loading branch information
nilason committed Feb 1, 2023
1 parent 047ac44 commit 58b2387
Show file tree
Hide file tree
Showing 12 changed files with 272 additions and 261 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
name: Python Black Formatting

on:
push:
branches:
- grass*
- grass*
pull_request:

jobs:
Expand All @@ -16,8 +17,8 @@ jobs:
matrix:
include:
- os: ubuntu-22.04
python-version: "3.10"
black-version: "22.3.0"
python-version: '3.10'
black-version: 22.3.0

runs-on: ${{ matrix.os }}

Expand Down
180 changes: 91 additions & 89 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
name: Build and test

on:
push:
pull_request:
schedule:
# 01:00 Pacific Time (in UTC), every day (late night PT)
- cron: '0 8 * * *'
# 01:00 Pacific Time (in UTC), every day (late night PT)
- cron: 0 8 * * *

jobs:
build:
Expand All @@ -21,95 +22,96 @@ jobs:
# only.
include:
- grass-version: main
python-version: "3.10"
python-version: '3.10'
- grass-version: releasebranch_8_2
python-version: "3.10"
python-version: '3.10'
fail-fast: false

steps:

- name: Checkout core
uses: actions/checkout@v3
with:
repository: OSGeo/grass
ref: ${{ matrix.grass-version }}
path: grass

- name: Checkout addons
uses: actions/checkout@v3
with:
path: grass-addons

- name: Get dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y wget git gawk findutils
xargs -a <(awk '! /^ *(#|$)/' "grass-addons/.github/workflows/apt.txt") -r -- \
sudo apt-get install -y --no-install-recommends --no-install-suggests
- name: Set up Python ${{ matrix.python-version }} as default Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Get Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r grass-addons/.github/workflows/requirements.txt
- name: Create installation directory
run: |
mkdir $HOME/install
- name: Set number of cores for compilation
run: |
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
- name: Set LD_LIBRARY_PATH for GRASS GIS compilation
run: |
echo "LD_LIBRARY_PATH=$HOME/install/lib" >> $GITHUB_ENV
- name: Build GRASS GIS core
run: |
cd grass
../grass-addons/.github/workflows/build_grass.sh $HOME/install
- name: Add the bin directory to PATH
run: |
echo "$HOME/install/bin" >> $GITHUB_PATH
- name: Make simple grass command available (not needed in G8)
run: |
if [ ! -e $HOME/install/bin/grass ] ; then ln -s $HOME/install/bin/grass* $HOME/install/bin/grass ; fi
- name: Build addons
run: |
cd grass-addons/src
GRASS_INSTALL=$($HOME/install/bin/grass --config | sed -n '4{p;q}')
make MODULE_TOPDIR=$GRASS_INSTALL
- name: Get extra Python dependencies
run: |
export GDAL_VERSION=$(gdal-config --version)
pip install -r grass-addons/.github/workflows/extra_requirements.txt
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: "4.2.1"

- name: Get R dependencies
run: |
grass-addons/.github/workflows/install_r_packages.R
- name: Run tests
run: |
cd grass-addons/src
../.github/workflows/test.sh
- name: Make HTML test report available
uses: actions/upload-artifact@v2
with:
name: testreport-grass-${{ matrix.grass-version }}-python-${{ matrix.python-version }}
path: grass-addons/src/testreport
retention-days: 3
- name: Checkout core
uses: actions/checkout@v3
with:
repository: OSGeo/grass
ref: ${{ matrix.grass-version }}
path: grass

- name: Checkout addons
uses: actions/checkout@v3
with:
path: grass-addons

- name: Get dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y wget git gawk findutils
xargs -a <(awk '! /^ *(#|$)/' "grass-addons/.github/workflows/apt.txt") -r -- \
sudo apt-get install -y --no-install-recommends --no-install-suggests
- name: Set up Python ${{ matrix.python-version }} as default Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Get Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r grass-addons/.github/workflows/requirements.txt
- name: Create installation directory
run: |
mkdir $HOME/install
- name: Set number of cores for compilation
run: |
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
- name: Set LD_LIBRARY_PATH for GRASS GIS compilation
run: |
echo "LD_LIBRARY_PATH=$HOME/install/lib" >> $GITHUB_ENV
- name: Build GRASS GIS core
run: |
cd grass
../grass-addons/.github/workflows/build_grass.sh $HOME/install
- name: Add the bin directory to PATH
run: |
echo "$HOME/install/bin" >> $GITHUB_PATH
- name: Make simple grass command available (not needed in G8)
run: |
if [ ! -e $HOME/install/bin/grass ] ; then \
ln -s $HOME/install/bin/grass* $HOME/install/bin/grass ; fi
- name: Build addons
run: |
cd grass-addons/src
GRASS_INSTALL=$($HOME/install/bin/grass --config | sed -n '4{p;q}')
make MODULE_TOPDIR=$GRASS_INSTALL
- name: Get extra Python dependencies
run: |
export GDAL_VERSION=$(gdal-config --version)
pip install -r grass-addons/.github/workflows/extra_requirements.txt
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: 4.2.1

- name: Get R dependencies
run: |
grass-addons/.github/workflows/install_r_packages.R
- name: Run tests
run: |
cd grass-addons/src
../.github/workflows/test.sh
- name: Make HTML test report available
uses: actions/upload-artifact@v2
with:
name: testreport-grass-${{ matrix.grass-version }}-python-${{ matrix.python-version }}
path: grass-addons/src/testreport
retention-days: 3
3 changes: 2 additions & 1 deletion .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Python Flake8 Code Quality

on:
Expand All @@ -14,7 +15,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: '3.10'

- name: Install
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: General linting

on:
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ repos:
hooks:
- id: clang-format
types_or: [c, c++, javascript, json, objective-c]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.29.0
hooks:
- id: yamllint
args: [--format, parsable, --strict, -d,
'{extends: default, rules: {truthy: disable, line-length: {max: 120, allow-non-breakable-words: true}}}']
48 changes: 24 additions & 24 deletions src/raster/r.estimap.recreation/tests/test_demand.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
---

- mapset: "demand"
- mapset: demand
flags: []
inputs:
mask:
- "input_area_of_interest"
- input_area_of_interest
land:
- "input_land_suitability"
- input_land_suitability
natural:
- "input_protected_areas,input_urban_green"
- input_protected_areas,input_urban_green
water:
- "input_water_resources"
- "input_bathing_water_quality"
- input_water_resources
- input_bathing_water_quality
infrastructure:
- "input_distance_to_infrastructure"
- input_distance_to_infrastructure
base:
- "input_local_administrative_units"
- input_local_administrative_units
population:
- "input_population_2015"
- input_population_2015
outputs:
csvs: {}
maps:
demand:
name: "output_demand"
hash: "c4dfa32feaec811a106a38f9679e8840"
name: output_demand
hash: c4dfa32feaec811a106a38f9679e8840

- mapset: "unmet_demand"
- mapset: unmet_demand
flags: []
inputs:
mask:
- "input_area_of_interest"
- input_area_of_interest
land:
- "input_land_suitability"
- input_land_suitability
natural:
- "input_protected_areas,input_urban_green"
- input_protected_areas,input_urban_green
water:
- "input_water_resources"
- "input_bathing_water_quality"
- input_water_resources
- input_bathing_water_quality
infrastructure:
- "input_distance_to_infrastructure"
- input_distance_to_infrastructure
base:
- "input_local_administrative_units"
- input_local_administrative_units
population:
- "input_population_2015"
- input_population_2015
outputs:
csvs: {}
maps:
demand:
name: "output_demand"
hash: "c4dfa32feaec811a106a38f9679e8840"
name: output_demand
hash: c4dfa32feaec811a106a38f9679e8840
unmet:
name: "output_unmet_demand"
hash: "8ca9a64eca84a31ea396ebc6c33ac9c3"
name: output_unmet_demand
hash: 8ca9a64eca84a31ea396ebc6c33ac9c3
22 changes: 11 additions & 11 deletions src/raster/r.estimap.recreation/tests/test_flow.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
---

- mapset: "flow"
- mapset: flow
flags: []
inputs:
mask:
- "input_area_of_interest"
- input_area_of_interest
land:
- "input_land_suitability"
- input_land_suitability
natural:
- "input_protected_areas,input_urban_green"
- input_protected_areas,input_urban_green
water:
- "input_water_resources"
- "input_bathing_water_quality"
- input_water_resources
- input_bathing_water_quality
infrastructure:
- "input_distance_to_infrastructure"
- input_distance_to_infrastructure
base:
- "input_local_administrative_units"
- input_local_administrative_units
population:
- "input_population_2015"
- input_population_2015
outputs:
csvs: {}
maps:
flow:
name: "output_flow"
hash: "0d987f55f4cbebec3640fb69a2a239ea"
name: output_flow
hash: 0d987f55f4cbebec3640fb69a2a239ea

0 comments on commit 58b2387

Please sign in to comment.