diff --git a/.Rbuildignore b/.Rbuildignore index df13eff..6072c0c 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,3 +8,5 @@ img ^_pkgdown\.yml$ ^docs$ ^pkgdown$ +^dev_history\.R$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..8a69796 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,85 @@ +# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. +# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +on: + push: + branches: + - main + - master + - search-colnames + pull_request: + branches: + - main + - master + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: windows-latest, r: 'release'} + - {os: macOS-latest, r: 'release'} + - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + + env: + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v1 + with: + r-version: ${{ matrix.config.r }} + + - 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 + 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' + run: | + while read -r cmd + do + eval sudo $cmd + done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') + + - name: Install dependencies + run: | + remotes::install_deps(dependencies = TRUE) + remotes::install_cran("rcmdcheck") + shell: Rscript {0} + + - name: Check + env: + _R_CHECK_CRAN_INCOMING_REMOTE_: false + run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") + shell: Rscript {0} + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@main + with: + name: ${{ runner.os }}-r${{ matrix.config.r }}-results + path: check diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..09af3c8 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,49 @@ +on: + push: + branches: + - main + - master + +name: pkgdown + +jobs: + pkgdown: + runs-on: macOS-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v1 + + - 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 + 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: | + remotes::install_deps(dependencies = TRUE) + install.packages("pkgdown", type = "binary") + remotes::install_github("ThinkR-open/thinkrtemplate") + shell: Rscript {0} + + - name: Install package + run: R CMD INSTALL . + + - name: Deploy package + run: | + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Actions" + Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..5910c1a --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,48 @@ +on: + push: + branches: + - main + - master + pull_request: + branches: + - main + - master + +name: test-coverage + +jobs: + test-coverage: + runs-on: macOS-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v1 + + - 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 + 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")) + remotes::install_deps(dependencies = TRUE) + remotes::install_cran("covr") + shell: Rscript {0} + + - name: Test coverage + run: covr::codecov() + shell: Rscript {0} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a8510cd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r -language: R -sudo: false -cache: packages - -r_github_packages: - - ThinkR-open/fcuk # pre-install to avoid vignette package errors - -# build matrix; turn on vdiffr only on r release -matrix: - include: - - r: devel - - r: release - env: VDIFFR_RUN_TESTS=true - before_cache: - - Rscript -e 'remotes::install_cran("pkgdown")' - - Rscript -e 'remotes::install_github("ThinkR-open/thinkrtemplate")' - deploy: - provider: pages - skip-cleanup: true - github-token: $GITHUB_PAT - keep-history: true - local-dir: docs - on: - branch: master - skip_cleanup: true - - r: oldrel - -before_install: - - Rscript -e 'update.packages(ask = FALSE)' - -after_success: - - Rscript -e 'devtools::test()' - - Rscript -e 'covr::codecov()' - - Rscript -e 'pkgdown::build_site()' - diff --git a/DESCRIPTION b/DESCRIPTION index ff6b517..e3b777b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,8 +8,8 @@ Authors@R: c(person('Vincent', 'Guyader', email = 'vincent@thinkr.fr', role = c( person(given = "ThinkR", role = "cph")) Description: Automatically suggests a correction when a typo occurs. License: GPL-3 -URL: https://github.com/ThinkRstat/fcuk -BugReports: https://github.com/ThinkRstat/fcuk/issues +URL: https://github.com/ThinkR-open/fcuk +BugReports: https://github.com/ThinkR-open/fcuk/issues Imports: crayon, magrittr, @@ -29,4 +29,4 @@ VignetteBuilder: knitr ByteCompile: true Encoding: UTF-8 LazyData: true -RoxygenNote: 6.1.1 +RoxygenNote: 7.1.1 diff --git a/R/function.R b/R/function.R index c788890..6eb879f 100644 --- a/R/function.R +++ b/R/function.R @@ -10,8 +10,10 @@ #' @examples #' get_all_objets_from_r() get_all_objets_from_r <- function() { - search() %>% - map(ls,all.names = TRUE) %>% + search()[10] %>% + map(ls, all.names = TRUE) %>% + flatten_chr() %>% + map(~{if("data.frame" %in% class(get(.x))){c(.x, names(get(.x)))}else{.x}}) %>% flatten_chr() %>% c(installed.packages() %>% rownames()) } diff --git a/_pkgdown.yml b/_pkgdown.yml index 96f6bab..6a5c690 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,2 +1,4 @@ template: package: thinkrtemplate + +url: https://thinkr-open.github.io/fcuk/ \ No newline at end of file diff --git a/dev_history.R b/dev_history.R new file mode 100644 index 0000000..ea40b00 --- /dev/null +++ b/dev_history.R @@ -0,0 +1,6 @@ +usethis::use_build_ignore("dev_history.R") + +# CI +usethis::use_github_action_check_standard() +usethis::use_github_action("pkgdown") +usethis::use_github_action("test-coverage") diff --git a/man/catch_error.Rd b/man/catch_error.Rd index df4eef9..61d3160 100644 --- a/man/catch_error.Rd +++ b/man/catch_error.Rd @@ -14,8 +14,8 @@ Capture and parse an error message. } \examples{ catch_error() -catch_error("Error: object 'iri' not found\\n") -catch_error("Error: object 'view' not found\\n") +catch_error("Error: object 'iri' not found\n") +catch_error("Error: object 'view' not found\n") } diff --git a/man/fcuk-package.Rd b/man/fcuk-package.Rd index bee2c1a..083905c 100644 --- a/man/fcuk-package.Rd +++ b/man/fcuk-package.Rd @@ -11,13 +11,13 @@ Automatically suggests a correction when a typo occurs. \seealso{ Useful links: \itemize{ - \item \url{https://github.com/ThinkRstat/fcuk} - \item Report bugs at \url{https://github.com/ThinkRstat/fcuk/issues} + \item \url{https://github.com/ThinkR-open/fcuk} + \item Report bugs at \url{https://github.com/ThinkR-open/fcuk/issues} } } \author{ -\strong{Maintainer}: Vincent Guyader \email{vincent@thinkr.fr} (0000-0003-0671-9270) +\strong{Maintainer}: Vincent Guyader \email{vincent@thinkr.fr} (\href{https://orcid.org/0000-0003-0671-9270}{ORCID}) Other contributors: \itemize{