Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
Update base github-actions to node-20 (v4)
   gha/[up|down]load-artifact no longer accept
   same named artifacts for a matrix run
Update Matlab CI to v2
   lowest supported version is R2021a
Update sw_mex to support Apple-Silicon (arm64)
Fix bug in INSTALL_DEPS in yaml
Inc pcsmo test tolerance to pass on MacOS-14
  • Loading branch information
mducle committed Apr 26, 2024
1 parent 322ace4 commit 472e474
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 33 deletions.
2 changes: 1 addition & 1 deletion +sw_tests/+system_tests/systemtest_spinwave_pcsmo.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function test_pcsmo(testCase, usehorace)
spec = testCase.swobj.spinwave(qln, 'formfact', true, 'saveV', true, 'saveH', true, 'optmem', 2);
spec = sw_egrid(spec, 'Evect', linspace(0, 100, 200));
spec = sw_neutron(spec);
testCase.generate_or_verify(spec, {}, struct('V', spec.V, 'H', spec.H), 'approxSab', 0.1);
testCase.generate_or_verify(spec, {}, struct('V', spec.V, 'H', spec.H), 'approxSab', 0.11);
end
end
end
Expand Down
38 changes: 22 additions & 16 deletions .github/workflows/build_pyspinw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Check out SpinW
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: ${{ matrix.INSTALL_DEPS }}
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1 # v1.1.0 required for Windows/MacOS support
uses: matlab-actions/setup-matlab@v2
with:
release: ${{ matrix.matlab_version }}

Expand All @@ -41,13 +43,13 @@ jobs:
rm external/mtimesx/sw_mtimesx.mexmaci64
rm external/mtimesx/sw_mtimesx.mexw64
- name: Run MEXing
uses: matlab-actions/run-command@v1
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@v3
uses: actions/upload-artifact@v4
with:
name: MEX
name: mex-${{ matrix.os }}
path: ${{ github.workspace }}/external/**/*.mex*

build_ctfs:
Expand All @@ -58,22 +60,22 @@ jobs:
runs-on: self-hosted
steps:
- name: Check out SpinW
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download MEX artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: MEX
pattern: 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
uses: actions/upload-artifact@v4
with:
name: CTF
name: ctf-${{ matrix.matlab_version }}
path: ${{ github.workspace }}/python/ctf/*.ctf

build_wheel:
Expand All @@ -83,11 +85,11 @@ jobs:
contents: write
steps:
- name: Checkout SpinW
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Download CTF artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: CTF
pattern: ctf-*
path: python/ctf
- name: Set up Python environment
uses: actions/setup-python@v4
Expand All @@ -98,15 +100,16 @@ jobs:
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
find ctf/ -name "*.ctf" -exec mv '{}' 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
uses: matlab-actions/setup-matlab@v2
with:
release: R2023a
products: MATLAB_Compiler_SDK
- name: Run python test
run: |
pip install scipy
Expand All @@ -115,7 +118,7 @@ jobs:
cd tests
python -m unittest
- name: Create wheel artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pySpinW Wheel
path: ${{ github.workspace }}/python/build/*.whl
Expand All @@ -124,3 +127,6 @@ jobs:
run: |
pip3 install requests
python3 release.py --notest --github --token=${{ secrets.GH_TOKEN }}
- name: Setup tmate
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
2 changes: 1 addition & 1 deletion .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download wheels
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Creates a SpinW release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- if: |
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,45 @@ jobs:
matlab_version: [latest]
include:
- os: ubuntu-latest
matlab_version: R2020a
matlab_version: R2021a
- os: macos-latest
INSTALL_DEPS: brew install llvm libomp
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Check out SpinW
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Dependencies
run: ${{ matrix.INSTALL_DEPS }}
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1 # v1.1.0 required for Windows/MacOS support
uses: matlab-actions/setup-matlab@v2
with:
release: ${{ matrix.matlab_version }}
- name: Run tests
uses: matlab-actions/run-command@v1
uses: matlab-actions/run-command@v2
with:
command: "run run_tests.m"
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
if: ${{ always() && matrix.os == 'ubuntu-latest' && matrix.matlab_version == 'latest' }}
with:
files: coverage*.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Unit test results ${{ matrix.os }}
name: Unit test results ${{ matrix.os }}-${{ matrix.matlab_version }}
path: junit_report*.xml
#- name: Setup tmate
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
publish-test-results:
needs: test
runs-on: ubuntu-latest
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish test results
Expand Down
24 changes: 18 additions & 6 deletions swfiles/sw_mex.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,30 @@ function sw_mex(varargin)
mex('-R2018a',['COMPFLAGS= /I eigen-' eigen_ver],'swloop.cpp')
elseif ismac
% add =libiomp5 after -fopenmp?
if strcmp(mexext, 'mexmaca64')
mwlinklib = '-L$MATLABROOT/bin/maca64';
else
mwlinklib = '-L$MATLABROOT/sys/os/maci64';
end
if exist('/opt/homebrew/opt/libomp/include') == 7
omp_inc = '-I/opt/homebrew/opt/libomp/include';
omp_lib = '-lomp';
else
omp_inc = '-I/usr/local/opt/libomp/include';
omp_lib = '-liomp5';
end
cd(eig_omp_dir);
mex('-v','-largeArrayDims','eig_omp.cpp', 'CXX_FLAGS="-Xclang -fopenmp -pthread"', ...
'LDFLAGS="$LDFLAGS -L$MATLABROOT/sys/os/maci64 -liomp5 -lmwblas -lmwlapack"', ...
'CXXOPTIMFLAGS="$CXXOPTIMFLAGS -Xclang -fopenmp"', "-I/usr/local/opt/libomp/include");
['LDFLAGS="$LDFLAGS ' mwlinklib ' ' omp_lib ' -lmwblas -lmwlapack"'], ...
'CXXOPTIMFLAGS="$CXXOPTIMFLAGS -Xclang -fopenmp"', omp_inc);
cd(chol_omp_dir);
mex('-v','-largeArrayDims','chol_omp.cpp', 'CXX_FLAGS="-Xclang -fopenmp -pthread"', ...
'LDFLAGS="$LDFLAGS -L$MATLABROOT/sys/os/maci64 -liomp5 -lmwblas -lmwlapack"', ...
'CXXOPTIMFLAGS="$CXXOPTIMFLAGS -Xclang -fopenmp"', "-I/usr/local/opt/libomp/include");
['LDFLAGS="$LDFLAGS ' mwlinklib ' ' omp_lib ' -lmwblas -lmwlapack"'], ...
'CXXOPTIMFLAGS="$CXXOPTIMFLAGS -Xclang -fopenmp"', omp_inc);
cd(mtimesx_dir);
mex('-v','-largeArrayDims','sw_mtimesx.c', 'CXX_FLAGS="-Xclang -fopenmp -pthread"', ...
'LDFLAGS="$LDFLAGS -L$MATLABROOT/sys/os/maci64 -liomp5 -lmwblas"', ...
'CXXOPTIMFLAGS="$CXXOPTIMFLAGS -Xclang -fopenmp"', "-I/usr/local/opt/libomp/include");
['LDFLAGS="$LDFLAGS ' mwlinklib ' ' omp_lib ' -lmwblas"'], ...
'CXXOPTIMFLAGS="$CXXOPTIMFLAGS -Xclang -fopenmp"', omp_inc);
cd(swloop_dir);
mex('-v','-R2018a',['-Ieigen-' eigen_ver],'swloop.cpp')
else
Expand Down

0 comments on commit 472e474

Please sign in to comment.