Skip to content

Commit

Permalink
Added codecov action
Browse files Browse the repository at this point in the history
  • Loading branch information
JBGruber committed Jul 14, 2021
1 parent c0377b7 commit 8556014
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 7 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -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}
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions R/expandurls.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
}
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ df
```

| url | expanded\_url | domain | status | datetime | headline | author | text | misc |
|:-------------------------------|:----------------------------------------------------------------------------------|:--------------------|:-------|:---------|:---------|:-------|:-----|:-----|
| <https://tinyurl.com/386e98k5> | <https://www.theguardian.com/tv-and-radio/2021/jul/12/should-marge-divorce-homer> | www.theguardian.com | NA | NA | NA | NA | NA | 200 |
|:-------------------------------|:----------------------------------------------------------------------------------|:--------------------|-------:|:---------|:---------|:-------|:-----|:-----|
| <https://tinyurl.com/386e98k5> | <https://www.theguardian.com/tv-and-radio/2021/jul/12/should-marge-divorce-homer> | 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
Expand Down Expand Up @@ -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
18 changes: 18 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions tests/spelling.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ if(requireNamespace("spelling", quietly = TRUE)) {
skip_on_cran = TRUE
)
}

0 comments on commit 8556014

Please sign in to comment.