-
Notifications
You must be signed in to change notification settings - Fork 1
166 lines (149 loc) · 5.12 KB
/
recheck.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
name: Run a recheck
on:
workflow_call:
inputs:
which:
description: Should be 'strong' or 'most'.
type: string
default: strong
required: false
subdirectory:
description: Subdirectory of R package to be checked
required: false
type: string
default: ''
repository:
description: Repository to checkout (as owner/repo)
required: false
type: string
default: ''
ref:
description: The branch, tag or SHA to checkout
required: false
type: string
default: ''
env:
R_LIBS_USER: ${{github.workspace}}/pkglib
_R_CHECK_FORCE_SUGGESTS_: 'FALSE'
_R_CHECK_CRAN_INCOMING_: 'FALSE'
_R_CHECK_VIGNETTES_SKIP_RUN_MAYBE_: 'TRUE' #remove for R-4.4
_R_CHECK_ELAPSED_TIMEOUT_: 3600
GITHUB_ACTIONS: ''
CI: ''
jobs:
prepare:
name: Prepare dependencies
runs-on: ubuntu-latest
container: ghcr.io/r-devel/recheck
outputs:
oldfile: ${{ steps.filenames.outputs.oldfile }}
newfile: ${{ steps.filenames.outputs.newfile }}
steps:
- name: prepare
run: |
mkdir -p $R_LIBS_USER
R -e ".libPaths()"
- name: checkout
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
path: source
- name: Set package source directory
run: |
if [ "${{ inputs.subdirectory }}" ]; then
echo "PKG_SOURCE_DIR=source/${{ inputs.subdirectory }}" >> $GITHUB_ENV
else
echo "PKG_SOURCE_DIR=source" >> $GITHUB_ENV
fi
- name: download dependencies
run: rechecktools::install_recheck_deps('${{env.PKG_SOURCE_DIR}}', '${{inputs.which}}')
shell: Rscript {0}
- name: build source package
run: |
mkdir newpkg
R CMD build ${{env.PKG_SOURCE_DIR}}
mv *.tar.gz newpkg/
rm -Rf source
- name: Get old version of package
shell: Rscript {0}
run: |
dir.create("oldpkg")
pkg <- sub("_.*", "", list.files("newpkg"))
download.packages(pkg, "oldpkg", repos = "https://cran.r-project.org")
- name: Get file names
id: filenames
run: |
echo "oldfile=$(cd oldpkg; echo *.tar.gz)" >> "$GITHUB_OUTPUT"
echo "newfile=$(cd newpkg; echo *.tar.gz)" >> "$GITHUB_OUTPUT"
- name: Save package and library
uses: actions/cache/save@v4
with:
path: |
pkglib
newpkg
oldpkg
key: ${{ runner.os }}-${{ github.run_id }}-${{github.run_attempt}}
checks:
needs: prepare
runs-on: ubuntu-latest
name: Recheck ${{matrix.check == 'oldpkg' && needs.prepare.outputs.oldfile || needs.prepare.outputs.newfile}} (${{matrix.check}})
container: ghcr.io/r-devel/recheck
timeout-minutes: 600
strategy:
matrix:
check: [ 'oldpkg', 'newpkg' ]
steps:
- name: Download package and library
uses: actions/cache/restore@v4
with:
path: |
pkglib
newpkg
oldpkg
key: ${{ runner.os }}-${{ github.run_id }}-${{github.run_attempt}}
- name: Run checks
shell: Rscript {0}
run: |
checkdir <- "${{matrix.check}}"
options(repos = c(CRAN = 'https://cloud.r-project.org'))
reverse <- list(repos = 'https://cloud.r-project.org', which = "${{ inputs.which }}")
Sys.setenv(R_PROFILE="nothing") # do not set binary p3m mirror in child proc
tools::check_packages_in_dir(checkdir, reverse = reverse, Ncpus = parallel::detectCores())
details <- tools::check_packages_in_dir_details(checkdir)
write.csv(details, file.path(checkdir, 'check-details.csv'))
writeLines(paste(format(details), collapse = "\n\n"), file.path(checkdir, 'check-details.txt'))
tools::summarize_check_packages_in_dir_results(checkdir)
- uses: actions/upload-artifact@v4
with:
name: ${{matrix.check}}-checklogs
path: |
${{matrix.check}}/*/*.log
${{matrix.check}}/*/*.out
${{matrix.check}}/*/*.Rout
${{matrix.check}}/*/*.fail
${{matrix.check}}/Outputs
${{matrix.check}}/check-details.*
results:
name: Show results
needs: checks
runs-on: ubuntu-latest
container: ghcr.io/r-hub/r-minimal/r-minimal:latest
steps:
- name: Download log files
uses: actions/download-artifact@v4
- name: Get results
shell: Rscript {0}
run: |
cat("\n------- Check results summary ------\n")
tools::summarize_check_packages_in_dir_results("newpkg-checklogs")
# Check for regressions
cat("\n------- Check for regressions ------\n")
changes <- tools::check_packages_in_dir_changes("newpkg-checklogs", "oldpkg-checklogs")
if(nrow(changes)){
cat("Changes:\n")
print(changes)
stop("Found potential problems")
} else {
cat("No changes between old and new version\n")
}