Skip to content

Commit

Permalink
CI: Modernize workflows and adding concurrency groups to cancel outda…
Browse files Browse the repository at this point in the history
…ted jobs (#1031)
  • Loading branch information
echoix committed Mar 3, 2024
1 parent 60644ee commit e5ea956
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 49 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ name: Python Black Formatting
on:
push:
branches:
- grass*
- grass[0-9]+
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress:
# Do not cancel on protected branches, like grass8
${{ github.ref_protected != true }}

permissions: {}

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

runs-on: ${{ matrix.os }}
Expand Down
41 changes: 25 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@ name: Build and test

on:
push:
branches:
- grass[0-9]+
pull_request:
schedule:
# 01:00 Pacific Time (in UTC), every day (late night PT)
- cron: 0 8 * * *
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress:
# Do not cancel on protected branches, like grass8
${{ github.ref_protected != true }}

permissions: {}

jobs:
build:
name: ${{ matrix.grass-version }} (Python ${{ matrix.python-version }})

runs-on: ubuntu-22.04

strategy:
matrix:
# Test with relevant active branches or tags and supported Python
Expand All @@ -22,15 +31,14 @@ jobs:
# only.
include:
- grass-version: main
python-version: '3.10'
python-version: "3.11"
- grass-version: releasebranch_8_2
python-version: '3.7'
python-version: "3.7"
- grass-version: releasebranch_8_3
python-version: '3.10'
python-version: "3.10"
fail-fast: false

steps:

- name: Checkout core
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -62,39 +70,40 @@ jobs:
- name: Create installation directory
run: |
mkdir $HOME/install
mkdir "$HOME/install"
- name: Set number of cores for compilation
run: |
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
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
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
../grass-addons/.github/workflows/build_grass.sh "$HOME/install"
- name: Add the bin directory to PATH
run: |
echo "$HOME/install/bin" >> $GITHUB_PATH
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
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
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)
GDAL_VERSION="$(gdal-config --version)"
export GDAL_VERSION
pip install -r grass-addons/.github/workflows/extra_requirements.txt
- name: Set up R
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,26 @@ name: ClangFormat Check
on:
push:
branches:
- grass*
- grass[0-9]+
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress:
# Do not cancel on protected branches, like grass8
${{ github.ref_protected != true }}

permissions: {}

jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '15'
clang-format-version: "15"
check-path: .
19 changes: 15 additions & 4 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@
name: Python Flake8 Code Quality

on:
- push
- pull_request
push:
branches:
- grass[0-9]+
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress:
# Do not cancel on protected branches, like grass8
${{ github.ref_protected != true }}

permissions: {}

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

- name: Install
run: |
Expand All @@ -24,4 +35,4 @@ jobs:
- name: Run Flake8
run: |
flake8 --count --statistics --show-source --jobs=$(nproc) .
flake8 --count --statistics --show-source --jobs="$(nproc)" .
65 changes: 44 additions & 21 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,56 @@
name: General linting

on:
- push
- pull_request
push:
branches:
- grass[0-9]+
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress:
# Do not cancel on protected branches, like grass8
${{ github.ref_protected != true }}

permissions: {}

jobs:
super-linter:
name: GitHub Super Linter

runs-on: ubuntu-latest

permissions:
contents: read
packages: read
# To report GitHub Actions status checks
statuses: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
# super-linter needs the full git history to get the
# list of files that changed across commits
fetch-depth: 0
- name: Lint code base
uses: github/super-linter@v5
uses: super-linter/super-linter@v6.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Listed but commented out linters would be nice to have.
# (see https://github.com/github/super-linter#environment-variables)
#
# Python (supported using Pylint) and C/C++ (not supported) are
# handled separately due to the complexity of the settings.
# VALIDATE_BASH: true
# VALIDATE_CSS: true
# VALIDATE_DOCKER: true
VALIDATE_JAVASCRIPT_ES: true
# VALIDATE_JAVASCRIPT_STANDARD: true
VALIDATE_JSON: true
VALIDATE_MARKDOWN: true
VALIDATE_POWERSHELL: true
# VALIDATE_XML: true
VALIDATE_YAML: true
FILTER_REGEX_EXCLUDE: ".*/src/gui/wxpython/wx.metadata/profiles/.*.xml"
IGNORE_GENERATED_FILES: true
LOG_LEVEL: NOTICE
VALIDATE_BASH: false # Until issues are fixed, some valid warnings
VALIDATE_CHECKOV: false # Until issues are fixed
VALIDATE_CLANG_FORMAT: false # Until we continue to check it in another workflow
VALIDATE_CPP: false # Until a configuration file is created to not contradict clang-format
VALIDATE_GITLEAKS: false # Until configured to ignore g.parser key in main.c files
VALIDATE_HTML: false # Until configured, some valid findings
VALIDATE_LATEX: false # Until issues are fixed, some valid findings
VALIDATE_NATURAL_LANGUAGE: false # Until issues are fixed, lots of valid suggestions
VALIDATE_PERL: false # Until issues are fixed
VALIDATE_PYTHON_BLACK: false # Until code is upgraded to a newer black version
VALIDATE_PYTHON_FLAKE8: false
VALIDATE_PYTHON_ISORT: false # Until issues are fixed
VALIDATE_PYTHON_MYPY: false # Issue with module name wx.wms
VALIDATE_PYTHON_PYLINT: false # Until issues are fixed
VALIDATE_R: false
VALIDATE_RENOVATE: false # Until configuration file is upgraded
VALIDATE_SHELL_SHFMT: false # Until reformatting failing files
2 changes: 1 addition & 1 deletion src/raster/r.findtheriver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This program is free software under the GNU General Public License

## AUTHOR

Brian Miles - brian_miles@unc.edu
Brian Miles - <brian_miles@unc.edu>

## DESCRIPTION

Expand Down
4 changes: 2 additions & 2 deletions src/raster/r.landscape.evol/r.landscape.evol.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,13 @@ uniform stream width and depth. Ideally, the width and depth of the carved
channels should decrease in width and depth from the basin outlet to the stream
sources. To do this requires several steps. First extract an
appropriately-scaled stream network using _r.watershed_ and/or
_r.stream.extract__ and an appropriate interior basin threshold parameter to
_r.stream.extract_ and an appropriate interior basin threshold parameter to
isolate main trunk streams with some smaller tributary branches. Use this
output raster streams map as the input to the addon module _r.stream.order_
with the output option for the Shreve stream order. This will create a raster
streams map where trunk streams are coded with a large number, and tributaries
with smaller numbers. Use _r.univar_ to determine the maximum Shreve value, and
then use _r.mapcalc__ to standardize the values between 0 and 1 by dividing the
then use _r.mapcalc_ to standardize the values between 0 and 1 by dividing the
Shreve-scaled streams map by the maximum Shreve order value (ensure that you
use a decimal point behind the maximum value number so that a floating point
map will be made). The standardized Shreve order streams raster map is then
Expand Down

0 comments on commit e5ea956

Please sign in to comment.