From 85560141c2416a04dd91d41d44200917f4c86e4b Mon Sep 17 00:00:00 2001 From: JBGruber Date: Wed, 14 Jul 2021 12:52:22 +0200 Subject: [PATCH] Added codecov action --- .github/workflows/test-coverage.yaml | 48 ++++++++++++++++++++++++++++ DESCRIPTION | 2 +- R/expandurls.R | 4 +-- README.Rmd | 2 +- README.md | 6 ++-- inst/WORDLIST | 18 +++++++++++ tests/spelling.R | 1 + 7 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/test-coverage.yaml diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..ba1f94f --- /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: 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")) + remotes::install_deps(dependencies = TRUE) + remotes::install_cran("covr") + shell: Rscript {0} + + - name: Test coverage + run: covr::codecov() + shell: Rscript {0} diff --git a/DESCRIPTION b/DESCRIPTION index 51e26c2..771e312 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,4 +27,4 @@ Encoding: UTF-8 BugReports: https://github.com/JBGruber/paperboy/issues RoxygenNote: 7.1.1 VignetteBuilder: knitr -Language: en-US +Language: en-GB diff --git a/R/expandurls.R b/R/expandurls.R index 5f726e9..4af2b5b 100755 --- a/R/expandurls.R +++ b/R/expandurls.R @@ -28,7 +28,7 @@ expandurls <- function(url, function(req) { pages[[url]] <<- tibble::tibble( expanded_url = req$url, - status_code = req$status_code + status = req$status_code ) } } @@ -39,7 +39,7 @@ expandurls <- function(url, if (i_f) { pages[[req$url]] <<- tibble::tibble( expanded_url = "connection error", - status_code = 503L + status = 503L ) return(req) } else { diff --git a/README.Rmd b/README.Rmd index 0d40736..0e52bb8 100644 --- a/README.Rmd +++ b/README.Rmd @@ -102,5 +102,5 @@ tibble::tribble( - **Gold**: Runs without any issues - **Silver**: Runs with some issues -- **Broken**: Currently not working +- **Broken**: Currently not working, fix has been requested diff --git a/README.md b/README.md index b28cc07..78ffbfe 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ df ``` | url | expanded\_url | domain | status | datetime | headline | author | text | misc | -|:-------------------------------|:----------------------------------------------------------------------------------|:--------------------|:-------|:---------|:---------|:-------|:-----|:-----| -| | | www.theguardian.com | NA | NA | NA | NA | NA | 200 | +|:-------------------------------|:----------------------------------------------------------------------------------|:--------------------|-------:|:---------|:---------|:-------|:-----|:-----| +| | | www.theguardian.com | 200 | NA | NA | NA | NA | NULL | The returned `data.frame` contains important meta information about the news items and their full text. Notice, that the function had no problem @@ -93,4 +93,4 @@ it via a pull request. - **Gold**: Runs without any issues - **Silver**: Runs with some issues -- **Broken**: Currently not working +- **Broken**: Currently not working, fix has been requested diff --git a/inst/WORDLIST b/inst/WORDLIST index f20e583..c4e8613 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,5 +1,23 @@ +CMD +Codecov +Lifecycle +POSIXct +buzzfeed +com +datetime +forbes +huffingtonpost +jul +marge mediacloud +org +theguardian tibble +tinyurl +tv +uk unshortened +urls webscraper webscraping +www diff --git a/tests/spelling.R b/tests/spelling.R index 192d49e..50f8f12 100644 --- a/tests/spelling.R +++ b/tests/spelling.R @@ -5,3 +5,4 @@ if(requireNamespace("spelling", quietly = TRUE)) { skip_on_cran = TRUE ) } +