Skip to content

Python + Windows in workflow #3

Python + Windows in workflow

Python + Windows in workflow #3

name: Building & testing Python package using Conda
on: [push]
jobs:
build-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Conda with Python 3.12
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: magtense-env
environment-file: python/environment_win.yml
python-version: 3.12
auto-activate-base: false
- name: Compile Fortran files in Developer PowerShell for VS 2022
shell: powershell -NoExit -ExecutionPolicy ByPass -File C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/Tools/Launch-VsDevShell.ps1
working-directory: ${{ github.workspace }}/python/src/magtense/lib/
run: make ps
- name: Compile with nvcc in x64 Native Tools Command Prompt for VS 2022
shell: cmd /k C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/Tools/VsDevCmd.bat -arch=amd64 -host_arch=x64
working-directory: ${{ github.workspace }}/source/MagTenseFortranCuda/cuda
run: make
- name: Build Python wrapper in x64 Native Tools Command Prompt for VS 2022
shell: cmd /k C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/Tools/VsDevCmd.bat -arch=amd64 -host_arch=x64
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
build-linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- name: Set up Conda with Python 3.12
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: magtense-env
environment-file: python/environment_linux.yml
python-version: 3.12
auto-activate-base: false
- name: Compile Fortran source code and build Python wrapper
working-directory: ${{ github.workspace }}/python/src/magtense/lib/
run: make
- 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