Skip to content

Commit

Permalink
adjust CI to quarto
Browse files Browse the repository at this point in the history
  • Loading branch information
pat-s committed Nov 4, 2022
1 parent bda5149 commit 6df4fdb
Show file tree
Hide file tree
Showing 6 changed files with 1,127 additions and 107 deletions.
92 changes: 56 additions & 36 deletions .github/workflows/build-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,73 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# - name: Change directory
# run: cd mlr-org

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
r-version: 4.1.3
# pak-version: devel

- uses: r-lib/actions/setup-pandoc@v2
# - uses: r-lib/actions/setup-pandoc@v2
- uses: quarto-dev/quarto-actions/setup@v2

- uses: r-lib/actions/setup-r-dependencies@v2
# set date/week for use in cache creation
# https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970
# - cache R packages daily
- name: "[Cache] Prepare daily timestamp for cache"
if: runner.os != 'Windows'
id: date
run: echo "::set-output name=date::$(date '+%d-%m')"

- name: "[Cache] Cache R packages"
if: runner.os != 'Windows'
uses: pat-s/always-upload-cache@v3
with:
# pak-version: devel
extra-packages: |
any::devtools
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}

- name: Install Remotes
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
devtools::install_github("mlr-org/mlr3book")
devtools::install_github("mlr-org/mlr3extralearners")
devtools::install_github("mlr-org/mlr3proba")
devtools::install_github("mlr-org/mlr3mbo")
devtools::install_github("mlr-org/mlr3spatiotempcv")
devtools::install_github("openml/openml-r")
shell: Rscript {0}

- name: Install Packages
run: devtools::install()
shell: Rscript {0}
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'install.packages("remotes", repos = "cloud.r-project.org"); cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
- name: Build Website
run: rmarkdown::render_site(input = "mlr-org", encoding = "UTF-8")
shell: Rscript {0}
# - uses: pat-s/actions/setup-renv@renv-subdir
# env:
# RENV_CONFIG_REPOS_OVERRIDE: ${{ env.RSPM }}
# with:
# working-directory: mlr-org
# cache-version: 1

# bug in render_site deletes rss feed
# rss feed with last post can be restored by rendering the post again
# https://github.com/rstudio/distill/issues/381
- name: Restore RSS Feed
- name: debug
env:
QUARTO_PUB_AUTH_TOKEN: ${{ inputs.QUARTO_PUB_AUTH_TOKEN }}
RENV_CONFIG_REPOS_OVERRIDE: ${{ env.RSPM }}
run: |
files = list.files("mlr-org/_posts", ".Rmd", full.names = TRUE, recursive = TRUE)
rmarkdown::render(files[length(files)], encoding = "UTF-8")
shell: Rscript {0}
cd mlr-org
R -q -e 'install.packages("renv", repos = "cloud.r-project.org"); renv::restore()'
ls /home/runner/work/mlr3website/mlr3website/mlr-org/renv/library/R-4.2/x86_64-pc-linux-gnu
git config --global user.email "[email protected]"
git config --global user.name "${{ env.RUNNER_NAME }}"
quarto publish gh-pages
- name: Deploy
if: ${{ github.event_name == 'push' }}
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: mlr-org/docs
single-commit: false
# - name: Install Packages
# run: devtools::install()
# shell: Rscript {0}

# - name: Render Quarto Project
# uses: quarto-dev/quarto-actions/render@v2
# with:
# path: mlr-org

# - name: Publish to GitHub Pages (and render)
# uses: quarto-dev/quarto-actions/publish@v2
# with:
# path: mlr-org
# target: gh-pages
138 changes: 69 additions & 69 deletions .github/workflows/render-gallery.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'mlr-org/_gallery/**'
pull_request:
branches:
- main
paths:
- 'mlr-org/_gallery/**'
schedule:
- cron: "0 6 * * *"
# on:
# workflow_dispatch:
# push:
# branches:
# - main
# paths:
# - 'mlr-org/_gallery/**'
# pull_request:
# branches:
# - main
# paths:
# - 'mlr-org/_gallery/**'
# schedule:
# - cron: "0 6 * * *"

name: render-gallery
# name: render-gallery

jobs:
render-gallery:
runs-on: ubuntu-latest
# jobs:
# render-gallery:
# runs-on: ubuntu-latest

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# env:
# R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
# steps:
# - uses: actions/checkout@v2

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

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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::devtools
# - uses: r-lib/actions/setup-r-dependencies@v2
# with:
# extra-packages: |
# any::devtools

- name: Install Packages
run: devtools::install()
shell: Rscript {0}
# - name: Install Packages
# run: devtools::install()
# shell: Rscript {0}

- name: Render Gallery
run: |
files = list.files("mlr-org/_gallery/", pattern = ".Rmd", full.names = TRUE, recursive = TRUE)
mlr3misc::walk(files, function(file) rmarkdown::render(file, encoding = "UTF-8", params = list(eval_all = FALSE)))
shell: Rscript {0}
# - name: Render Gallery
# run: |
# files = list.files("mlr-org/_gallery/", pattern = ".Rmd", full.names = TRUE, recursive = TRUE)
# mlr3misc::walk(files, function(file) rmarkdown::render(file, encoding = "UTF-8", params = list(eval_all = FALSE)))
# shell: Rscript {0}

- name: Build Website
run: rmarkdown::render_site(input = "mlr-org", encoding = "UTF-8")
shell: Rscript {0}
# - name: Build Website
# run: rmarkdown::render_site(input = "mlr-org", encoding = "UTF-8")
# shell: Rscript {0}

# bug in render_site deletes rss feed
# rss feed with last post can be restored by rendering the post again
# https://github.com/rstudio/distill/issues/381
- name: Restore RSS Feed
run: |
files = list.files("mlr-org/_posts", ".Rmd", full.names = TRUE, recursive = TRUE)
rmarkdown::render(files[length(files)], encoding = "UTF-8")
shell: Rscript {0}
# # bug in render_site deletes rss feed
# # rss feed with last post can be restored by rendering the post again
# # https://github.com/rstudio/distill/issues/381
# - name: Restore RSS Feed
# run: |
# files = list.files("mlr-org/_posts", ".Rmd", full.names = TRUE, recursive = TRUE)
# rmarkdown::render(files[length(files)], encoding = "UTF-8")
# shell: Rscript {0}

- name: Commit Results
if: ${{ github.event_name == 'push' }}
run: |
rm -f .github/pkg.lock
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git config --local pull.rebase false
git pull
git add -A
git commit -m 'refactor: render gallery posts'
git push origin
# - name: Commit Results
# if: ${{ github.event_name == 'push' }}
# run: |
# rm -f .github/pkg.lock
# git config --local user.name "$GITHUB_ACTOR"
# git config --local user.email "[email protected]"
# git config --local pull.rebase false
# git pull
# git add -A
# git commit -m 'refactor: render gallery posts'
# git push origin

- name: Deploy
if: ${{ github.event_name == 'push' }}
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: mlr-org/docs
single-commit: false
# - name: Deploy
# if: ${{ github.event_name == 'push' }}
# uses: JamesIves/[email protected]
# with:
# branch: gh-pages
# folder: mlr-org/docs
# single-commit: false
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ rsconnect/

# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

mlr-org/renv/*
mlr-org/blog.xml
mlr-org/site_libs
mlr3website/renv/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ date: 01-30-2020
description: |
Use case illustrating data preprocessing and model fitting via mlr3 on the "King County House Prices" dataset.
params:
eval_all: FALSE
eval_all: TRUE
image: thumbnail.png
knitr:
opts_chunk:
Expand Down
7 changes: 7 additions & 0 deletions mlr-org/renv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sandbox/
library/
local/
cellar/
lock/
python/
staging/
Loading

0 comments on commit 6df4fdb

Please sign in to comment.