-
-
Notifications
You must be signed in to change notification settings - Fork 200
258 lines (214 loc) · 7.15 KB
/
build-and-check.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
- main
- fix/*
pull_request:
branches:
- main
- fix/*
schedule:
- cron: '0 2 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.sha }}-${{ github.base_ref || '' }}
cancel-in-progress: true
name: R-CMD-check
jobs:
build_src_package:
runs-on: ubuntu-22.04
name: Build source R package
env:
RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: apt update
run: |
sudo apt-get update
sudo apt-get install -y libarpack2-dev
shell: bash
- name: Cache Python virtualenv
uses: actions/cache@v2
with:
path: .venv
key: Python-venv-jammy-${{ runner.os }}-${{ hashFiles('tools/build-requirements.txt') }}
- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
needs: build
pak-version: devel
- name: Create R source package
run: |
make igraph
shell: bash
- name: Commit changes
if: ${{ env.GITHUB_ACTOR == env.GITHUB_REPOSITORY_OWNER }}
run: |
if [ -n "$(git status --porcelain)" ]; then
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git fetch
if [ -n "${GITHUB_HEAD_REF}" ]; then
git add .
git stash save
git switch ${GITHUB_HEAD_REF}
git stash pop
fi
git add .
git commit -m "Automated changes"
git push
fi
shell: bash
- name: Package validation
if: ${{ env.GITHUB_ACTOR != env.GITHUB_REPOSITORY_OWNER }}
run: |
git status --porcelain
if [ -n "$(git status --porcelain)" ]; then
git add .
git diff --cached
/bin/false
fi
shell: bash
- name: Smoke test
run: |
make test
shell: bash
- name: Upload R source package
uses: actions/upload-artifact@main
with:
name: rigraph
path: igraph_*.tar.gz
retention-days: 5
R-CMD-check:
runs-on: ${{ matrix.config.os }}
needs: build_src_package
name: Check ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
# - {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
# - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'oldrel-1', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'oldrel-2', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'oldrel-3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'oldrel-4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
env:
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RGL_USE_NULL: true # Ensure that rgl functions correctly on macOS
MAKEFLAGS: -j2
_R_CHECK_PKG_SIZES_: FALSE
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install ccache
uses: hendrikmuhs/ccache-action@v1.2.10
with:
max-size: 10G
verbose: 1
save: false
restore: false
- name: apt update
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libarpack2-dev
shell: bash
- name: apt update
if: runner.os == 'macOS'
run: |
brew install glpk
shell: bash
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- name: Check R package
uses: r-lib/actions/check-r-package@v2
with:
error-on: '"note"'
coverage:
runs-on: ubuntu-20.04
needs: build_src_package
name: Coverage
env:
RSPM: https://packagemanager.rstudio.com/cran/__linux__/focal/latest
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
MAKEFLAGS: -j2
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: apt update
run: |
sudo apt-get update
sudo apt-get install -y libarpack2-dev
shell: bash
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
needs: coverage
pak-version: devel
- name: Run coverage
run: |
line_exclusions <- fs::dir_ls(c("src/vendor"), type = "file", recurse = TRUE)
cov <- covr::package_coverage(
type = c("tests", "examples"),
line_exclusions = as.list(names(line_exclusions)),
quiet = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}
sanitizer:
runs-on: ubuntu-22.04
needs: build_src_package
name: Sanitizer
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: apt update
run: |
sudo apt-get update
sudo apt-get install -y libarpack2-dev
shell: bash
- name: run sanitizer
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/krlmlr/rigraph-san:main
options: --rm --platform linux/amd64 -v ${{ github.workspace }}:/rigraph
run: |
set -e
printenv
cd rigraph
RDcsan CMD INSTALL . --no-byte-compile
TESTTHAT_PARALLEL=false CI=true RDcsan -q -e 'testthat::test_local(reporter = c("location", "summary"), load_package = "installed")'