Update Stan to 2.36.0 #723
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: bridgestan tests | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
workflow_dispatch: {} | |
env: | |
CACHE_VERSION: 1 | |
# only run one copy per PR | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ${{matrix.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check out github | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Stan build caching | |
uses: actions/cache@v4 | |
id: stan-cache | |
with: | |
path: ./stan/ | |
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }} | |
- name: Set up PATH for C example | |
if: matrix.os == 'windows-latest' | |
run: | | |
Add-Content $env:GITHUB_PATH "$(pwd)/stan/lib/stan_math/lib/tbb" | |
Add-Content $env:GITHUB_PATH "$(pwd)/test_models/full" | |
- name: Build C example (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd c-example/ | |
make -j4 example.exe example_runtime.exe | |
rm ../src/bridgestan.o | |
echo "Dynamically linked example" | |
./example.exe | |
echo "Runtime loading example" | |
./example_runtime.exe ../test_models/full/full_model.so | |
- name: Build C example (Unix) | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd c-example/ | |
make -j4 example example_static example_runtime | |
rm ../src/bridgestan.o ../test_models/full/*.a | |
echo "Dynamically linked example" | |
./example | |
echo "Statically linked example" | |
./example_static | |
echo "Runtime loading example" | |
./example_runtime ../test_models/full/full_model.so | |
shell: bash | |
# we use the cache here to build the Stan models once for multiple interfaces | |
- name: Set up test model cache | |
uses: actions/cache@v4 | |
id: test-models | |
with: | |
path: ./test_models/ | |
key: ${{ hashFiles('**/*.stan', 'src/*', 'stan/src/stan/version.hpp', 'Makefile') }}-${{ matrix.os }}-v${{ env.CACHE_VERSION }} | |
- name: Build test models | |
if: steps.test-models.outputs.cache-hit != 'true' | |
run: | | |
make STAN_THREADS=true O=0 test_models -j4 | |
python: | |
needs: [build] | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.9", "3.12"] | |
fail-fast: false | |
steps: | |
- name: Check out github | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Restore Stan | |
uses: actions/cache@v4 | |
id: stan-cache | |
with: | |
path: ./stan/ | |
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }} | |
- name: Restore built models | |
uses: actions/cache@v4 | |
id: test-models | |
with: | |
path: ./test_models/ | |
key: ${{ hashFiles('**/*.stan', 'src/*', 'stan/src/stan/version.hpp', 'Makefile') }}-${{ matrix.os }}-v${{ env.CACHE_VERSION }} | |
- name: Install package | |
run: | | |
cd python/ | |
pip install pytest | |
pip install . | |
- name: Test import | |
run: | | |
python -c "import bridgestan" | |
- name: Run tests | |
run: | | |
pytest -v python/ | |
cd python/ | |
python example.py | |
env: | |
BRIDGESTAN: ${{ github.workspace }} | |
- name: Run tests (Unix-specific) | |
if: matrix.os != 'windows-latest' | |
run: | | |
pytest -v python/ --run-type=ad_hessian | |
env: | |
BRIDGESTAN: ${{ github.workspace }} | |
julia: | |
needs: [build] | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
julia-version: ["1"] | |
include: | |
- julia-version: "1.6" | |
os: ubuntu-latest | |
fail-fast: false | |
steps: | |
- name: Check out github | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Julia | |
uses: julia-actions/setup-julia@v2 | |
with: | |
version: ${{ matrix.julia-version }} | |
- name: Restore Stan | |
uses: actions/cache@v4 | |
id: stan-cache | |
with: | |
path: ./stan/ | |
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }} | |
- name: Restore built models | |
uses: actions/cache@v4 | |
id: test-models | |
with: | |
path: ./test_models/ | |
key: ${{ hashFiles('**/*.stan', 'src/*', 'stan/src/stan/version.hpp', 'Makefile') }}-${{ matrix.os }}-v${{ env.CACHE_VERSION }} | |
- name: Check import | |
run: | | |
cd julia/ | |
julia --project=. -e "using Pkg; Pkg.instantiate()" | |
julia --project=. -e "using BridgeStan" | |
- name: Run tests | |
run: | | |
cd julia/ | |
julia --project=. -t 2 -e "using Pkg; Pkg.test()" | |
julia --project=. example.jl | |
env: | |
BRIDGESTAN: ${{ github.workspace }} | |
Rlang: | |
needs: [build] | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
fail-fast: false | |
steps: | |
- name: Check out github | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2.11.1 | |
- name: Install R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2.11.1 | |
with: | |
packages: | | |
any::R6 | |
any::testthat | |
any::devtools | |
- name: Restore Stan | |
uses: actions/cache@v4 | |
with: | |
path: ./stan/ | |
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }} | |
- name: Restore built models | |
uses: actions/cache@v4 | |
id: test-models | |
with: | |
path: ./test_models/ | |
key: ${{ hashFiles('**/*.stan', 'src/*', 'stan/src/stan/version.hpp', 'Makefile') }}-${{ matrix.os }}-v${{ env.CACHE_VERSION }} | |
- name: Run tests | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd R/tests/testthat | |
gcc -fpic -shared -o test_collisions.so test_collisions.c | |
cd ../.. | |
Rscript -e "devtools::test(reporter = c(\"summary\", \"fail\"))" | |
Rscript -e "install.packages(getwd(), repos=NULL, type=\"source\")" | |
Rscript example.R | |
env: | |
BRIDGESTAN: ${{ github.workspace }} | |
- name: Run tests (windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd R/tests/testthat | |
gcc -fpic -shared -o test_collisions.dll test_collisions.c | |
if (!$LASTEXITCODE.Equals(0)) {exit $LASTEXITCODE} | |
cd ../.. | |
Rscript -e 'devtools::test(reporter = c("summary", "fail"))' | |
if (!$LASTEXITCODE.Equals(0)) {exit $LASTEXITCODE} | |
Rscript -e 'install.packages(getwd(), repos=NULL, type="source")' | |
if (!$LASTEXITCODE.Equals(0)) {exit $LASTEXITCODE} | |
Rscript example.R | |
if (!$LASTEXITCODE.Equals(0)) {exit $LASTEXITCODE} | |
env: | |
BRIDGESTAN: ${{ github.workspace }} | |
rust: | |
needs: [build] | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
fail-fast: false | |
steps: | |
- name: Check out github | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Restore Stan | |
uses: actions/cache@v4 | |
with: | |
path: ./stan/ | |
key: ${{ runner.os }}-stan-${{ hashFiles('stan/src/stan/version.hpp') }}-v${{ env.CACHE_VERSION }} | |
- name: Restore built models | |
uses: actions/cache@v4 | |
id: test-models | |
with: | |
path: ./test_models/ | |
key: ${{ hashFiles('**/*.stan', 'src/*', 'stan/src/stan/version.hpp', 'Makefile') }}-${{ matrix.os }}-v${{ env.CACHE_VERSION }} | |
- name: Set up TBB | |
if: matrix.os == 'windows-latest' | |
run: | | |
Add-Content $env:GITHUB_PATH "$(pwd)/stan/lib/stan_math/lib/tbb" | |
- name: Run rust tests | |
working-directory: ./rust | |
timeout-minutes: 60 | |
run: | | |
cargo clippy | |
cargo fmt --check | |
cargo run --example=example | |
# run all tests with feature download-bridgestan-src | |
cargo test --verbose --all-features | |
cargo test --verbose model_compiling -- --ignored |