Minor Bugfixes #145
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_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@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 | |
/Applications/MATLAB_${{ matrix.matlab_version }}.app/bin/matlab -nodisplay -r "build_ctf; exit" | |
- name: Upload CTF results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ctf-${{ matrix.matlab_version }} | |
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: 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: 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@v2 | |
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@v4 | |
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 }} |