Build and test #209
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 | |
# versions, but also limit the number of jobs by, e.g., testing only | |
# every second version or testing older GRASS versions with older Python | |
# only. | |
include: | |
- grass-version: main | |
python-version: "3.11" | |
- grass-version: releasebranch_8_4 | |
python-version: "3.10" | |
fail-fast: false | |
steps: | |
- name: Checkout core | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
repository: OSGeo/grass | |
ref: ${{ matrix.grass-version }} | |
path: grass | |
- name: Checkout addons | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
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@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
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: | | |
GDAL_VERSION="$(gdal-config --version)" | |
export GDAL_VERSION | |
UDUNITS2_XML_PATH=/usr/share/xml/udunits/udunits2.xml | |
export UDUNITS2_XML_PATH | |
pip install -r grass-addons/.github/workflows/extra_requirements.txt | |
- name: Set up R | |
uses: r-lib/actions/setup-r@e6be4b3706e0f39bc7a4cf4496a5f2c4cb840040 # v2.10.1 | |
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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: testreport-grass-${{ matrix.grass-version }}-python-${{ matrix.python-version }} | |
path: grass-addons/src/testreport | |
retention-days: 3 |