Code Monkey home page Code Monkey logo

actions's Introduction

Actions

This repo contains actions and workflow files for GitHub Actions. It also contains example workflow files for inclusion in other repos which call the GitHub actions defined in this repo.

We aim to improve developer efficiency by giving them tools to enable good practices that are easy to integrate, so they can spend more time focusing on writing code, and less on setting up checks.

Action Groups summary

  • R (R.yml): Checks related to the R programming language.
  • Docker (docker.yml): actions related to checking and building Docker images
  • General (general.yml): Actions to run on all repositories, regardless of languages involved
  • Issues (issues.yml): Actions to run when issues are created or modified.

Structure

The workflows are *.yml files in .github/workflows/, with all files in that directory (no nesting). The workflow files have names with the group of workflow as a prefix (ex. R-*.yml would be an action for R code, docker-*.yml would relate to docker containers). Files that do not have a prefix are "caller" workflows, which call the other workflows in turn (ex. R.yml would call R-*.yml workflows), to simplify managment from other repositories (a repo containing an R package can call R.yml, to enable all actions called by that file).

Action Group Details

R (R.yml)

  • lintr: runs lintr::lint_package() with default configuration (lintr::default_linters() for repos that do not have a .lintr file)
  • codecov: Checks test coverage (using covr R package) and uploads results to codecov.io

Issues (issues.yml)

  • gh-to-ado: creates and links a new ticket in Azure DevOps when a GitHub issue is labelled "ADO" (applies both to newly created and updated issues)

actions's People

Contributors

alexaxthelm avatar jdhoffa avatar cjyetman avatar

Stargazers

Douglas Ezra Morrison avatar Sandalots avatar Kirill Müller avatar dikip avatar

Watchers

 avatar  avatar  avatar

actions's Issues

Add spell check

I go back and forth on if this is a good idea or not.

I find CSpell useful while coding, since it can work on both normal prose (.md, .txt, etc) and on code files (.R, etc) while being pretty good about dealing with coding conventions, like snake case.

https://cspell.org/docs/how-it-works/ lays out:

The concept is simple, split camelCase and snake_case words before checking them against a list of known words.

which is great, but leads to my single biggest frustration when dealing with CSpell: maintaining the custom word list. Overall, it's not that difficult, since CSpell traverses up the directory tree until to find custom dictionaries, which means keeping a wordlist in the repo root, and updating it when new words are added to the repo.

I don't have any benchmark as to how any of our repos fare against the standard dictionaries

Add docker comment action

Followup to #56

We've previously had an action that added a comment to the PR thread with the docker image name, with a copiable docker pull command to make life easy.

Code for that here:

  add_comment:
    needs: build-docker-image
    runs-on: ubuntu-latest
    steps:
      - name: Find Comment
        # https://github.com/peter-evans/find-comment
        uses: peter-evans/find-comment@v3
        id: fc
        with:
          issue-number: ${{ github.event.pull_request.number }}
          comment-author: 'github-actions[bot]'
          body-includes: Docker image from this PR

      - name: Create or update comment
        # https://github.com/peter-evans/create-or-update-comment
        uses: peter-evans/create-or-update-comment@v4
        with:
          comment-id: ${{ steps.fc.outputs.comment-id }}
          issue-number: ${{ github.event.pull_request.number }}
          body: |
            Docker image from this PR (${{ github.event.pull_request.head.sha }}) created
            ```
            docker pull ${{ needs.build-docker-image.outputs.full-image-name }}
            ```
          edit-mode: replace

Semver check for R packages

Make sure that when we merge a new branch, the version (dev version)? is higher than what is currently on main.

Allow specifying R CMD Check matrix in R action

Discovered as part of RMI-PACTA/pacta.multi.loanbook.plot#16

Some R packages (igraph for example) actively discourage building from source as an alternative to using binaries.

Since CRAN only supports the past few releases of R, having old versions of R in our R CMD check matrix won't work for repos that have those packages as dependencies.

Suggested fix: make a pass through argument specifying the matrix to be used for testing with R CMD CHECK.

cc @jacobvjk

Add action for useful PR commands

It is possible to ask GitHub to run common commands like roxygen2::roxygenise() to document a package, or styler::style_pkg() directly from GitHub. It will then commit the results to the PR. You do so by typing \style or \document as a comment on the GH PR.

I know @cjyetman doesn't particularly like things that make commits for him, but these are entirely opt-in (meaning people that want to use them can use them, and people that don't don't need to).

See here: https://github.com/RMI-PACTA/r2dii.data/blob/main/.github/workflows/pr-commands.yaml

feat: `R-semver-check.yml` gains check for `NEWS.md`

In particular, I think that (in pseudo-code) we want something like:

if (version == "X.Y.Z") 
   header(NEWS.md) contains "X.Y.Z"
else if (version == "X.Y.Z.9...")
   header(NEWS.md) contains "development version"

In the wild this looks like:
r2dii.analysis v0.3.0.9000: https://github.com/RMI-PACTA/r2dii.analysis/blob/6d0aa8df211ab2ac9d6fa6af3daf73ba2ce4e507/NEWS.md

r2dii.analysis v0.4.0: https://github.com/RMI-PACTA/r2dii.analysis/blob/8391b83325a1657ca4861387ee84c1654959a101/NEWS.md

Consider deprecating support for R versions older than 4

Version 4 has been available for around 4 years now. I'm not sure how long we want to offer support.
Probably dangerous, and user-facing but we should at least discuss it.

We already skip a lot of tests on anything older than 4, which may give us fall security into thinking that things "work"

Add CODEOWNERS file

I'm thinking that the CODEOWNERS for this repo (who would be tagged on all PRs) should maybe be @RMI-PACTA/developers, but maybe we want to have that on README (which should be updated for all new workflows), but specify individuals for certain files (for example, any non-breaking changes to the docker-* workflows are probably of interest to a few of us, but not everyone)

Add some sort of benchmarking

TBD what this exactly looks like (and likely depends on some demo data to be able to not only build but also test run our Docker builds), but it would be cool to know if a PR significantly affects the existing performance

R: Simple code coverage

Use existing workflow to check coverage and comment in PR. Useful in case codecov is down, or we just want a quick check.

Add action to test old versions of dependencies

It would be good to define the oldest version of packages that are usable for our purposes.

rough logic I'm thinking of:

probably doesn't need to be run every time, but ocassionally

dependencies <- pak::local_deps()
for (dep in dependencies) {
  # find oldest version available that meets our DESCRIPTION
  # install that version
}
devtools::test()

Then updating DESCRIPTION to find a version that does pass tests would probably be a manual change.

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.