Skip to content

Commit 1c079fa

Browse files
committed
Alternative way of getting cmdstan version
1 parent c410d3c commit 1c079fa

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

.github/workflows/main.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,7 @@ jobs:
2727
uses: actions/setup-python@v2
2828
with:
2929
python-version: ${{ matrix.python-version }}
30-
- name: Get Cmdstan Version
31-
id: check-cmdstan
32-
run: |
33-
echo "::set-output name=version::$(curl -s 'https://api.github.com/repos/stan-dev/cmdstan/releases/latest' | python -c 'import json,sys;obj=json.load(sys.stdin);print(obj["tag_name"])')"
34-
shell: bash
35-
- name: Cache cmdstan installation
36-
uses: actions/cache@v2
37-
with:
38-
path: ~/.cmdstan
39-
key: ${{ runner.os }}-cmdstan-${{ steps.check-cmdstan.outputs.version }}-${{ hashFiles('**/install_cmdstan.py') }}
30+
4031
- name: Install dependencies (python)
4132
run: |
4233
pip install --upgrade pip wheel
@@ -61,11 +52,24 @@ jobs:
6152
if: matrix.os == 'windows-latest'
6253
run: |
6354
$whl = Get-ChildItem -Path dist -Filter *.whl | Select-Object -First 1
64-
pip install "$whl"
55+
pip install "$whl"
6556
6657
- name: Show libraries
6758
run: python -m pip freeze
6859

60+
- name: Get Cmdstan Version
61+
id: check-cmdstan
62+
# get the latest cmdstan version to use as part of the cache key
63+
run: |
64+
echo "::set-output name=version::$(python -c 'import requests;print(requests.get("https://api.github.com/repos/stan-dev/cmdstan/releases/latest").json()["tag_name"][1:])')"
65+
shell: bash
66+
67+
- name: Cmdstan installation cacheing
68+
uses: actions/cache@v2
69+
with:
70+
path: ~/.cmdstan
71+
key: ${{ runner.os }}-cmdstan-${{ steps.check-cmdstan.outputs.version }}-${{ hashFiles('**/install_cmdstan.py') }}
72+
6973
- name: Install CmdStan (Linux, macOS)
7074
if: matrix.os != 'windows-latest'
7175
run: |

0 commit comments

Comments
 (0)