Skip to content

Commit

Permalink
Add GitHub actions CI (#11)
Browse files Browse the repository at this point in the history
* Add standard R-CMD-check action

* Add pr-commands action

* Add lint action

* Add check badge to README

* update changelog

---------

Co-authored-by: Robrecht Cannoodt <[email protected]>
  • Loading branch information
lazappi and rcannood authored Oct 4, 2024
1 parent 68ab656 commit f6d5dcc
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 7 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
^LICENSE\.md$
^experiments$
^\.lintr$
^\.github$
^CHANGELOG\.md$
^README\.qmd$
^docs$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
52 changes: 52 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main]
pull_request:
branches: [main]

name: R-CMD-check.yaml

permissions: read-all

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@v4

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

- uses: r-lib/actions/setup-r@v2
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@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
34 changes: 34 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main]
pull_request:
branches: [main]

name: lint.yaml

permissions: read-all

jobs:
lint:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
85 changes: 85 additions & 0 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
issue_comment:
types: [created]

name: pr-commands.yaml

permissions: read-all

jobs:
document:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
name: document
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::roxygen2
needs: pr-document

- name: Document
run: roxygen2::roxygenise()
shell: Rscript {0}

- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add man/\* NAMESPACE
git commit -m 'Document'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

style:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
name: style
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r@v2

- name: Install dependencies
run: install.packages("styler")
shell: Rscript {0}

- name: Style
run: styler::style_pkg()
shell: Rscript {0}

- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add \*.R
git commit -m 'Style'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

* Refactored the internal class data structures for better modularity and extensibility (PR #8).

* Added GitHub actions to the project (PR #11):
- Standard R-CMD-check workflow.
- Linting action.
- Commands for roxygenizing (`/document`) and restyling the source code (`/style`).

# laminr v0.0.1

Initial POC implementation of the LaminDB API client for R.
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# LaminDB interface in R


<!-- badges: start -->

[![R-CMD-check](https://github.com/laminlabs/laminr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/laminlabs/laminr/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

This package provides an interface to the LaminDB database. It allows
you to query the database and download data from it.

Expand Down Expand Up @@ -201,8 +206,8 @@ artifact <- db$Artifact$get("KBW89Mf7IGcekja2hADu")
artifact
```

<RichRecord>
Inherits from: <Artifact>
<Artifact>
Inherits from: <ArtifactRecord>
Public:
_accessor: active binding
_action_targets: active binding
Expand Down Expand Up @@ -309,7 +314,7 @@ artifact$storage

Warning: Data is missing expected fields: run_id, created_by_id

<RichRecord>
<Storage>
Inherits from: <Record>
Public:
_previous_runs: active binding
Expand Down Expand Up @@ -337,7 +342,7 @@ artifact$storage
artifact$created_by
```

<RichRecord>
<User>
Inherits from: <Record>
Public:
created_artifacts: active binding
Expand Down Expand Up @@ -367,7 +372,7 @@ artifact$experimental_factors
Data is missing expected fields: run_id, source_id, created_by_id

[[1]]
<RichRecord>
<ExperimentalFactor>
Inherits from: <Record>
Public:
_previous_runs: active binding
Expand Down Expand Up @@ -399,7 +404,7 @@ artifact$experimental_factors
get_value: function (key)

[[2]]
<RichRecord>
<ExperimentalFactor>
Inherits from: <Record>
Public:
_previous_runs: active binding
Expand Down Expand Up @@ -431,7 +436,7 @@ artifact$experimental_factors
get_value: function (key)

[[3]]
<RichRecord>
<ExperimentalFactor>
Inherits from: <Record>
Public:
_previous_runs: active binding
Expand Down
4 changes: 4 additions & 0 deletions README.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: LaminDB interface in R
format: gfm
---

<!-- badges: start -->
[![R-CMD-check](https://github.com/laminlabs/laminr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/laminlabs/laminr/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

This package provides an interface to the LaminDB database. It allows you to query the database and download data from it.

## Installation
Expand Down

0 comments on commit f6d5dcc

Please sign in to comment.