Skip to content

Commit

Permalink
attempt using renv as a workaround to run github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Sep 3, 2024
1 parent 24adffe commit 3dd714f
Show file tree
Hide file tree
Showing 8 changed files with 3,562 additions and 11 deletions.
1 change: 1 addition & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source("renv/activate.R")
39 changes: 28 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,46 @@ jobs:

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2

# attempt with pixi:

# - name: Install pixi
# run: curl -fsSL https://pixi.sh/install.sh | bash

- name: Install pixi
run: curl -fsSL https://pixi.sh/install.sh | bash
# - name: Cache several folders
# uses: actions/cache@v2
# with:
# path: |
# _freeze
# .pixi
# key: ${{ runner.os }}

- name: Cache several folders
# - name: Set up dependencies
# run: pixi install -e dev

# - name: Render slides
# run: pixi run render_slides

# attempt with renv
- name: Set up renv
uses: r-lib/actions/setup-renv@v2

- name: Cache _freeze
uses: actions/cache@v2
with:
path: |
_freeze
.pixi
key: ${{ runner.os }}
- name: Set up dependencies
run: pixi install -e dev

- name: Render slides
run: pixi run render_slides
run: |
source renv/python/virtualenvs/renv-python-3.12/bin/activate
quarto render
- name: Deploy 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _site
folder: _book
branch: gh-pages
force: false
clean-exclude: pr-preview/
Expand All @@ -52,7 +69,7 @@ jobs:
if: github.event_name == 'pull_request'
uses: rossjrw/pr-preview-action@v1
with:
source-dir: _site
source-dir: _book
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,52 @@ To render the slides correctly in the workshop book site using [embedio](https:/
```bash
pixi r render_slides
```

## renv

I'm currently experiencing issues with getting `pixi` to install `rpy2`. As a temporary workaround, I'm using `renv` to manage the R dependencies.

### First time setup

To install the R and Python dependencies, use the following command:

```R
install.packages("renv")
renv::restore()
```

### Adding new packages
If you want to install a new R package, use the following command:

```R
renv::install("anndata")
```

If you want to install a new Python package, use the following command:

```bash
reticulate::py_install(c("rich>=13.7,<13.8", "anndata>=0.10.8,<0.11", "numpy>=1.24,<2", "scanpy>=1.10,<2", "mudata>=0.3,<0.4", "rpy2>=3.4,<4", "jupyter"))
```

After installing a new package, use the following command to update the `renv.lock` file:

```R
renv::snapshot()
```

### Using the environment

To use the environment, use the following command:

```bash
# ensure that jupyter can also use the renv environment
source renv/python/virtualenvs/renv-python-3.12/bin/activate
quarto preview
```

Or to render the slides:

```bash
source renv/python/virtualenvs/renv-python-3.12/bin/activate
quarto render
```
Loading

0 comments on commit 3dd714f

Please sign in to comment.