Skip to content

Commit fbb83ed

Browse files
committed
updated r actions and pkgdown config
1 parent 2ba39b7 commit fbb83ed

File tree

5 files changed

+71
-184
lines changed

5 files changed

+71
-184
lines changed
+11-44
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
2-
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
31
on:
42
push:
53
paths:
64
- r-package/**
5+
- .github/workflows/R-CMD-check-CRAN.yaml
76
branches:
87
- master
98
- dev
109
pull_request:
1110
paths:
1211
- r-package/**
12+
- .github/workflows/R-CMD-check-CRAN.yaml
1313
branches:
1414
- master
1515
- dev
1616

17-
name: R-CMD-check-as-CRAN
17+
name: R-CMD-check-CRAN
1818

1919
jobs:
2020
R-CMD-check:
@@ -26,10 +26,9 @@ jobs:
2626
fail-fast: false
2727
matrix:
2828
config:
29-
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
29+
- {os: ubuntu-22.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
3030

3131
env:
32-
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
3332
RSPM: ${{ matrix.config.rspm }}
3433
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3534

@@ -42,47 +41,15 @@ jobs:
4241

4342
- uses: r-lib/actions/setup-pandoc@v2
4443

45-
- name: Query dependencies
46-
run: |
47-
install.packages('remotes')
48-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "../.github/depends.Rds", version = 2)
49-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), "../.github/R-version")
50-
shell: Rscript {0}
51-
working-directory: r-package
52-
53-
- name: Cache R packages
54-
uses: actions/cache@v2
44+
- uses: r-lib/actions/setup-r-dependencies@v2
5545
with:
56-
path: ${{ env.R_LIBS_USER }}
57-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
58-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
59-
60-
- name: Install system dependencies
61-
run: |
62-
while read -r cmd
63-
do
64-
eval sudo $cmd
65-
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
66-
working-directory: r-package
67-
68-
- name: Install dependencies
69-
run: |
70-
remotes::install_deps(dependencies = TRUE)
71-
remotes::install_cran("rcmdcheck")
72-
shell: Rscript {0}
73-
working-directory: r-package
46+
extra-packages: any::rcmdcheck
47+
needs: check
48+
working-directory: r-package
7449

75-
- name: Check
50+
- uses: r-lib/actions/check-r-package@v2
51+
with:
52+
working-directory: r-package
7653
env:
7754
_R_CHECK_CRAN_INCOMING_REMOTE_: false
7855
NOT_CRAN: false
79-
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
80-
shell: Rscript {0}
81-
working-directory: r-package
82-
83-
- name: Upload check results
84-
if: failure()
85-
uses: actions/upload-artifact@main
86-
with:
87-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
88-
path: check

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

+11-58
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
2-
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
31
on:
42
push:
53
paths:
64
- r-package/**
5+
- .github/workflows/R-CMD-check.yaml
76
branches:
8-
- main
97
- master
108
- dev
119
pull_request:
1210
paths:
1311
- r-package/**
12+
- .github/workflows/R-CMD-check.yaml
1413
branches:
15-
- main
1614
- master
1715
- dev
1816

@@ -29,15 +27,12 @@ jobs:
2927
matrix:
3028
config:
3129
- {os: windows-latest, r: 'release'}
32-
- {os: windows-latest, r: 'oldrel'}
3330
- {os: macOS-latest, r: 'release'}
34-
# - {os: macOS-latest, r: 'oldrel'}
35-
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
36-
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
37-
- {os: ubuntu-20.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
31+
- {os: ubuntu-22.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
32+
- {os: ubuntu-22.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
33+
- {os: ubuntu-22.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
3834

3935
env:
40-
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
4136
RSPM: ${{ matrix.config.rspm }}
4237
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
4338

@@ -50,54 +45,12 @@ jobs:
5045

5146
- uses: r-lib/actions/setup-pandoc@v2
5247

53-
- name: Query dependencies
54-
run: |
55-
install.packages('remotes')
56-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "../.github/depends.Rds", version = 2)
57-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), "../.github/R-version")
58-
shell: Rscript {0}
59-
working-directory: r-package
60-
61-
- name: Cache R packages
62-
if: runner.os != 'Windows'
63-
uses: actions/cache@v2
48+
- uses: r-lib/actions/setup-r-dependencies@v2
6449
with:
65-
path: ${{ env.R_LIBS_USER }}
66-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
67-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
68-
69-
- name: Install system dependencies (Linux)
70-
if: runner.os == 'Linux'
71-
run: |
72-
while read -r cmd
73-
do
74-
eval sudo $cmd
75-
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
76-
working-directory: r-package
77-
78-
- name: Install system dependencies (MacOS)
79-
if: runner.os == 'macOS'
80-
run: |
81-
brew install pkg-config gdal proj geos
82-
working-directory: r-package
83-
84-
- name: Install dependencies
85-
run: |
86-
remotes::install_deps(dependencies = TRUE)
87-
remotes::install_cran("rcmdcheck")
88-
shell: Rscript {0}
89-
working-directory: r-package
90-
91-
- name: Check
92-
env:
93-
_R_CHECK_CRAN_INCOMING_REMOTE_: false
94-
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
95-
shell: Rscript {0}
96-
working-directory: r-package
50+
extra-packages: any::rcmdcheck
51+
needs: check
52+
working-directory: r-package
9753

98-
- name: Upload check results
99-
if: failure()
100-
uses: actions/upload-artifact@main
54+
- uses: r-lib/actions/check-r-package@v2
10155
with:
102-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
103-
path: check
56+
working-directory: r-package

.github/workflows/pkgdown.yml

+19-38
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,40 @@
11
on:
22
push:
3+
paths:
4+
- r-package/**
5+
- README.md
6+
- .github/workflows/pkgdown.yaml
37
branches:
48
- master
59

610
name: pkgdown
711

812
jobs:
913
pkgdown:
10-
runs-on: ubuntu-20.04
11-
env:
12-
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
14+
runs-on: ubuntu-22.04
15+
1316
steps:
1417
- uses: actions/checkout@v2
1518

1619
- uses: r-lib/actions/setup-r@v2
1720

1821
- uses: r-lib/actions/setup-pandoc@v2
1922

20-
- name: Query dependencies
21-
run: |
22-
install.packages('remotes')
23-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "../.github/depends.Rds", version = 2)
24-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), "../.github/R-version")
25-
shell: Rscript {0}
26-
working-directory: r-package
27-
28-
- name: Cache R packages
29-
uses: actions/cache@v2
30-
with:
31-
path: ${{ env.R_LIBS_USER }}
32-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
33-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
23+
- name: Copy README.md to r-package/index.md
24+
run: cp README.md r-package/index.md
3425

35-
- name: Install system dependencies
36-
run: |
37-
while read -r cmd
38-
do
39-
eval sudo $cmd
40-
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
41-
sudo apt install libharfbuzz-dev libfribidi-dev
42-
working-directory: r-package
26+
- name: Update r-package/index.md figures source
27+
run: sed -i 's/\"r-package\//\"/g' r-package/index.md
4328

44-
- name: Install dependencies
45-
run: |
46-
remotes::install_deps(dependencies = TRUE)
47-
install.packages("pkgdown")
48-
shell: Rscript {0}
49-
working-directory: r-package
50-
51-
- name: Install package
52-
run: R CMD INSTALL .
53-
working-directory: r-package
29+
- uses: r-lib/actions/setup-r-dependencies@v2
30+
with:
31+
extra-packages: any::pkgdown, local::.
32+
needs: website
33+
working-directory: r-package
5434

55-
- name: Deploy package
35+
- name: Build and deploy pkgdown site
5636
run: |
57-
git config --local user.email "[email protected]"
5837
git config --local user.name "GitHub Actions"
59-
Rscript -e 'pkgdown::deploy_to_branch(pkg = "./r-package", new_process = FALSE, examples = FALSE)'
38+
git config --local user.email "[email protected]"
39+
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
40+
working-directory: r-package

.github/workflows/test-coverage.yaml

+25-36
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,50 @@ on:
44
- r-package/**
55
- .github/workflows/test-coverage.yaml
66
branches:
7-
- main
7+
- dev
8+
- master
89
pull_request:
910
paths:
1011
- r-package/**
1112
- .github/workflows/test-coverage.yaml
1213
branches:
13-
- main
14+
- dev
15+
- master
1416

1517
name: test-coverage
1618

1719
jobs:
1820
test-coverage:
19-
runs-on: ubuntu-18.04
20-
env:
21-
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
22-
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
21+
runs-on: ubuntu-22.04
2322

2423
steps:
2524
- uses: actions/checkout@v2
2625

2726
- uses: r-lib/actions/setup-r@v2
28-
id: install-r
2927

30-
- name: Install pak and query dependencies
31-
run: |
32-
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
33-
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), "../.github/r-depends.rds")
34-
shell: Rscript {0}
35-
working-directory: r-package
36-
37-
- name: Restore R package cache
38-
uses: actions/cache@v2
28+
- uses: r-lib/actions/setup-r-dependencies@v2
3929
with:
40-
path: |
41-
${{ env.R_LIBS_USER }}/*
42-
!${{ env.R_LIBS_USER }}/pak
43-
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
44-
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
30+
extra-packages: any::covr, any::xml2
31+
needs: coverage
32+
working-directory: r-package
4533

46-
- name: Install system dependencies
47-
if: runner.os == 'Linux'
48-
run: |
49-
pak::local_system_requirements(execute = TRUE)
50-
pak::pkg_system_requirements("covr", execute = TRUE)
51-
shell: Rscript {0}
52-
working-directory: r-package
53-
54-
- name: Install dependencies
34+
- name: Test coverage
5535
run: |
56-
pak::local_install_dev_deps(upgrade = TRUE)
57-
pak::pkg_install("covr")
36+
cov <- covr::package_coverage(
37+
quiet = FALSE,
38+
clean = FALSE,
39+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
40+
)
41+
covr::to_cobertura(cov)
5842
shell: Rscript {0}
5943
working-directory: r-package
6044

61-
- name: Test coverage
62-
run: covr::codecov(quiet = FALSE)
63-
shell: Rscript {0}
64-
working-directory: r-package
45+
- uses: codecov/codecov-action@v4
46+
with:
47+
# Fail if error if not on PR, or if on PR and token is given
48+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
49+
file: ./cobertura.xml
50+
plugin: noop
51+
disable_search: true
52+
token: ${{ secrets.CODECOV_TOKEN }}
53+
working-directory: r-package

r-package/pkgdown/_pkgdown.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
destination: ./docs
1+
url: https://ipeagit.github.io/geobr/
2+
3+
template:
4+
bootstrap: 5
5+
light-switch: true
26

37
development:
48
mode: auto
59

6-
7-
repo:
8-
url:
9-
home: https://github.com/ipeaGIT/geobr/
10-
source: https://github.com/ipeaGIT/geobr/tree/master/
11-
12-
1310
reference:
1411
- title: "Political administrative"
1512
- contents:

0 commit comments

Comments
 (0)