Skip to content

Commit

Permalink
workingon test coverage #4
Browse files Browse the repository at this point in the history
  • Loading branch information
fawda123 committed Mar 28, 2022
1 parent cf2588a commit 1582d1d
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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 OS dependencies
run : |
rm '/usr/local/bin/gfortran'
brew install jags
- 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}
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: EBASE
Title: Estuarine Bayesian Single-station Estimation Method for Ecosystem Metabolism
Title: Estuarine Bayesian Single-Station Estimation Method for Ecosystem Metabolism
Version: 0.0.0.9000
Date: 2022-03-24
Authors@R: c(
Expand Down Expand Up @@ -50,7 +50,8 @@ Imports:
R2jags,
tidyr
Suggests:
doParallel
testthat (>= 3.0.0),
doParallel
Remotes:
jmarriola/fwoxy
License: CC0
Expand All @@ -61,3 +62,4 @@ URL: https://github.com/fawda123/EBASE
BugReports: https://github.com/fawda123/EBASE/issues
LazyData: true
LazyDataCompression: xz
Config/testthat/edition: 3
4 changes: 4 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
library(testthat)
library(EBASE)

test_check("EBASE")
7 changes: 7 additions & 0 deletions tests/testthat/test-ebase_prep.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test_that("Checking ebase_prep names", {
result <- ebase_prep(exdat, H = 1.85) %>%
names

expect_equal(result, c("Date", "DateTimeStamp", "DO_obs", "DO_sat", "H", "Temp", "Sal",
"PAR", "WSpd", "sc"))
})

0 comments on commit 1582d1d

Please sign in to comment.