Skip to content

Commit

Permalink
Add gh pages (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikcs authored Nov 3, 2024
1 parent 5b79614 commit a199aad
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deploy gh-pages

on:
push:
branches: ["master"]

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build docs
working-directory: r-package/maq
run: |
# Install pandoc
sudo apt-get install -qq pandoc
# Install R
curl -OLs https://eddelbuettel.github.io/r-ci/run.sh && chmod 0755 run.sh
./run.sh bootstrap
./run.sh install_all
# Install maq
R CMD INSTALL .
# Use pkgdown v1.5
sudo Rscript -e "install.packages(c('fs', 'highlight', 'httr', 'memoise', 'openssl', 'purrr', 'rmarkdown', 'rstudioapi', 'whisker', 'xml2', 'yaml'))"
sudo Rscript -e "install.packages('https://cran.r-project.org/src/contrib/Archive/pkgdown/pkgdown_1.5.1.tar.gz', repos = NULL, type = 'source')"
# Build site
cp ../../README.md .
cp ../../REFERENCE.md .
cp ../../CHANGELOG.md .
Rscript -e "pkgdown::build_site()"
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'r-package/maq/docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions r-package/maq/.Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
^docs$
^tests/benchmarks
^tests/valgrind
^_pkgdown\.yml$
^pkgdown$
30 changes: 30 additions & 0 deletions r-package/maq/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
url: https://github.com/grf-labs/maq
navbar:
type: default
left:
- text: "Reference"
href: reference/index.html
- text: "Algorithm reference"
href: REFERENCE.html
- text: "Changelog"
href: CHANGELOG.html
right:
- icon: fa-github fa-lg
href: https://github.com/grf-labs/maq

reference:
- title: Multi-Armed Qini
contents:
- maq
- predict.maq
- average_gain
- difference_gain
- integrated_difference
- get_ipw_scores
- get_aipw_scores

- title: Plotting and printing
contents:
- plot.maq
- print.maq
- summary.maq
14 changes: 14 additions & 0 deletions r-package/maq/pkgdown/extra.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This is a workaround to get the online documentation to produce the correct GitHub
// link to the source file in question. pkgdown assumes the package is hosted
// under the root repo, but maq is hosted under /r-package/maq.
// This fix is from: https://github.com/r-lib/pkgdown/issues/1152
$(function() {
if(window.location.pathname.toLocaleLowerCase().indexOf('/reference') != -1) {
/* Replace '/R/' with '/r-package/maq/R/' in all external links to .R files of maq GitHub repo */
$('a[href^="https://github.com/grf-labs/maq/blob/master/R"][href*=".R"]').attr('href', (i, val) => { return val.replace('/R/', '/r-package/maq/R/'); });
}
if(window.location.pathname.toLocaleLowerCase().indexOf('/articles') != -1) {
/* Replace '/vignettes/' with '/r-package/maq/vignettes/' in all external links to .Rmd files of maq GitHub repo */
$('a[href^="https://github.com/grf-labs/maq/blob/master/vignettes"][href*=".Rmd"]').attr('href', (i, val) => { return val.replace('/vignettes/', '/r-package/maq/vignettes/'); });
}
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added r-package/maq/pkgdown/favicon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added r-package/maq/pkgdown/favicon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added r-package/maq/pkgdown/favicon/favicon.ico
Binary file not shown.

0 comments on commit a199aad

Please sign in to comment.