Skip to content

Commit

Permalink
chore: Use Github Actions for CI testing
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorld committed Nov 11, 2021
1 parent 5db00ba commit 517155d
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 192 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ README.rst
^\.travis$
^\.appveyor\.yml$
^cran-comments.rst$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
46 changes: 46 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
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: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-pandoc@v1

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: rcmdcheck

- uses: r-lib/actions/check-r-package@v1
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(default_toolchain)
export(net_worth)
export(prune_coa)
Expand Down
24 changes: 8 additions & 16 deletions README.Rrst
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ knitr::opts_chunk$set(fig.path = "man/figures/README-")
:target: https://cran.r-project.org/package=ledger
:alt: CRAN Status Badge

.. image:: https://travis-ci.org/trevorld/r-ledger.png?branch=master
:target: https://travis-ci.org/trevorld/r-ledger
:alt: Travis-CI Build Status

.. image:: https://ci.appveyor.com/api/projects/status/github/trevorld/r-ledger?branch=master&svg=true
:target: https://ci.appveyor.com/project/trevorld/r-ledger
:alt: AppVeyor Build Status
.. image:: https://github.com/trevorld/r-ledger/workflows/R-CMD-check/badge.svg
:target: https://github.com/trevorld/r-ledger/actions
:alt: R-CMD-check

.. image:: https://img.shields.io/codecov/c/github/trevorld/r-ledger/master.svg
:target: https://codecov.io/github/trevorld/r-ledger?branch=master
Expand All @@ -25,10 +21,6 @@ knitr::opts_chunk$set(fig.path = "man/figures/README-")
:target: https://cran.r-project.org/package=ledger
:alt: RStudio CRAN mirror downloads

.. image:: http://www.repostatus.org/badges/latest/inactive.svg
:alt: Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed: support/maintenance will be provided as time allows.
:target: http://www.repostatus.org/#inactive

``ledger`` is an R package to import data from `plain text accounting <https://plaintextaccounting.org/>`_ software like `Ledger <https://www.ledger-cli.org/>`_, `HLedger <http://hledger.org/>`_, and `Beancount <http://furius.ca/beancount/>`_ into an R data frame for convenient analysis, plotting, and export.

Right now it supports reading in the register from ``ledger``, ``hledger``, and ``beancount`` files.
Expand Down Expand Up @@ -122,8 +114,8 @@ Using rio::import and rio::convert
If one has loaded in the ``ledger`` package one can also use ``rio::import`` to read in the register:

.. {r rio}
df <- rio::import(beancount_file)
all.equal(register(ledger_file), rio::import(ledger_file))
df2 <- rio::import(bean_example_file)
all.equal(df, tibble::as_tibble(df2))
.. ..

The main advantage of this is that it allows one to use ``rio::convert`` to easily convert plaintext accounting files to several other file formats such as a csv file. Here is a shell example:
Expand Down Expand Up @@ -156,10 +148,10 @@ suppressPackageStartupMessages(library("dplyr"))
df <- register(bean_example_file) %>% dplyr::filter(!is.na(commodity))
df %>% prune_coa() %>%
group_by(account, mv_commodity) %>%
summarize(market_value = sum(market_value))
summarize(market_value = sum(market_value), .groups = "drop")
df %>% prune_coa(2) %>%
group_by(account, mv_commodity) %>%
summarize(market_value = sum(market_value))
summarize(market_value = sum(market_value), .groups = "drop")
.. ..

Basic personal accounting reports
Expand Down Expand Up @@ -201,7 +193,7 @@ count_beans <- function(df, filter_str = "", ...,
amount_var <- sym(amount)
filter(df, grepl(filter_str, account)) %>%
group_by(account, !!commodity, ...) %>%
summarize(!!amount := sum(!!amount_var)) %>%
summarize(!!amount := sum(!!amount_var), .groups = "drop") %>%
filter(abs(!!amount_var) > cutoff & !is.na(!!amount_var)) %>%
arrange(desc(abs(!!amount_var)))
}
Expand Down
Loading

0 comments on commit 517155d

Please sign in to comment.