To generate standalone R Markdown documents or web sites with Travis, you need to hoodwink the system into thinking it is building a real R package. R is natively supported in Travis thanks to work by the community.Ī Travis R build comes with pandoc and LaTeX, ostensibly for building R package documentation. Since we will be knitting R Markdown files into Markdown, we want Travis to have a copy of R installed. travis.yml that lives in the root of your Git repository.Īs a baseline, I recommend creating a file that contains the following configuration. Copy it to your clipboard.īack on Travis, on the settings page for your branch, create an Environment Variable with name GITHUB_PAT and paste the personal access token into the Value field. You will also need to generate a personal access token on GitHub, which grants Travis permission to push to your branch. It doesn’t actually do anything just yet, but now Travis knows to watch for future commits to this repo. In the Travis ‘Accounts’ screen, look for your site’s repository and switch it on (green tick). However, rather than running tests on software, we are going to be using Travis’s infrastructure to build our web site for us. Travis is a service designed to run unit tests on software packages so that bugs are not introduced during development. Once that is all working smoothly, sign up for a free Travis CI account. There are plenty of good guides for this on the web, so I won’t go into the details here. If you have not already done so, set up a regular GitHub Pages Jekyll site. What we are going to do instead is knit our R Markdown posts in the cloud, which automatically pushes the resulting plain Markdown files and images to GitHub, where they will be served by Jekyll like a regular site.įor reference, I have created a minimal working repository. Ideally, we want to be able to maintain our web site from anywhere we have access to a web browser, just as we would a WordPress or Blogger site. Jekyll is written in Ruby, which can be a pain to install on Windows and fiddly to configure for GitHub Pages. This is a nice, but incomplete solution, because it means we can only really write and edit posts from computers on which R, servr and Jekyll are installed. Yihui Xie 1 has added Jekyll support to the servr package and published a blog post and GitHub repository demonstrating how to use servr::jekyll to serve a Jekyll site locally with R Markdown. In this post I will explain how you can use Travis CI to knit R Markdown posts and deploy them to a GitHub Pages Jekyll site. How can we write and edit blog posts in R Markdown and serve them on GitHub Pages without having to build everything locally? Markdown is good, but R Markdown is even better, assuming we ever want to write anything involving plots or data analysis. Simply push your plain text Markdown content to a repository and the server-side Jekyll engine will render it for the web. GitHub Pages' built-in Jekyll support makes it very easy for techie types to deploy static web sites. Tea & Stats Tea & Stats Data science with David Selbyĭeploying an R Markdown Jekyll site to GitHub Pages. Deploying an R Markdown Jekyll site to GitHub Pages
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |