Giter Club home page Giter Club logo

ghactions's Introduction

GitHub Actions for R

Actions Status tic codecov lifecycle CRAN status License: MIT

GitHub Actions are a new workflow automation feature of the popular code repository host GitHub.

This package helps R users get started quickly with GitHub Actions:

  1. It provides workflow templates for common R projects (packages, RMarkdown, ...) with sensible defaults.
  2. It wraps and curates relevant existing external actions, such as those to deploy to GitHub Pages or Netlify.
  3. It exposes the GitHub Actions workflow syntax and lets you write GitHub Actions *.ymls from R. (Which isn't saying that should be doing that.)

Installation

To install, run:

remotes::install_github("maxheld83/ghactions")

Because you're likely only to ever use it once, you need not take on ghactions as a dependency in your projects.

Quick Start

GitHub actions just requires a special file in a special directory at the root of your repository to work: .github/workflows/main.yml.

To quickly set up such a file for frequently used project kinds, run:

ghactions::use_ghactions(workflow = ghactions::website())

See the documentation for implied defaults and alternatives.

Then push to GitHub and go to the actions tab in your repository.

ghactions's People

Contributors

federicomarini avatar github-actions[bot] avatar maxheld83 avatar pat-s avatar schloerke avatar verenaheld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ghactions's Issues

find a more elegant way to identify docker images from past `docker build .` actions

From my docs:

Any downstream actions (such as this action!) can now use the prepared image, but they have to know its name.
The --tag=repo:latest part of the above call simply names your image, literally as "repo:latest".
It is very important you use exactly this name, because otherwise downstream actions (this action) cannot base their own work on it.
This isn't terribly elegant, but currently appears to be the only way on GitHub actions to identify images from past actions (see this issue).

use proper R2HCL serialiser

Currently, the translation of R into the github actions subset of HCL is a pretty hacky and ugly mix of some unholy glue action and mustache/whiskers template.
Results look ok, but it's hell under the surface.

It'd be nice to migrate to some kind of official R2HCL pkg at some point, or maybe just R2TOML should do the trick.

avoid workaround in mustache syntax

Currently, the action template diverges ever so slightly from the documented gh spec: the uses field is listed last.
This is done to avoid a triple } in the template.
A triple } causes mustache to fail thus:

Error in parseTemplate(template, partials = as.environment(partials),  : 
  Template contains unbalanced closing tag. Found: '/secrets}' but expected: '/secrets'

Replacing {{ with another delimiter does not solve this problem, because apparently the delimiter gets replaced before the whole thing is evaluated or something.
So you get the same error message with other delimiters.

Also, oddly, you don't get the same error at the beginning of the action, where there technically also 3 braces.

It's worthwhile noting that this is a bit of a special case, because the contiguous 3 braces occur because they serve as if clauses (known as false or empty lists in mustache).

Would be nice to fix this at some point, but mostly for cosmetic reasons.

migrate to native caching

Would be nice to save knitr caches (index_cache/) and other such build artefacts.

GitHub might either provide this out of the box at some point, or we might wait for some other service (action!) that we can save arbitrary assets to and retrieve on new runs.

Would basically mean a new action in between.

Might be related to offloading expensive computations to beefier (AWS etc) services.

create action(s) for packages

These actually should be separate actions, because

  1. they should run on (some yet to be chosen) vanilla image (not byod)
  2. they should first parse and download the DESCRIPTION. We don't want people to have to specify the dependencies in the DESCRIPTION and their byod in this case. This (the parsing) may need some amount of bashing.

add gif of pkg build

because that gives a better idea of what gh actions can do.
ideally with some kind of time lapse to make it quick

benchmark ghactions speed against travisCI

I guess this could be done, though if it were done systematically and rigorously that might be a lot of work.
We might just go with the gut feeling: seems pretty darn fast.

test against live gh actions on boilerplate repos

this would be an alternative / addition to #14.

This could be implemented as a "simple" testthat unit test.

  1. There exist a bunch of boilerplate projects inside of the ghaction repo. (We can use the commonly used starter projects from RStudio for example).
  2. Once the test gets run:
  • the relevant boilerplate projects gets pushed to a (new?) repo on github.com (this might be possible inside of R using the git wrappers from usethis.
  • with the currently templated version of .github/main.workflow.
  • then the test waits for the github api (via gh::gh) to signal that the repo in question has successfully run through the action (or actually has failed on some of them, that we might also want to test!).
  • then the test returns the appropriate condition.

The same test gets run on every commit inside of GitHub actions (meta), though that might require some more git auth.

Also, the tests would have to run in parallel, otherwise this would take too long.

Aaaand we should ask github first whether this violates their TOS, because we're kinda programmatically querying github actions.

cache byod images

it appears that currently, the image gets rebuild for byod every commit, which may in many cases be unnecessary.
It would be nice to cache byod images in this case.
It's unclear if/how gh actions might do this out of the box.

If they do, it's possible that we're polluting the builds with the entire repo content, and therefore (needlessly) invalidating the cache (because there's always something new in the repo, as per the commit).

If they don't it might be worthwhile to consider doing this as part of the rscript-byod action, though this would probably require storing and publishing the image outside of gh action which we initially wanted to avoid. Adds a lot of complexity and perhaps cost.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.