exposing more PowderPattern methods. #28
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: Build and test with Conda | |
on: | |
push: | |
branches: [ develop ] | |
pull_request: | |
branches: [ develop ] | |
workflow_dispatch: | |
jobs: | |
build-and-test-win: | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Prepare conda environment | |
shell: cmd | |
run: | | |
rem Note: Conda VC setenv-script works only with cmd on Win | |
rem Source conda hook | |
set CONDA=C:\Miniconda | |
call %CONDA%\condabin\conda_hook.bat | |
call conda create -n mstruct-env -y -c conda-forge python=3.11 libblas=*=*mkl boost=1.78 lapack fftw gsl scons bzip2 git vs2022_win-64 | |
- name: Build MStruct | |
shell: cmd | |
run: | | |
set CONDA=C:\Miniconda | |
call %CONDA%\condabin\conda_hook.bat | |
call conda activate mstruct-env | |
rem Get conda env prefix | |
call conda info --json | grep default_prefix > _tmp_path1.txt | |
(for /f tokens^=3^,4^,*^ delims^=^" %%a in (_tmp_path1.txt) do echo %%b) > _tmp_path2.txt | |
for /f "usebackq tokens=*" %%i in (`cat _tmp_path2.txt`) do ( | |
set P=%%i | |
) | |
set P=%P:\\=\% | |
echo conda_prefix: %P% | |
rem Set CPP env variables | |
set CPPPATH=%P%\Library\include;%P%\include | |
set LIBRARY_PATH=%P%\Library\lib;%P%\libs | |
cd libmstruct | |
call scons -j4 install prefix=%P%/Library modulepath=%P%/Lib/site-packages | |
- name: Test MStruct | |
shell: cmd | |
run: | | |
set CONDA=C:\Miniconda | |
call %CONDA%\condabin\conda_hook.bat | |
call conda activate mstruct-env | |
call mstruct -v | |
call mstruct_xml -v | |
- name: Make distribution | |
shell: cmd | |
run: | | |
set CONDA=C:\Miniconda | |
call %CONDA%\condabin\conda_hook.bat | |
call conda activate mstruct-env | |
rem Get conda env prefix | |
call conda info --json | grep default_prefix > _tmp_path1.txt | |
(for /f tokens^=3^,4^,*^ delims^=^" %%a in (_tmp_path1.txt) do echo %%b) > _tmp_path2.txt | |
for /f "usebackq tokens=*" %%i in (`cat _tmp_path2.txt`) do ( | |
set P=%%i | |
) | |
set P=%P:\\=\% | |
echo conda_prefix: %P% | |
mkdir dist\mstruct | |
copy %P%\Library\bin\mstruct.exe dist\mstruct | |
copy %P%\Library\bin\mstruct_xml.exe dist\mstruct | |
copy %P%\Library\bin\fftw3.dll dist\mstruct | |
copy %P%\Library\bin\gsl-25.dll dist\mstruct | |
copy %P%\Library\bin\libcblas.dll dist\mstruct | |
copy %P%\Library\bin\zlib.dll dist\mstruct | |
copy %P%\Library\bin\boost_python311.dll dist\mstruct | |
copy %P%\Library\bin\boost_numpy311.dll dist\mstruct | |
copy %P%\Library\bin\boost_program_options.dll dist\mstruct | |
copy %P%\Library\bin\boost_date_time.dll dist\mstruct | |
copy %P%\Library\bin\libMStruct.dll dist\mstruct\libMStruct.pyd | |
- name: Archive distribution | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-win | |
path: dist | |
build-and-test-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Prepare conda environment | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda create -n mstruct-env -y -c conda-forge python=3.11 libblas=*=*mkl boost=1.78 lapack fftw gsl scons bzip2 git gcc_linux-64 gxx_linux-64 | |
- name: Build MStruct | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda activate mstruct-env | |
P="$(conda info --json | grep default_prefix | cut -d\" -f4)" | |
export CPPPATH=$P/include | |
export LIBRARY_PATH=$P/lib | |
export LD_LIBRARY_PATH=$P/lib | |
export CC=$P/bin/gcc | |
export CXX=$P/bin/g++ | |
echo $CC | |
cd libmstruct | |
scons -j4 mstruct | |
scons -j4 install prefix=$P | |
- name: Test MStruct | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda activate mstruct-env | |
P="$(conda info --json | grep default_prefix | cut -d\" -f4)" | |
export LD_LIBRARY_PATH=$P/lib | |
mstruct -v | |
mstruct_xml -v | |
- name: Make distribution | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda activate mstruct-env | |
P="$(conda info --json | grep default_prefix | cut -d\" -f4)" | |
mkdir -p dist/mstruct | |
cp $P/bin/mstruct dist/mstruct | |
cp $P/bin/mstruct_xml dist/mstruct | |
cp $P/lib/libMStruct.so dist/mstruct | |
cp $P/lib/libObjCryst.so dist/mstruct | |
- name: Archive distribution | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-linux | |
path: dist | |