Skip to content

dist-py adjusted

dist-py adjusted #6

name: Win - Python package using conda / pip
on: [push]
jobs:
build-win:
runs-on: windows-latest
env:
build_file: python/.build/environment_win.yml
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: magtense-env
use-mamba: true
- name: Cache conda
uses: actions/cache@v4
env:
# Increase this value to reset cache manually
cache_number: 0
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}-${{ hashFiles(env.build_file) }}-${{ env.cache_number }}
id: cache
- name: Update environment
run: conda env update -n magtense-env -f ${{ env.build_file }}
if: steps.cache.outputs.cache-hit != 'true'
- name: Compile Fortran files in Developer PowerShell for VS 2022
shell: pwsh -NoExit -ExecutionPolicy ByPass -File {0}
run: |
cd "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\"
.\Launch-VsDevShell.ps1
cd ${{ github.workspace }}/python/src/magtense/lib/
make ps
- name: Compile with nvcc in x64 Native Tools Command Prompt for VS 2022
shell: cmd /k "{0}" -arch=amd64 -host_arch=x64
working-directory: ${{ github.workspace }}/source/MagTenseFortranCuda/cuda
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat"
nvcc -c MagTenseCudaBlas.cu -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34438\bin\Hostx64\x64" -o MagTenseCudaBlas.o
- name: Link Cuda wrapper in Developer PowerShell for VS 2022
shell: pwsh -NoExit -ExecutionPolicy ByPass -File {0}
run: |
cd "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\"
.\Launch-VsDevShell.ps1
cd ${{ github.workspace }}/source/MagTenseFortranCuda/cuda
make wrap
- name: Build Python wrapper in Command Prompt
shell: cmd /C CALL {0}
working-directory: ${{ github.workspace }}/python/src/magtense/lib/
run: >-
make cmdx64
- name: Install local magtense package with pip
run: python -m pip install -e ${{ github.workspace }}/python
- name: Test with pytest
run: |
conda install pytest
pytest