-
Notifications
You must be signed in to change notification settings - Fork 165
143 lines (123 loc) · 4.72 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
---
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: OSGeo/grass
ref: ${{ matrix.grass-version }}
path: grass
- name: Checkout addons
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: grass-addons
- name: ccache
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
with:
create-symlink: true
verbose: 2
evict-old-files: 7d
key: ${{ github.job }}-${{ matrix.grass-version }}-${{ matrix.python-version }}
- 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@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.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@473c68190595b311a74f208fba61a8d8c0d4c247 # v2.11.1
with:
r-version: 4.2.1
Ncpus: 4
- name: Configure ccache for R package builds
run: |
# R package sources are extracted as newly created files
echo "CCACHE_SLOPPINESS=include_file_ctime" >> "${GITHUB_ENV}"
# R temp directory name differs
echo "CCACHE_NOHASHDIR=true" >> "${GITHUB_ENV}"
- name: Get R dependencies
run: |
grass-addons/.github/workflows/install_r_packages.R
- name: Run tests
timeout-minutes: 45
run: |
cd grass-addons/src
../.github/workflows/test.sh --config ../.gunittest.cfg
- name: Make HTML test report available
if: ${{ always() }}
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: testreport-grass-${{ matrix.grass-version }}-python-${{ matrix.python-version }}
path: grass-addons/src/testreport
retention-days: 3