Skip to content

Commit aea786f

Browse files
committed
Modernize R CMD Check
1 parent 0348a0c commit aea786f

File tree

1 file changed

+45
-71
lines changed

1 file changed

+45
-71
lines changed

.github/workflows/R-CMD-check.yml

Lines changed: 45 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -64,93 +64,67 @@ jobs:
6464
- uses: actions/checkout@v4
6565
with:
6666
submodules: true
67-
68-
- uses: r-lib/actions/setup-r@v2
69-
with:
70-
r-version: ${{ matrix.config.r }}
71-
72-
- uses: r-lib/actions/setup-pandoc@v2
73-
74-
- name: Query dependencies
75-
if: runner.os != 'macOS'
76-
run: |
77-
install.packages('remotes')
78-
saveRDS(
79-
remotes::dev_package_deps(dependencies = c("soft",
80-
"Config/Needs/github-actions")), ".github/depends.Rds", version = 2)
81-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor),
82-
".github/R-version")
83-
shell: Rscript {0}
84-
85-
- name: Query dependencies (macOS)
86-
if: runner.os == 'macOS'
87-
run: |
88-
install.packages('remotes')
89-
saveRDS(
90-
remotes::dev_package_deps(dependencies = c("soft",
91-
"Config/Needs/coverage", "Config/Needs/github-actions"))
92-
, ".github/depends.Rds", version = 2)
93-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor),
94-
".github/R-version")
95-
shell: Rscript {0}
96-
97-
- name: Cache R packages
98-
if: runner.os != 'Windows'
99-
uses: actions/cache@v4
100-
with:
101-
path: ${{ env.R_LIBS_USER }}
102-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
103-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
104-
67+
68+
- uses: actions/cache@v4
69+
10570
- name: Install system dependencies (Linux)
10671
if: runner.os == 'Linux'
10772
run: |
10873
sudo apt-get update -y
10974
sudo apt-get install -y libpoppler-glib-dev bwidget libavfilter-dev libtesseract-dev gdal-bin proj-bin libgdal-dev libproj-dev tesseract-ocr-eng libleptonica-dev tcl libgtk2.0-dev libgtk-3-dev
11075
sudo pkg-config --libs poppler-glib
11176
sudo pkg-config --cflags poppler-glib
112-
while read -r cmd
113-
do
114-
eval sudo $cmd
115-
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "${OS_VERSION}"))')
11677
78+
- uses: r-lib/actions/setup-r@v2
79+
with:
80+
r-version: ${{ matrix.config.r }}
81+
82+
- uses: r-lib/actions/setup-pandoc@v2
83+
11784
- name: Install system dependencies (macOS)
11885
if: runner.os == 'macOS'
11986
run: |
12087
brew install libgit2 xquartz
12188
122-
- name: Install callr (Windows)
89+
- name: Set up R dependencies (Windows)
12390
if: runner.os == 'Windows'
124-
run: |
125-
remotes::install_cran("callr")
126-
shell: Rscript {0}
127-
128-
- name: Install dependencies
129-
run: |
130-
remotes::install_deps(dependencies = c("soft", "Config/Needs/github-actions"))
131-
shell: Rscript {0}
132-
133-
- name: Install coverage dependencies
134-
if: runner.os == 'macOS'
135-
run: |
136-
remotes::install_deps(dependencies = 'Config/Needs/coverage')
137-
shell: Rscript {0}
138-
139-
- name: Check
140-
env:
141-
_R_CHECK_CRAN_INCOMING_REMOTE_: false
142-
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
143-
shell: Rscript {0}
144-
145-
# - name: Upload check results
146-
# if: failure()
147-
# uses: actions/upload-artifact@main
148-
# with:
149-
# name: ${{ runner.os }}-r${{ matrix.config.r }}-results
150-
# path: check
91+
uses: r-lib/actions/setup-r-dependencies@v2
92+
with:
93+
extra-packages: callr
94+
needs: |
95+
check
96+
coverage
97+
github-actions
98+
99+
- name: Set up R dependencies (Non-Windows)
100+
if: runner.os != 'Windows'
101+
uses: r-lib/actions/setup-r-dependencies@v2
102+
with:
103+
needs: |
104+
check
105+
github-actions
106+
extra-packages: |
107+
phangorn=?ignore-before-r=4.1.0
108+
109+
- name: Check package
110+
uses: r-lib/actions/check-r-package@v2
151111

152112
- name: Test coverage
153-
if: runner.os == 'macOS'
113+
if: runner.os == 'Windows'
154114
run: |
155115
covr::codecov()
156116
shell: Rscript {0}
117+
118+
- name: Notify on failure
119+
if: failure() && github.event_name == 'schedule'
120+
uses: actions/github-script@v7
121+
with:
122+
github-token: ${{ secrets.GITHUB_TOKEN }}
123+
script: |
124+
github.rest.issues.createComment({
125+
owner: context.repo.owner,
126+
repo: context.repo.repo,
127+
issue_number: 31,
128+
body: 'Scheduled workflow has failed: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
129+
});
130+

0 commit comments

Comments
 (0)