-
Notifications
You must be signed in to change notification settings - Fork 235
208 lines (174 loc) · 5.9 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: CI
on:
push:
branches:
- master
- develop
tags:
- '*'
pull_request:
merge_group:
issue_comment:
types:
- created
env:
R_LIBS_USER: /usr/local/lib/R/site-library
LC_ALL: en_US.UTF-8
NCPUS: 2
PGHOST: postgres
CI: true
jobs:
# ----------------------------------------------------------------------
# R TEST
# ----------------------------------------------------------------------
test:
if: github.event_name != 'issue_comment' || startsWith(github.event.comment.body, '/build')
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
R:
- "4.2"
- "4.1"
services:
postgres:
image: mdillon/postgis:9.5
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
container:
image: pecan/depends:R${{ matrix.R }}
steps:
# checkout source code
- name: work around https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
set-safe-directory: false
# install additional tools needed
- name: install utils
run: apt-get update && apt-get install -y postgresql-client qpdf
- name: update dependency lists
run: Rscript scripts/generate_dependencies.R
- name: check for out-of-date dependencies files
uses: infotroph/tree-is-clean@v1
- name: install newly-added dependencies
working-directory: docker/depends
run: Rscript pecan.depends.R
# initialize database
- name: db setup
uses: docker://pecan/db:ci
- name: add models to db
run: ./scripts/add.models.sh
# run PEcAn tests
- name: test
run: make -j1 test
- name: check for out-of-date files
uses: infotroph/tree-is-clean@v1
# ----------------------------------------------------------------------
# R CHECK
# ----------------------------------------------------------------------
check:
if: github.event_name != 'issue_comment' || startsWith(github.event.comment.body, '/build')
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: [check_base, check_modules, check_models]
R:
- "4.2"
- "4.1"
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
_R_CHECK_LENGTH_1_CONDITION_: true
_R_CHECK_LENGTH_1_LOGIC2_: true
# Avoid compilation check warnings that come from the system Makevars
# See https://stat.ethz.ch/pipermail/r-package-devel/2019q2/003898.html
_R_CHECK_COMPILATION_FLAGS_KNOWN_: -Wformat -Werror=format-security -Wdate-time
# Keep R checks from trying to consult the very flaky worldclockapi.com
_R_CHECK_SYSTEM_CLOCK_: 0
container:
image: pecan/depends:R${{ matrix.R }}
steps:
# checkout source code
- name: work around https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
set-safe-directory: false
# Forbid spaces in names. Yes, *we* know it's not 1980 anymore, but Make doesn't.
- name: check for filenames that would confuse Make
run: |
SPACENAMES=`find . -name '* *'`
if [ -n "$SPACENAMES" ]; then
echo "::error file=${SPACENAMES}::Spaces in filename(s): ${SPACENAMES}. Please rename these files by converting spaces to underscores."
exit 1
fi
# install additional tools needed
- name: install utils
run: apt-get update && apt-get install -y postgresql-client qpdf
- name: install new dependencies
run: Rscript scripts/generate_dependencies.R && cd docker/depends/ && Rscript pecan.depends.R
# run PEcAn checks
# The package names of base, modules, and models are passed as matrix variables to avoid repeatability of code
- name: check
run: make -j1 ${{ matrix.package }}
env:
REBUILD_DOCS: "FALSE"
RUN_TESTS: "FALSE"
- name: check for out-of-date files
uses: infotroph/tree-is-clean@v1
# ----------------------------------------------------------------------
# SIPNET TESTS
# ----------------------------------------------------------------------
sipnet:
if: github.event_name != 'issue_comment' || startsWith(github.event.comment.body, '/build')
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
R:
- "4.2"
- "4.1"
services:
postgres:
image: mdillon/postgis:9.5
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
container:
image: pecan/depends:R${{ matrix.R }}
steps:
# checkout source code
- name: work around https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
set-safe-directory: false
# install additional tools needed
- name: install utils
run: apt-get update && apt-get install -y postgresql-client qpdf
- name: install new dependencies
run: Rscript scripts/generate_dependencies.R && cd docker/depends/ && Rscript pecan.depends.R
# initialize database
- name: db setup
uses: docker://pecan/db:ci
- name: add models to db
run: ./scripts/add.models.sh
# install sipnet
- name: Check out SIPNET
uses: actions/checkout@v4
with:
repository: PecanProject/sipnet
path: sipnet
set-safe-directory: false
- name: install sipnet
run: |
cd ${GITHUB_WORKSPACE}/sipnet
make
# compile PEcAn code
- name: build
run: make -j1
# run SIPNET test
- name: integration test
run: ./tests/integration.sh ghaction