-
Notifications
You must be signed in to change notification settings - Fork 3
89 lines (77 loc) · 3.05 KB
/
dev_ubuntu_macos.yml
File metadata and controls
89 lines (77 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: dev
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
os: [ubuntu-latest, macos-latest]
# pip cache paths
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# use pip caching
- uses: actions/cache@v2
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install numpy cython pytest ninja
python -m pip install h5py
python -m pip install meson==0.60.3
- name: Build
run: |
meson setup build --prefix=$PWD/installdir
meson install -C build
- name: Test with pytest
run: |
export PYTHONPATH=$PWD/installdir/lib/python${{ matrix.python-version }}/site-packages/
pytest mc_lib -v --pyargs
- name: Build the Ising example with setup.py and test it
run: |
export PYTHONPATH=$PWD/installdir/lib/python${{ matrix.python-version }}/site-packages/
cd examples
python setup.py build_ext --inplace
python -c'from cy_ising import simulate; simulate(4, 1.25, 20000)'
- name: Build the Ising example with meson and test it
run: |
export PYTHONPATH=$PWD/installdir/lib/python${{ matrix.python-version }}/site-packages/
cd examples
rm *so # clean up the setup.py build (probably not needed)
meson setup builddir1 --prefix=$PWD/installdir1
meson install -C builddir1
cd installdir1/lib/python${{ matrix.python-version }}/site-packages/examples
python -c'from cy_ising import simulate; simulate(4, 1.25, 20000)'
- name: Test rndm poisson example
run: |
export PYTHONPATH=$PWD/installdir/lib/python${{ matrix.python-version }}/site-packages/
cd examples/installdir1/lib/python${{ matrix.python-version }}/site-packages/examples
python -c'from cy_poisson import test; test()'
- name: Test the frustrated Ising ipynb
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
# example uses multiprocessing, hangs on MacOS. So skip it unless running on Linux.
export PYTHONPATH=$PWD/installdir/lib/python${{ matrix.python-version }}/site-packages/
cd examples
pip install ipython nbformat
ipython -c"%run frustrated_2d_ising.ipynb"
fi