Issue 94: Add R and Stan for analytical Weibull #68
Workflow file for this run
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
name: check-cmdstan | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
paths: | |
- '**.stan' | |
branches: | |
- main | |
- develop | |
schedule: | |
- cron: '5 4 * * 1' | |
pull_request: | |
paths: | |
- '**.stan' | |
branches: | |
- main | |
- develop | |
merge_group: | |
workflow_dispatch: | |
jobs: | |
check-cmdstan: | |
if: "! contains(github.event.head_commit.message, '[ci skip]')" | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
extra-repositories: 'https://stan-dev.r-universe.dev' | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: local::. | |
- name: Install cmdstan | |
uses: epinowcast/actions/install-cmdstan@v1 | |
with: | |
cmdstan-version: 'latest' | |
num-cores: 2 | |
- name: Compile model and check syntax | |
run: | | |
stan_file <- file.path(tempdir(), "pcd_functions.stan") | |
primarycensoreddist::pcd_load_stan_functions( | |
wrap_in_block = TRUE, | |
write_to_file = TRUE, | |
output_file = stan_file | |
) | |
model <- cmdstanr::cmdstan_model(stan_file) | |
# If the model is not syntactically correct above will fail | |
# however it may be correct enougth to compile but still contain | |
# soft depreciated syntax and so we check the syntax again below | |
# and test the output. | |
message <- capture.output( | |
model$check_syntax(pedantic = TRUE), | |
type = "message" | |
) | |
message | |
# We can't use TRUE here as pendatic check return lots of false | |
# positives related to our use of functions. | |
stopifnot( | |
length(message) != 0 && length(message) < 15 && | |
any(message == "Stan program is syntactically correct") | |
) | |
shell: Rscript {0} |