Skip to content

Sym=0 fix

Sym=0 fix #217

Workflow file for this run

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@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: ${{ matrix.INSTALL_DEPS }}
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
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@v2
with:
command: "addpath(genpath('swfiles')); addpath(genpath('external')); sw_mex('compile', true, 'test', false, 'swtest', false);"
- name: Upload MEX results
uses: actions/upload-artifact@v4
with:
name: mex-${{ matrix.os }}
path: ${{ github.workspace }}/external/**/*.mex*
build_mltbx:
runs-on: ubuntu-latest
needs: compile_mex
permissions:
contents: write
steps:
- name: Checkout SpinW
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download MEX artifacts
uses: actions/download-artifact@v4
with:
pattern: mex-*
path: ${{ github.workspace }}/external
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
with:
release: latest
- name: Build mltbx
uses: matlab-actions/run-command@v2
with:
command: "cd mltbx; create_mltbx"
- name: Upload mltbx
uses: actions/upload-artifact@v4
with:
name: spinw.mltbx
path: ${{ github.workspace }}/mltbx/spinw.mltbx
- name: Setup tmate
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
build_ctfs:
needs: compile_mex
runs-on: self-hosted
steps:
- name: Check out SpinW
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download MEX artifacts
uses: actions/download-artifact@v4
with:
pattern: mex-*
path: ${{ github.workspace }}/external
- name: Build ctf
run: |
cd python
mkdir ctf
python mcc_all.py
- name: Upload CTF results
uses: actions/upload-artifact@v4
with:
name: ctf-all
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@v4
- name: Download CTF artifacts
uses: actions/download-artifact@v4
with:
pattern: ctf-*
path: python/ctf
- name: Download mltbx artifacts
uses: actions/download-artifact@v4
with:
pattern: spinw.mltbx
path: mltbx
- 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
find ctf/ -name "*.ctf" -exec mv '{}' pyspinw/ctfs \;
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
with:
release: R2023a
products: MATLAB_Compiler_SDK
# Cannot run matlab directly from the setup (gives license error) need to download a runner with the run-command actions
- name: Download Matlab command runner
uses: matlab-actions/run-command@v2
with:
command: "ver"
- name: Generate wrappers
run: |
python -m pip install libpymcr
wget https://gist.github.com/mducle/9186d062b42f05507d831af3d6677a5d/raw/cd0b0d3ed059f4e13d0364e98312dcddc2690ced/run_gh_matlab.sh
chmod 777 run_gh_matlab.sh
matlab2python -a swfiles -a external --preamble "import pyspinw; m = pyspinw.Matlab()" --matlabexec `pwd`/run_gh_matlab.sh
mv matlab_wrapped python/pyspinw
- name: Build Wheel
run: |
cd ${{ github.workspace }}/python
python -m pip wheel --no-deps --wheel-dir wheelhouse .
- 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@v4
with:
name: pySpinW Wheel
path: ${{ github.workspace }}/python/build/*.whl
- name: Upload release wheels
if: ${{ github.event_name == 'release' }}
run: |
python -m pip install requests
python release.py --notest --github --token=${{ secrets.GH_TOKEN }}
- name: Setup tmate
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3