generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ba0210
commit fa10fe0
Showing
72 changed files
with
2,752 additions
and
529 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: 'Install CmdStan with caching' | ||
description: 'Install CmdStan with caching' | ||
inputs: | ||
cmdstan-version: | ||
description: 'CmdStan version to install (use "latest" for the latest version)' | ||
required: false | ||
default: 'latest' | ||
num-cores: | ||
description: 'Number of cores to use for building CmdStan' | ||
required: false | ||
default: '1' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Determine CmdStan Version (Unix) | ||
if: runner.os != 'Windows' && inputs.cmdstan-version == 'latest' | ||
run: | | ||
chmod +x ${{ github.action_path }}/scripts/get-latest-release.sh | ||
${{ github.action_path }}/scripts/get-latest-release.sh | ||
shell: bash | ||
|
||
- name: Determine CmdStan Version (Windows) | ||
if: runner.os == 'Windows' && inputs.cmdstan-version == 'latest' | ||
run: ${{ github.action_path }}\scripts\get-latest-release.ps1 | ||
shell: pwsh | ||
|
||
- name: Set CmdStan Version (Specified) | ||
if: inputs.cmdstan-version != 'latest' | ||
run: echo "CMDSTAN_VERSION=${{ inputs.cmdstan-version }}" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Restore Cache | ||
id: cache-cmdstan | ||
uses: actions/cache@v4 | ||
with: | ||
path: '~/.cmdstan/cmdstan-${{ env.CMDSTAN_VERSION }}' | ||
key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }} | ||
|
||
- name: Check the CmdStan toolchain and repair it if required | ||
if: steps.cache-cmdstan.outputs.cache-hit != 'true' | ||
run: | | ||
Rscript -e 'cmdstanr::check_cmdstan_toolchain(fix = TRUE)' | ||
shell: bash | ||
|
||
- name: Install CmdStan using cmdstanr | ||
if: steps.cache-cmdstan.outputs.cache-hit != 'true' | ||
run: | | ||
Rscript -e 'cmdstanr::install_cmdstan(version = "${{ env.CMDSTAN_VERSION }}", cores = ${{ inputs.num-cores }})' | ||
shell: bash | ||
|
||
- name: Set Cmdstan path | ||
run: | | ||
Rscript -e 'cmdstanr::set_cmdstan_path("~/.cmdstan/cmdstan-${{ env.CMDSTAN_VERSION }}")' | ||
shell: bash |
18 changes: 14 additions & 4 deletions
18
.github/actions/install-cmdstan/scripts/get-latest-release.ps1
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
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
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
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
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
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
Oops, something went wrong.