Skip to content

Commit

Permalink
add a production renv profile (fix #298) (#286)
Browse files Browse the repository at this point in the history
* ad dproduction profile

* sett renv profiles

* update action versions

* update all profiles and gitignore renv in content

* update ubuntu-latest

* unify file names
  • Loading branch information
drmowinckels authored Apr 14, 2024
1 parent 7417f0e commit 9de2b9c
Show file tree
Hide file tree
Showing 26 changed files with 1,445 additions and 802 deletions.
13 changes: 13 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,16 @@ options(
renv.config.sandbox.enabled = FALSE,
renv.config.auto.snapshot = FALSE
)

if(interactive()){
cat(
"",
"This project uses different renv profiles for different operations",
"You should be on the default profile if you are contributing a blogpost",
" - `renv::activate('json')` enables profile with packages for json validation",
" - `renv::activate('production')` enables profile with packages needed to build the website",
" - `renv::activate('dev')` enables profile with all packages working locally on the website",
"",
sep="\n"
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ env:
jobs:
build:
name: Build site
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
env:
hugobd: public
on_fork: ${{ github.event.pull_request.head.repo.fork == true }}
Expand Down Expand Up @@ -72,10 +72,12 @@ jobs:
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3.0'


- name: Serup renv
uses: r-lib/actions/setup-renv@v2

- name: Populate untranslated pages
run: |
rm .Rprofile # avoid starting renv
Rscript scripts/missing_translations.R
- name: Site data - Clean folders
Expand Down Expand Up @@ -160,7 +162,7 @@ jobs:
run: |
npm install netlify-cli -g
netlify deploy \
--alias ${{ env.netalias }} \
--alias=${{ env.netalias }} \
--dir=${{ env.hugobd }}
- uses: actions/github-script@v6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ concurrency:
jobs:
build:
name: Build site
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
env:
RENV_PROFILE: "dev"
RENV_PROFILE: "production"
RENV_CONFIG_SANDBOX_ENABLED: FALSE
hugobd: public
steps:
Expand All @@ -27,7 +27,7 @@ jobs:
echo "hugovr=$ver" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

Expand All @@ -40,37 +40,38 @@ jobs:
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3.0'


- name: Serup renv
uses: r-lib/actions/setup-renv@v2

- name: Populate untranslated pages
run: |
rm .Rprofile # avoid starting renv
Rscript scripts/missing_translations.R
- name: Site data - Clean folders
run: rm -r data/directory data/rblogs

- name: Site data - DIRECTORY - Get
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: rladies/directory
ssh-key: ${{ secrets.ssh_directoryy_repo }}
path: tmpd/dir


- name: Site data - DIRECTORY - Move
run: |
cp -r tmpd/dir/data/json data/directory
cp -r tmpd/dir/data/img/* assets/directory
- name: Site data - Meetup
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: rladies/meetup_archive
ssh-key: ${{ secrets.MEETUP_ARCHIVE_KEY}}
path: tmpd/mtp

- name: Site data - Get blogs list
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: rladies/awesome-rladies-blogs
ssh-key: ${{ secrets.RLADIES_BLOGS_KEY}}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/chapters-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ concurrency:
jobs:
merge:
name: Merge chapters and meetup
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
env:
RENV_PROFILE: "dev"
RENV_CONFIG_SANDBOX_ENABLED: FALSE
steps:

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

Expand All @@ -40,7 +40,7 @@ jobs:
uses: r-lib/actions/setup-renv@v2

- name: Site data - Meetup
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: rladies/meetup_archive
ssh-key: ${{ secrets.MEETUP_ARCHIVE_KEY}}
Expand All @@ -66,4 +66,4 @@ jobs:
with:
token: ${{ secrets.GLOBAL_GHA_PAT }}
branch: main


2 changes: 1 addition & 1 deletion .github/workflows/chapters-new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Print issue inputs
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-jsons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
RENV_PROFILE: "json"
RENV_CONFIG_SANDBOX_ENABLED: FALSE
name: Check modified jsons
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

Expand Down
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,5 @@ tmp*
~/Library/Application Support/meetupr/meetupr-token.rds
/var/folders/ws/1mjqfpsj3kv_b_z2091qkm600000gq/T//Rtmp4EPJ8U/fileecc479130cbd.rds

# default renv lock is here omitted
# we only use renv for development
# so make sure blog contributors dont add
# the lockfile when making their post
/renv.lock

.history
.quarto

9 changes: 7 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ Authors@R: c(
comment = c(ORCID = "0000-0002-5756-0223"))
)
Encoding: UTF-8
Imports:
Config/renv/profiles/default/dependencies:
blogdown
Config/renv/profiles/json/dependencies:
jsonlite,
jsonvalidate,
here,
cli
Config/renv/profiles/dev/dependencies:
blogdown,
jsonlite,
dplyr,
here,
tidyr,
cli
cli,
yaml
Config/renv/profiles/production/dependencies:
here,
yaml
3 changes: 3 additions & 0 deletions content/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ignore all renv related files and folders
**/renv.lock
**renv/
1 change: 1 addition & 0 deletions json/.Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source("renv/activate.R")
13 changes: 13 additions & 0 deletions json/json.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX
23 changes: 23 additions & 0 deletions json/renv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"R": {
"Version": "4.3.2",
"Repositories": [
{
"Name": "CRAN",
"URL": "https://cloud.r-project.org"
}
]
},
"Packages": {
"renv": {
"Package": "renv",
"Version": "1.0.3",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"utils"
],
"Hash": "41b847654f567341725473431dd0d5ab"
}
}
}
7 changes: 7 additions & 0 deletions json/renv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
library/
local/
cellar/
lock/
python/
sandbox/
staging/
Loading

0 comments on commit 9de2b9c

Please sign in to comment.