Test-Services #606
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
schedule: | |
- cron: '0 0 * * *' | |
name: Test-Services | |
jobs: | |
Test-Services: | |
runs-on: macOS-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
EMODNETWFS_CI: yes | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: 'release' | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Brew and macOS config | |
if: runner.os == 'macOS' | |
run: | | |
rm -f '/usr/local/bin/gfortran' | |
brew install pkg-config | |
brew install udunits | |
brew install gdal | |
cat <<EOT >> .Renviron | |
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ | |
PROJ_LIB=/usr/local/opt/proj/share/proj/ | |
# for installing XML package from source | |
XML_CONFIG=/usr/local/opt/libxml2/bin/xml2-config | |
EOT | |
cat <<EOT >> .Rprofile | |
config_args <- c("sf" = "--with-proj-lib=/usr/local/lib/", "rgdal" = "--with-proj-lib=/usr/local/lib/ --with-proj-include=/usr/local/include/") | |
r <- getOption("repos") | |
r["CRAN"] <- "https://cran.rstudio.com" | |
options(configure.args = config_args, repos = r) | |
EOT | |
- 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: Restore R package cache | |
uses: actions/cache@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 dependencies | |
run: | | |
install.packages(c("remotes", "testthat")) | |
remotes::install_deps(dependencies = TRUE, type = "binary") | |
shell: Rscript {0} | |
- name: Test Services | |
run: | | |
options(crayon.enabled = TRUE) | |
install.packages(".", repos = NULL, type="source") | |
test_service <- lapply(emodnet.wfs::emodnet_wfs()$service_name, emodnet.wfs::emodnet_init_wfs_client); | |
testthat::test_that("All services work", {testthat::expect_equal(class(test_service), "list")}) | |
shell: Rscript {0} |