Skip to content

Commit

Permalink
Merge commit '5c14b88cac9bcb057741e8c6b517f61cbf4305b9' as 'stanc3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi Zhang committed Feb 28, 2025
2 parents e3a1a0d + 5c14b88 commit ae682e3
Show file tree
Hide file tree
Showing 2,675 changed files with 810,271 additions and 0 deletions.
7 changes: 7 additions & 0 deletions stanc3/.git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# usage: git config blame.ignoreRevsFile .git-blame-ignore-revs
# generated with: git log --grep "[fF]ormat.*ocamlformat" --format="format:%H # %s"

2030298f84a95a78953866bf46bc6564f9faee1b # Migrate to Core and format with ocamlformat 0.26.1
845f34e165e16c95596fd48da67bb987bbbe2446 # Format with ocamlformat 0.19.0
9c75bd01015157bae5a133417acf1f7e8af71887 # reformatting using ocamlformat 0.9
b98f92d6a970967bd51158c1b555bf338d4da3b7 # Reformat master with ocamlformat.
8 changes: 8 additions & 0 deletions stanc3/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Set the default behavior, in case people don't have core.autocrlf set.
# This makes sure all text files are automatically converted to lf line endings.
* text eol=lf
*.png binary

# this sets where github can look for language stats
*.ml linguist-language=OCaml
test/integration/** linguist-vendored
2 changes: 2 additions & 0 deletions stanc3/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: stan-dev
custom: https://mc-stan.org/support/
37 changes: 37 additions & 0 deletions stanc3/.github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug report
about: File a bug/issue
title: '[BUG] <title>'
labels: ''
assignees: ''
---
<!-- Thank you for submitting a bug report! -->

### Current Behavior:
<!-- A concise description of what you're experiencing. -->

### Expected Behavior:
<!-- A concise description of what you expected to happen. -->

### Model Code
<!-- If a specific model is causing this issue, it really helps if you can share it -->
<details><summary>Model which exhibits the issue</summary>

```stan
// Please put your code here
```
</details>

### Environment:
<!--
Example:
- OS: Ubuntu 20.04
- stanc: 2.28.0
- cmdstan/rstan/other Stanversions
-->

### Anything else:
<!--
Links? References? Anything that will give us more context about the issue that you are encountering!
-->
8 changes: 8 additions & 0 deletions stanc3/.github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Question about using Stan, modeling, etc
url: https://discourse.mc-stan.org/
about: |
Ask questions and discuss with other community members here.
If your question involves a specific model, including it will
improve the quality of help the community can provide.
23 changes: 23 additions & 0 deletions stanc3/.github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest a new feature for the language or compiler
title: ''
labels: 'feature'
assignees: ''
---

<!-- Please do a quick search of existing issues to make sure that this has not been suggested before.
Thank you for helping us improve Stan!
-->

**Is your feature request related to a problem? Please describe.**
<!-- A description of what the problem is. e.g., "I'm always frustrated when [...]" -->

**Describe the solution you'd like**
<!-- A description of what you're proposing, e.g., "The auto-formatter should allow users to set a line length" -->

**Describe alternatives you've considered**
<!-- A description of any alternative solutions to this problem or features you've considered. -->

**Additional context**
<!-- Add any other context about the feature request here. -->
8 changes: 8 additions & 0 deletions stanc3/.github/ISSUE_TEMPLATE/todo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: TODO Item
about: (For existing developers) Open a generic issue related to the build process or something that needs to be worked on.
title: ''
labels: ''
assignees: ''
---

22 changes: 22 additions & 0 deletions stanc3/.github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
codecov:
require_ci_to_pass: false
ci:
- jenkins.flatironinstitute.org

coverage:
status:
project:
default:
informational: true
threshold: 100%
target: 0%
patch:
default:
informational: true
threshold: 100%
target: 0%

comment:
layout: "diff, files"
behavior: once
require_changes: true
15 changes: 15 additions & 0 deletions stanc3/.github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#### Submission Checklist

- [ ] Run unit tests
- Documentation
- [ ] If a user-facing facing change was made, the documentation PR is here: <LINK>
- [ ] OR, no user-facing changes were made

## Release notes

Replace this text with a short note on what will change if this pull request is merged. This will be included in the release notes.

## Copyright and Licensing

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)
187 changes: 187 additions & 0 deletions stanc3/.github/workflows/binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: Build binaries

on:
workflow_dispatch: {}

env:
OCAML_VERSION: 4.14.1

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
sdk: ""
profile: static
name: ubuntu
- os: macos-13
sdk: "10.11"
profile: release
name: macos-x86_64
- os: macos-latest
sdk: "11.0"
profile: release
name: macos-arm64

runs-on: ${{ matrix.os }}
name: Build ${{ matrix.name }} stanc

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download older SDK
if: matrix.sdk != ''
run: |
wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${{matrix.sdk}}.sdk.tar.xz
tar -xvf MacOSX${{matrix.sdk}}.sdk.tar.xz
sudo mv MacOSX${{matrix.sdk}}.sdk /Library/Developer/CommandLineTools/SDKs
echo "MACOSX_DEPLOYMENT_TARGET=${{matrix.sdk}}" >> $GITHUB_ENV
echo "SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX${{matrix.sdk}}.sdk/" >> $GITHUB_ENV
- name: Use OCaml ${{ env.OCAML_VERSION }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ env.OCAML_VERSION }}
dune-cache: ${{ matrix.name != 'macos-x86_64' }}

- if: matrix.name == 'macos-x86_64'
run: opam pin -y dune 3.6.0 --no-action

- run: bash -x scripts/install_build_deps.sh

- name: Build ${{ matrix.name }}
run: opam exec -- dune subst; opam exec -- dune build --profile ${{ matrix.profile }}

- run: mv _build/default/src/stanc/stanc.exe ${{ matrix.name }}-stanc

- name: Upload ${{ matrix.name }} stanc
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-stanc
path: ${{ matrix.name }}-stanc

build-universal:
needs: build
runs-on: macos-latest
name: Build MacOS universal stanc

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true

- name: Run lipo
run: |
ls
lipo -create -output macos-stanc macos-*-stanc
lipo -archs macos-stanc
- name: Upload macos-stanc
uses: actions/upload-artifact@v4
with:
name: macos-stanc
path: macos-stanc

xbuild-windows:
runs-on: ubuntu-latest
name: Build Windows stanc (cross-compiler)

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install cross-compiler
run: sudo apt-get update; sudo apt-get install -y gcc-mingw-w64-x86-64

- name: Use OCaml ${{ env.OCAML_VERSION }}
uses: ocaml/setup-ocaml@v3
with:
cache-prefix: v1-windows
dune-cache: true
ocaml-compiler: ocaml-windows64.${{ env.OCAML_VERSION }}
opam-repositories: |
windows: http://github.com/ocaml-cross/opam-cross-windows.git
default: https://github.com/ocaml/opam-repository.git
- run: bash -x scripts/install_build_deps_windows.sh

- name: Build
run: |
opam exec -- dune subst
opam exec -- dune build -x windows
- run: mv _build/default.windows/src/stanc/stanc.exe windows-stanc

- name: Upload Windows stanc
uses: actions/upload-artifact@v4
with:
name: windows-stanc
path: windows-stanc

build-js:
runs-on: ubuntu-latest
name: Build stanc.js

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use OCaml ${{ env.OCAML_VERSION }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ env.OCAML_VERSION }}
dune-cache: true
cache-prefix: v1-js

- run: bash -x scripts/install_build_deps.sh
- run: bash -x scripts/install_js_deps.sh

- run: opam exec -- dune build --profile release src/stancjs

- run: mv _build/default/src/stancjs/stancjs.bc.js stanc.js

- name: Upload stanc.js
uses: actions/upload-artifact@v4
with:
name: stanc.js
path: stanc.js

test-builds:
needs: [build, build-universal, xbuild-windows]

strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: ubuntu
- os: macos-latest
name: macos
- os: macos-13
name: macos
- os: windows-latest
name: windows

runs-on: ${{ matrix.os }}

name: Test built stanc on ${{ matrix.os }}

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.name }}-stanc

- name: Update permissions
if: matrix.name != 'windows'
run: chmod +x ${{ matrix.name }}-stanc

- name: Run tests
run: |
mv ${{ matrix.name }}-stanc stanc.exe
./stanc.exe --help
42 changes: 42 additions & 0 deletions stanc3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# rust
/rust/target
/bindgen_test/target
**/*.rs.bk
Cargo.lock
math_iface/gen/*
*.a

# ocaml
_opam
_build
_coverage/
*.coverage
*.merlin
stanc.install

# js
node_modules/*

# python
*.pyc

# tests
test/*.log

# Visual Studio settings
.vscode/**

# temporary editor files
*~
\#*#
.#*
.*.swp

# Mac OS X hidden files
*.DS_Store

# .hpp files in test folder
test/**/*.hpp

# .omir files in test folder
test/**/*.omir
13 changes: 13 additions & 0 deletions stanc3/.ocamlformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version=0.26.1
# loosely re-creates the now-removed "compact" profile
break-separators=before
break-before-in=auto
break-collection-expressions=wrap
dock-collection-brackets=false
doc-comments=before-except-val
indicate-nested-or-patterns=space
field-space=tight
space-around-lists=false
space-around-records=false
space-around-variants=false
sequence-blank-line=compact
Loading

0 comments on commit ae682e3

Please sign in to comment.