Skip to content

Commit

Permalink
gtthub actions renv
Browse files Browse the repository at this point in the history
  • Loading branch information
jrosell committed Dec 29, 2023
1 parent e0a07a2 commit 51cd278
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: docker build -t my-image-name .
- run: docker run --rm --name my_pipeline_container -v /github/workspace/output/:/output/:rw my-image-name
- run: docker run --rm --name my_pipeline_container -v /github/workspace/output/:/workspace/output/:rw my-image-name
- uses: actions/upload-artifact@v3
with:
path: /github/workspace/output/
18 changes: 18 additions & 0 deletions .github/workflows/renv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: docker build -f renv.Dockerfile -t my-renv-name .
- run: docker run --rm --name my_renv_container -v /github/workspace/output/:/workspace/output/:rw my-renv-name
- uses: actions/upload-artifact@v3
with:
path: /github/workspace/output/
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
# playground

## Run last R package versions in Github Actions (faster but unsafer)
## Github Actions

Look the [.github/workflows/main.yml](.github/workflows/main.yml) file.
With [.github/workflows/main.yml](.github/workflows/main.yml) last R package versions are used (faster but unsafer).

The output files will be uploaded as an artifact zip of the executed job.
With [.github/workflows/renv.yml](.github/workflows/renv.yml) locked R packave versions are used (slower but more reproducible).

The output files will be uploaded as an artifact zip of the executed jobs.

## Run last R package versions in a local computer (faster but unsafer)
## Run in local Docker container

First clone the repository in your computer:

```
$ git clone https://github.com/jrosell/playground
$ cd playground
$ docker build -t my-image-name . && docker run --rm -u $(id -u):$(id -g) --name my_pipeline_container -v $(pwd)/output:/workspace/output/:rw my-image-name
```

Then build the image and run the container.

## Run specific R package versions in a local computer (slower but reproducible)
- Last R package versions in a local computer (faster but unsafer):

Add renv.lock in your root folder and run:
```
$ docker build -t my-image-name . && docker run --rm -u $(id -u):$(id -g) --name my_pipeline_container -v $(pwd)/output:/workspace/output/:rw my-image-name
```

- Run specific R package versions in a local computer (slower but reproducible):

```
```
$ docker build -f renv.Dockerfile -t my-renv-name . && docker run --rm -u $(id -u):$(id -g) --name my_renv_container -v $(pwd)/output:/workspace/output/:rw my-renv-name
```
```

It will use the renv.lock in your root folder.

0 comments on commit 51cd278

Please sign in to comment.