Skip to content

Commit

Permalink
Initialize actions (#1)
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Rucki <[email protected]>
Co-authored-by: Franciszek Walkowiak <[email protected]>
Co-authored-by: André Veríssimo <[email protected]>
  • Loading branch information
3 people authored Jul 4, 2024
1 parent 36c7a0c commit 0d8c7b4
Show file tree
Hide file tree
Showing 6 changed files with 546 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/cla.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CLA 🔏

on:
issue_comment:
types:
- created
# For PRs that originate from forks
pull_request_target:
types:
- opened
- closed
- synchronize

jobs:
CLA:
name: CLA 📝
uses: insightsengineering/.github/.github/workflows/cla.yaml@main
secrets: inherit
30 changes: 30 additions & 0 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: SuperLinter

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
lint:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Lint Code Base
uses: super-linter/super-linter/slim@v5
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
VALIDATE_R: true
VALIDATE_YAML: true
VALIDATE_BASH_EXEC: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 14 additions & 0 deletions .github/workflows/short-tagging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Keep the versions up-to-date ☕️

on:
release:
types: [published, edited]

jobs:
actions-tagger:
runs-on: ubuntu-latest
steps:
- uses: Actions-R-Us/actions-tagger@latest
with:
publish_latest_tag: true
3 changes: 3 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters: linters_with_defaults(
line_length_linter(120),
commented_code_linter = NULL)
127 changes: 127 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Setup R Dependencies Action

## Description

A wrapper on [`r-lib/actions/setup-r-dependencies`](https://github.com/r-lib/actions/tree/v2-branch/setup-r-dependencies) with additional features as below:

- Use dependencies from identical feature branch (if exists). This allows to co-develop packages and test them together.
- Use development version of dependencies if specified in the `DESCRIPTION` file. This allows to test packages with dependencies that are not yet released.

This logic requires additional input of package references to check against. Please see the `lookup-refs` parameter description for more details. Currently, only GitHub references are supported.

The implementation relies on the `pkgdepends` package and it is temporarily changing the `DESCRIPTION` file by adding new `Config/Needs/` fields. Then `r-lib/actions/setup-r-dependencies` is called with the `needs` parameter.

## Action type
Composite

## Author
Insights Engineering

## Inputs
* `github-token`:

_Description_: Token with permissions to clone repositories with dependencies.

_Required_: `false`

_Default_: `""`

* `repository-path`:

_Description_: Directory where the R package is located relative to the calling GitHub workflow workspace.

_Required_: `false`

_Default_: `"."`

* `lookup-refs`:

_Description_: List of [package references](https://r-lib.github.io/pkgdepends/reference/pkg_refs.html) to be used for the feature branch. Multiple entries in new lines or separated by commas. Only GitHub references are supported.

_Required_: `false`

_Default_: `""`

* `extra-deps`:

_Description_: List of extra dependencies to check against feature branch existence. Multiple entries in new lines or separated by commas. It allows to control indirect dependencies. This requires an entry in the `lookup-refs` input.

_Required_: `false`

_Default_: `""`

* `dependencies`:

_Description_: Passed to `r-lib/actions/setup-r-dependencies`.

_Required_: `false`

_Default_: `"all"`

* `extra-packages`:

_Description_: Passed to `r-lib/actions/setup-r-dependencies`.

_Required_: `false`

_Default_: `""`

* `needs`:

_Description_: Passed to `r-lib/actions/setup-r-dependencies`. The value will be amended by `DepsBranch` and `DepsDev` values.

_Required_: `false`

_Default_: `""`

* `skip-desc-branch`:

_Description_: Skip branch lookup for dependencies specified in the `DESCRIPTION` file.

_Required_: `false`

_Default_: `false`

* `skip-desc-dev`:

_Description_: Skip development version lookup for dependencies specified in the `DESCRIPTION` file.

_Required_: `false`

_Default_: `false`

* `skip-install`:

_Description_: Skip installation of dependencies.

_Required_: `false`

_Default_: `false`


## Outputs

None

## Usage

```yaml
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup R
uses: r-lib/actions/setup-r@v2

- name: Setup R dependencies
uses: insightsengineering/setup-r-dependencies@v1
with:
github-token: ${{ secrets.REPO_GITHUB_TOKEN }}
lookup-refs: |
test/package1
test/package2
test/package3
- name: Check R package
uses: r-lib/actions/check-r-package@v2
```
Loading

0 comments on commit 0d8c7b4

Please sign in to comment.