Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Added instructions for CmdStan tarball builder #202

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added knitr/cmdstan-tarball-builder/attach_file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 103 additions & 0 deletions knitr/cmdstan-tarball-builder/cmdstan-tarball-builder.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
title: "CmdStan Tarball Builder"
author: "Stan Development Team"
date: 2-22-2020
output:
html_document: default
pdf_document: default
---

## Introduction

The CmdStan tarball builder Github Action can be used to automatically build a
portable (MacOS/Linux/Windows) CmdStan tarball from a combination of `cmdstan`,
`stanc`, `stanc3`, and `math` Github branches. The goal of this Github Action is
to make it easier to share experimental Stan work.

The two basic steps to use the CmdStan tarball builder are building and
distributing. The Github action will handle the building part. Github releases
are useful for the distributing part, and make it so that the custom CmdStan
can be used directly in [cmdstanr](https://mc-stan.org/cmdstanr/).
bbbales2 marked this conversation as resolved.
Show resolved Hide resolved

## Building the CmdStan tarball

To use the CmdStan tarball builder Github Action,

1. Fork a copy of the [CmdStan repository](https://github.com/stan-dev/cmdstan).
The **Fork** button is in the upper right hand corner of the page. If you already
have a fork of cmdstan, make sure your cmdstan fork is up to date with the
bbbales2 marked this conversation as resolved.
Show resolved Hide resolved
latest `stan-dev/cmdstan` develop branch.

![](make_fork.png)

2. Navigate to the Github Actions page. The **Actions** button is at the top of
the page below the repository title

![](select_actions.png)

3. Select the **CmdStan tarball builder** Github action from the workflows on the
left hand side of the page.

![](select_tarball_builder.png)

4. Click the **Run workflow** dropdown button on the right hand side of the page.

![](run_workflow.png)

5. Fill in a name for the custom CmdStan you are building along with the Github
repository names and branches from which you want to build it. There should be
a **Run Workflow** button at the bottom of this form that will start the build.

Github should forward you to a status page for the action. It may take an hour
or so to build the binaries, but once they are finished there should be an
bbbales2 marked this conversation as resolved.
Show resolved Hide resolved
appropriately named artifact available to download.

## Distributing the CmdStan Tarball

The two drawbacks to the Github Actions artifact outputs are that the output is
not easily downloaded (the artifact download link does not work when it is
copy-pasted), and the tarball is compressed in a zip file (which is slightly
inconvenient).

Github releases are useful for overcoming these difficulties. To do a Github
release of your development CmdStan,

1. Download the CmdStan artifact and unzip it.

2. Create a new Github release. There should be a link for this on the right
hand side of the page under **Releases**

![](create_release.png)

3. Specify a tag, name your release, and add a description of what makes your
CmdStan special. There should be a link at the bottom to upload a file. Upload
the unzipped tarball from the first step (leave it as a `.tar.gz` file -- don't
untar it to a folder).

![](attach_file.png)

4. Once the file finishes uploading click **Publish release**. You should be
redirected to the release page which will have a shareable link to the uploaded
tarball.

## Sharing Installation Instructions

With the Github release, it should be possible for CmdStan users to download
the tarball directly from the release page and use it. R users can use the
`cmdstanr::install_cmdstan` command with a custom `release_url` to use the
custom CmdStan.

For instance, if the final release url is `https://github.com/stan-dev/cmdstan/releases/download/v2.26.1/cmdstan-2.26.1.tar.gz`,
then a `cmdstanr` user can install it with:

```
cmdstanr::install_cmdstan(release_url = "https://github.com/stan-dev/cmdstan/releases/download/v2.26.1/cmdstan-2.26.1.tar.gz")
```

It may also be useful to build a custom `cmdstanr` (if the custom CmdStan has
different arguments). This can be done by pointing `devtools::install_github` at
the appropriate repository and branch:

```
devtools::install_github("stan-dev/cmdstanr@develop")
bbbales2 marked this conversation as resolved.
Show resolved Hide resolved
```
Binary file added knitr/cmdstan-tarball-builder/create_release.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 knitr/cmdstan-tarball-builder/make_fork.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 knitr/cmdstan-tarball-builder/run_workflow.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 knitr/cmdstan-tarball-builder/select_actions.png
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.