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

Add partial Windows CI #14

Merged
merged 3 commits into from
Sep 13, 2022
Merged
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
64 changes: 60 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ jobs:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: [3.9]
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out github
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install cmdstanpy for cmdstan install
run: |
pip install cmdstanpy
Expand All @@ -37,9 +39,15 @@ jobs:
path: ~/.cmdstan
key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}

- name: Install CmdStan
- name: Install CmdStan (Unix)
if: matrix.os != 'windows-latest'
run: |
python -m cmdstanpy.install_cmdstan --version "${{ env.CMDSTAN_VERSION }}" --cores 2
python -m cmdstanpy.install_cmdstan --version "${{ env.CMDSTAN_VERSION }}" --cores 2 --verbose

- name: Install CmdStan (Windows)
if: matrix.os == 'windows-latest'
run: |
python -m cmdstanpy.install_cmdstan --version "${{ env.CMDSTAN_VERSION }}" --cores 2 --verbose --compiler

# we use the cache here to build the Stan models once for multiple interfaces
- name: Set up test model cache
Expand Down Expand Up @@ -105,7 +113,6 @@ jobs:
cd python/
pytest -v


test_julia_client:
needs: [build_test_models]
runs-on: ${{matrix.os}}
Expand Down Expand Up @@ -175,3 +182,52 @@ jobs:
cd R/tests/
gcc -fpic -shared -o test_collisions.so test_collisions.c
Rscript test_bridgestan.R

# Seperate for now, weird dynamic linking issues need resolving in GHA runner
test_clients_windows:
needs: [build_test_models]
runs-on: windows-latest
steps:
- name: Check out github
uses: actions/checkout@v2

- name: Restore CmdStan
uses: actions/cache@v2
with:
path: ~/.cmdstan
key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}

- name: Setup TBB
run: |
cd ~/.cmdstan/cmdstan-${{ env.CMDSTAN_VERSION }}
Add-Content $env:GITHUB_PATH "$(pwd)/stan/lib/stan_math/lib/tbb"

- name: Restore built models
uses: actions/cache@v2
id: test-models
with:
path: ./stan/
key: ${{ hashFiles('**/*.stan', 'src/*') }}-windows-latest-cmdstan-${{ env.CMDSTAN_VERSION }}-v${{ env.CACHE_VERSION }}

- name: Install R
uses: r-lib/actions/setup-r@v2

- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: |
any::R6
any::testthat

- name: Set up Julia
uses: julia-actions/setup-julia@v1

- name: Run Julia tests
run: |
julia --project=./julia -t 2 -e "using Pkg; Pkg.test()"

- name: Run R tests
run: |
cd R/tests/
gcc -fpic -shared -o test_collisions.dll test_collisions.c
Rscript test_bridgestan.R
2 changes: 1 addition & 1 deletion R/bridgestan.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ StanModel <- R6::R6Class("StanModel",
initialize = function(lib, data, rng_seed, chain_id) {
if (.Platform$OS.type == "windows"){
lib_old <- lib
lib <- paste(tools::file_path_sans_ext(lib), ".dll")
lib <- paste0(tools::file_path_sans_ext(lib), ".dll")
file.copy(from=lib_old, to=lib)
}

Expand Down
5 changes: 1 addition & 4 deletions stan/build_all.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ $models = "throw_tp", "throw_gq", "throw_lp", "throw_data", "jacobian", "ma

$cmdstanfixed = $env:CMDSTAN.replace('\', '/')
foreach ($model in $models) {
mingw32-make.exe CMDSTAN="$($cmdstanfixed)/" -j4 O=0 "stan/$($model)/$($model)_model.so"
mingw32-make.exe CMDSTAN="$($cmdstanfixed)/" STAN_THREADS="True" -j4 O=0 "stan/$($model)/$($model)_model.so"
}

cd "$($env:BRIDGESTAN)/R/test"
gcc.exe -fpic -shared -o test_collisions.dll test_collisions.c