Skip to content

Commit

Permalink
Merge pull request #47 from EngineerDanny/master
Browse files Browse the repository at this point in the history
Update dependencies and fix related issues, create Github Workflow for Rperform
  • Loading branch information
EngineerDanny committed Jun 27, 2022
2 parents 11c8cf4 + 4ca7a32 commit 328e269
Show file tree
Hide file tree
Showing 12 changed files with 373 additions and 417 deletions.
5 changes: 3 additions & 2 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
^\.Rproj\.user$ # used for temporary files.
^README\.Rmd$ # An Rmarkdown file used to generate README.md
^cran-comments\.md$ # Comments for CRAN submission
^NEWS\.md$ # A news file written in Markdown
^\.travis\.yml$ # Used for continuous integration testing with travis
^NEWS\.md$ # A news file written in Markdown
^/\.gitattributes$
^README-.*\.png$
^images$
SampleFiles_TravisPR
^\.github/
^\.travis\.yml$
32 changes: 32 additions & 0 deletions .github/workflows/Rperform-CI-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check-RPerform

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
build_rperform:
name: Build Rperform
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2

announce_completion:
name: Show Success Message
needs:
- build_rperform
runs-on: ubuntu-latest

steps:
- name: "Test Completion"
run: echo "All GitHub CI tests have passed"
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
*.o
*.so
*.dll
inst/doc
.DS_Store
.github/actions/.DS_Store
.github/.DS_Store
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Description: Rperform helps R package developers keep track of the quantitative
metrics of their packages over various development versions.
BugReports: https://github.com/analyticalmonk/Rperform/issues
Imports:
git2r (<= 0.21.0),
git2r (>= 0.30.1),
ggplot2 (>= 1.0.1),
testthat (>= 0.10.0),
devtools (>= 1.8.0),
microbenchmark (>= 1.4-2)
Suggests:
animint,
animint2,
rmarkdown,
knitr
VignetteBuilder: knitr
Expand Down
8 changes: 4 additions & 4 deletions R/branch_metrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ time_branch <- function(test_path, branch = "master", num_commits = 5) {

# Git operations
target <- git2r::repository("./")
origin_state <- git2r::head(target)
origin_state <- git2r::repository_head(target)
git2r::checkout(target, branch)
on.exit(expr = git2r::checkout(origin_state))

Expand Down Expand Up @@ -194,7 +194,7 @@ compare_branchm <- function(test_path, branch1, branch2 = "master") {
stopifnot(length(branch2) == 1)

target <- git2r::repository("./")
original_state <- git2r::head(target)
original_state <- git2r::repository_head(target)
same_commit <- .common_commit(branch1 = branch1, branch2 = branch2)
# same_commit
# ---------------------------------------------
Expand Down Expand Up @@ -239,7 +239,7 @@ compare_branchm <- function(test_path, branch1, branch2 = "master") {
target1 <- git2r::repository(file.path("./"))
# If branch1 is specified, check out to it and obtain commit list
if (!is.null(branch1)) {
original_state1 <- git2r::head(target1)
original_state1 <- git2r::repository_head(target1)
git2r::checkout(object = target1, branch = branch1)
}
commitlist1 <- git2r::commits(target1)
Expand All @@ -256,7 +256,7 @@ compare_branchm <- function(test_path, branch1, branch2 = "master") {
target2 <- git2r::repository(file.path("./"))
# If branch2 is specified, check out to it and obtain commit list
if (!is.null(branch2)) {
original_state2 <- git2r::head(target2)
original_state2 <- git2r::repository_head(target2)
git2r::checkout(object = target2, branch = branch2)
}
commitlist2 <- git2r::commits(target2)
Expand Down
13 changes: 7 additions & 6 deletions R/git_help.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#' @param commit_val git commit object, as returned by git2r::commits()
#'
#' @seealso \code{\link[git2r]{commits}}

# The get_sha function, given a git commit object returns a character vector which is the
# SHA1 value for the given commit.

get_sha <- function(commit_val) {
stopifnot(git2r::is_commit(commit_val))

attr(commit_val, which = "sha")
commit_val$sha
}

## -----------------------------------------------------------------------------------------
Expand All @@ -29,7 +29,7 @@ get_sha <- function(commit_val) {
get_datetime <- function(commit_val) {
stopifnot(git2r::is_commit(commit_val))

methods::as((commit_val@committer@when), "POSIXct")
as.POSIXct(git2r::when(commit_val$author$when))
}

## -----------------------------------------------------------------------------------------
Expand All @@ -48,8 +48,8 @@ get_datetime <- function(commit_val) {

get_msg <- function(commit_val) {
stopifnot(git2r::is_commit(commit_val))

base::substr(commit_val@summary, start = 1, stop = 15)
base::substr(commit_val$summary, start = 1, stop = 15)
}

## -----------------------------------------------------------------------------------------
Expand All @@ -65,7 +65,8 @@ get_msg <- function(commit_val) {

get_branch <- function(dir_path = "./") {
repo <- git2r::repository(dir_path)
git2r::head(repo)@name
head <- git2r::repository_head(repo)
head$name
}

## -----------------------------------------------------------------------------------------

0 comments on commit 328e269

Please sign in to comment.