Status #1359
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/status.yaml | |
- index.Rmd | |
workflow_dispatch: | |
schedule: | |
- cron: '20 2 * * *' | |
name: Status | |
jobs: | |
status: | |
runs-on: ubuntu-22.04 | |
# Begin custom: services | |
# End custom: services | |
env: | |
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
# prevent rgl issues because no X11 display is available | |
RGL_USE_NULL: true | |
# Begin custom: env vars | |
# End custom: env vars | |
steps: | |
- name: Check rate limits | |
run: | | |
curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit | |
shell: bash | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
install-r: false | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Install remotes | |
run: | | |
if (!requireNamespace("curl", quietly = TRUE)) install.packages("curl") | |
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes") | |
shell: Rscript {0} | |
- name: Query dependencies | |
run: | | |
saveRDS(remotes::dev_package_deps(dependencies = TRUE, type = .Platform$pkgType), ".github/depends.Rds", version = 2) | |
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") | |
shell: Rscript {0} | |
- name: Restore R package cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- | |
- name: Configure Git identity | |
run: | | |
env | sort | |
git config --global user.name "$GITHUB_ACTOR" | |
git config --global user.email "[email protected]" | |
shell: bash | |
- name: Install system dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update -y | |
while read -r cmd | |
do | |
eval sudo $cmd | |
done < <(Rscript -e 'req <- remotes::system_requirements("ubuntu", "22.04"); if (length(req) > 0) cat(req, sep = "\n")') | |
# Begin custom: before install | |
# End custom: before install | |
- name: Install pkgdown sysdeps | |
if: runner.os == 'Linux' | |
env: | |
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc | |
run: | | |
# For some reason harfbuzz and gert are installed from source and needs this | |
sudo apt-get install -y libharfbuzz-dev libfribidi-dev libgit2-dev | |
- name: Install dependencies | |
run: | | |
remotes::install_deps(dependencies = TRUE, type = .Platform$pkgType) | |
shell: Rscript {0} | |
# Begin custom: install | |
# End custom: install | |
- name: Session info | |
run: | | |
options(width = 100) | |
if (!requireNamespace("sessioninfo", quietly = TRUE)) install.packages("sessioninfo") | |
pkgs <- installed.packages()[, "Package"] | |
sessioninfo::session_info(pkgs, include_base = TRUE) | |
shell: Rscript {0} | |
# Begin custom: after install | |
# End custom: after install | |
- name: Clone worktrees | |
run: | | |
git fetch --depth=1 | |
./run.sh add_worktrees | |
shell: bash | |
- name: Create gh-pages worktree | |
run: | | |
if ! git show-branch remotes/origin/gh-pages; then | |
mkdir -p gh-pages | |
cd gh-pages | |
git init | |
git commit -m Initial --allow-empty | |
git remote add up .. | |
git push up HEAD:gh-pages | |
cd .. | |
rm -rf gh-pages | |
git push -u origin gh-pages | |
fi | |
git worktree add gh-pages gh-pages | |
shell: bash | |
- name: Build site | |
run: | | |
rmarkdown::render("index.Rmd", output_dir = "gh-pages") | |
shell: Rscript {0} | |
- name: Deploy site | |
run: | | |
cd gh-pages | |
git fetch --depth=1 | |
git reset origin/gh-pages | |
if [ $(git status --porcelain | wc -l) -gt 0 ]; then | |
git add . | |
git commit -m "Update site" | |
git push | |
fi | |
shell: bash | |
- name: Check rate limits | |
if: always() | |
run: | | |
curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit | |
shell: bash |