Skip to content

Commit

Permalink
update ci (PR #52)
Browse files Browse the repository at this point in the history
* fix windows ci
* update ubuntu ci
  • Loading branch information
jeffreyhanson authored Jul 1, 2024
1 parent e3cfe16 commit 908d17d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 89 deletions.
75 changes: 27 additions & 48 deletions .github/workflows/R-CMD-check-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,43 +38,41 @@ jobs:
CI: true

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}
# configure git to prevent it from automatically converting line-endings
# this is important to avoid WARNINGS during CRAN checks
# that are false-positives, see:
# https://msmith.de/2020/03/12/r-cmd-check-github-actions.html
- name: Configure git
run: git config --global core.autocrlf false

- uses: r-lib/actions/setup-pandoc@v1
- uses: actions/checkout@v2

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: r-lib/actions/setup-pandoc@v2

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v2
- uses: r-lib/actions/setup-r@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
r-version: ${{ matrix.config.r }}
use-public-rspm: true

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get install libnlopt-dev coinor-libsymphony-dev
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 4
extra-packages: |
any::rcmdcheck
any::remotes
any::XML
gurobi=?ignore
needs: |
check
- name: Install spatial R packages
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_cran("covr")
options(repos = "https://cloud.r-project.org/")
install.packages("sf")
shell: Rscript {0}

- name: Session information
Expand All @@ -84,34 +82,15 @@ jobs:
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
run: |
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-build-vignettes"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Test coverage
if: runner.os == 'Linux' && matrix.config.r == 'release'
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
if: runner.os == 'Linux' && matrix.config.r == 'release'
with:
Expand Down
61 changes: 20 additions & 41 deletions .github/workflows/R-CMD-check-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,41 +46,28 @@ jobs:

- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
cache-version: 4
extra-packages: |
any::rcmdcheck
any::remotes
any::XML
gurobi=?ignore
needs: |
check
- name: Install spatial R packages
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
options("install.packages.compile.from.source" = "never", pkgType = "binary")
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_cran("covr")
options(repos = "https://cloud.r-project.org/")
install.packages("sf")
shell: Rscript {0}

- name: Session information
Expand All @@ -90,19 +77,11 @@ jobs:
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
run: |
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-build-vignettes"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check

0 comments on commit 908d17d

Please sign in to comment.