forked from tsdev/spinw
-
Notifications
You must be signed in to change notification settings - Fork 15
126 lines (121 loc) · 3.98 KB
/
build_pyspinw.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: pySpinW
on:
push:
branches: [master]
pull_request:
branches: [master, development]
types: [opened, reopened, synchronize]
workflow_dispatch:
jobs:
compile_mex:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
matlab_version: [latest]
include:
- os: macos-latest
INSTALL_DEPS: brew install llvm libomp
fail-fast: true
runs-on: ${{ matrix.os }}
steps:
- name: Check out SpinW
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1 # v1.1.0 required for Windows/MacOS support
with:
release: ${{ matrix.matlab_version }}
- name: Remove old mex # This is due to find not working :-/ # find ${{ github.workspace }} -name "*.mex*" -type f -delete
run: |
rm external/chol_omp/chol_omp.mexa64
rm external/chol_omp/chol_omp.mexmaci64
rm external/chol_omp/chol_omp.mexw64
rm external/eig_omp/eig_omp.mexa64
rm external/eig_omp/eig_omp.mexmaci64
rm external/eig_omp/eig_omp.mexw64
rm external/mtimesx/sw_mtimesx.mexa64
rm external/mtimesx/sw_mtimesx.mexmaci64
rm external/mtimesx/sw_mtimesx.mexw64
- name: Run MEXing
uses: matlab-actions/run-command@v1
with:
command: "addpath(genpath('swfiles')); addpath(genpath('external')); sw_mex('compile', true, 'test', false, 'swtest', false);"
- name: Upload MEX results
uses: actions/upload-artifact@v3
with:
name: MEX
path: ${{ github.workspace }}/external/**/*.mex*
build_ctfs:
needs: compile_mex
strategy:
matrix:
matlab_version: [R2021a, R2021b, R2022a, R2022b, R2023a]
runs-on: self-hosted
steps:
- name: Check out SpinW
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download MEX artifacts
uses: actions/download-artifact@v3
with:
name: MEX
path: ${{ github.workspace }}/external
- name: Build ctf
run: |
cd python
/Applications/MATLAB_${{ matrix.matlab_version }}.app/bin/matlab -nodisplay -r "build_ctf; exit"
- name: Upload CTF results
uses: actions/upload-artifact@v3
with:
name: CTF
path: ${{ github.workspace }}/python/ctf/*.ctf
build_wheel:
runs-on: ubuntu-latest
needs: build_ctfs
permissions:
contents: write
steps:
- name: Checkout SpinW
uses: actions/checkout@v3
- name: Download CTF artifacts
uses: actions/download-artifact@v3
with:
name: CTF
path: python/ctf
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Move files
run: |
cd python
echo "PYSPINW_VERSION=$( cat pyproject.toml | grep "version = \"" | awk -F'"' '$0=$2' | sed 's/ //g' )" >> $GITHUB_ENV
mkdir pyspinw/ctfs
mv ctf/*.ctf pyspinw/ctfs
- name: Build Wheel
run: |
cd ${{ github.workspace }}/python
python -m pip wheel --no-deps --wheel-dir build .
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1 # v1.1.0 required for Windows/MacOS support
with:
release: R2023a
- name: Run python test
run: |
pip install scipy
cd ${{ github.workspace }}/python
pip install build/*whl
cd tests
python -m unittest
- name: Create wheel artifact
uses: actions/upload-artifact@v3
with:
name: pySpinW Wheel
path: ${{ github.workspace }}/python/build/*.whl
- name: Upload release wheels
if: ${{ github.event_name == 'release' }}
run: |
pip3 install requests
python3 release.py --notest --github --token=${{ secrets.GH_TOKEN }}