Skip to content

Commit

Permalink
Initializing gh-pages branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mhpob committed Oct 10, 2024
0 parents commit eda0466
Show file tree
Hide file tree
Showing 11 changed files with 1,330 additions and 0 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/ingest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Create live dashboard

permissions:
contents: write

on:
workflow_dispatch:
inputs:
# To save bandwidth, input names will be somewhat non-specific
# i.e. "p" is lighter than "poll" as it saves 3 characters
# Further note -- the GHA API call is so big that 3 chars wont matter
p:
description: 'Result from RTM poll'
required: true
type: string


jobs:
ingest-data:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

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

- name: Set up r2u
uses: eddelbuettel/github-actions/r2u-setup@master

- name: Set up R packages
run: Rscript -e 'install.packages(c("data.table", "ggplot2", "plotly",
"rmarkdown", "knitr", "quarto"))'

- name: Munge data
run: Rscript -e 'source("work/parsers.R"); parse_payload(${{ inputs.p }}, "data/parsed.csv")'

- name: Push CSV log
run: |
git config --global user.name 'gha update bot'
git config --global user.email 'mhpob@users.noreply.github.com'
git add --all
git commit --allow-empty -m "[auto] Add to log $(TZ=America/New_York date +'%Y-%m-%d %H:%M')"
git push
- name: Build dashboard
run: |
cd dashboard
quarto render index.qmd
- name: Push dashboard
run: |
git config --global user.name 'gha update bot'
git config --global user.email 'mhpob@users.noreply.github.com'
git add --all
git commit --allow-empty -m "[auto] Build Dashboard $(TZ=America/New_York date +'%Y-%m-%d %H:%M')"
git push
#
# # TBD: transfer data from ingest-data to build-dash
# build-dash:
# needs: ingest-data
# runs-on: ubuntu-latest
# env:
# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# RENV_PATHS_ROOT: ~/.local/share/renv
# steps:
#
# - name: Check out repository
# uses: actions/checkout@v4
#
# - name: Set up Quarto
# uses: quarto-dev/quarto-actions/setup@v2
#
# - name: Set up R
# uses: r-lib/actions/setup-r@v2
# with:
# use-public-rspm: true
#
# - name: Set up R packages
# uses: r-lib/actions/setup-r-dependencies@v2
# with:
# packages:
# any::dplyr
# any::knitr
# any::quarto
#
# ### add misc. steps
#
# - name: Was the dashboard updated?
# id: dashboard-updated
# run: |
# if [[ $(git status --porcelain -- index.html index_files/) ]]; then
# echo "has_update=true" >> "$GITHUB_OUTPUT"
# fi
#
# - name: Push Built Dashboard
# if: steps.dashboard-updated.outputs.has_update == 'true'
# run: |
# git config --global user.name 'gha update bot'
# git config --global user.email 'mhpob@users.noreply.github.com'
# git add --all
# git commit --allow-empty -m "[auto] Build Dashboard $(TZ=America/New_York date +'%Y-%m-%d %H:%M')"
# git push
#
# - name: Render and Publish
# if: steps.dashboard-updated.outputs.has_update == 'true'
# uses: quarto-dev/quarto-actions/publish@v2
# with:
# target: gh-pages
# render: false
# path: index.qmd
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run tests

on:
push:
paths: ["**.[rR]", "**.[qrR]md"]
workflow_dispatch:

concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Set up R packages
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages:
any::data.table
any::testthat

- name: Run tests
run: Rscript -e "source(\"work/parsers.R\");
library(testthat);
test_dir(\"tests\")"
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# History files
.Rhistory
.Rapp.history

# Session Data files
.RData
.RDataTmp

# User-specific files
.Ruserdata

# Example code in package build process
*-Ex.R

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# RStudio files
.Rproj.user/

# produced vignettes
vignettes/*.html
vignettes/*.pdf

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md

# R Environment Variables
.Renviron

# pkgdown site
docs/

# translation temp files
po/*~

# RStudio Connect folder
rsconnect/
Loading

0 comments on commit eda0466

Please sign in to comment.