Skip to content

CI

CI #106

Workflow file for this run

name: CI
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
schedule:
# Nightly tests run on master by default:
# Scheduled workflows run on the latest commit on the default or base branch.
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
- cron: "0 0 * * *"
jobs:
unix:
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux CPU Python 3.13
python-version: "3.13"
os: ubuntu-latest
gcc-version: "9"
cdt-name: cos7
- name: MacOS ARM Python 3.11
python-version: "3.11"
os: macos-latest
CMAKE_FLAGS: ""
steps:
- uses: actions/checkout@v2
- name: "Patch conda env (if needed)"
if: startsWith(matrix.os, 'ubuntu')
run: |
sed -i -e "s/@CDT_NAME@/${{ matrix.cdt-name }}/g" \
-e "s/@GCC_VERSION@/${{ matrix.gcc-version }}.*/g" \
devtools/conda-envs/build-${{ matrix.os }}.yml
- uses: conda-incubator/setup-miniconda@v3
name: "Prepare base dependencies"
with:
python-version: ${{ matrix.python-version }}
activate-environment: build
environment-file: devtools/conda-envs/build-${{ matrix.os }}.yml
auto-activate-base: false
miniforge-variant: Miniforge3
use-mamba: true
- name: "Set SDK on MacOS (if needed)"
if: startsWith(matrix.os, 'macos')
run: source devtools/scripts/install_macos_sdk.sh
- name: "Conda info"
shell: bash -l {0}
run: |
conda info -a
conda list
- name: "Configure build with CMake"
shell: bash -l {0}
run: |
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DCMAKE_PREFIX_PATH=${CONDA_PREFIX} \
-DCMAKE_BUILD_TYPE=Release \
-DOPENMM_DIR=${CONDA_PREFIX} \
${{ matrix.CMAKE_FLAGS }}
- name: "Build"
shell: bash -l {0}
run: |
cd build
make -j2 install
make -j2 PythonInstall
- name: "Plugin information"
shell: bash -l {0}
run: |
python -c "import openmm as mm; print('---Loaded---', *mm.pluginLoadedLibNames, '---Failed---', *mm.Platform.getPluginLoadFailures(), sep='\n')"
- name: "Test C++"
shell: bash -l {0}
run: |
set +e
cd build
if [[ ${{ matrix.os }} == ubuntu-* ]]; then
test_files=$(find . -name "Test*" -executable -type f)
else
test_files=$(find . -name "Test*" -perm +0111 -type f)
fi
summary=""
exitcode=0
for f in $test_files; do
fn=$(basename $f)
echo "::group::$fn"
summary+="\n${fn}: "
echo "Running $fn..."
./${f}
thisexitcode=$?
if [[ $thisexitcode == 0 ]]; then summary+="OK"; else summary+="FAILED"; fi
((exitcode+=$thisexitcode))
echo "::endgroup::"
done
echo "-------"
echo "Summary"
echo "-------"
echo -e "${summary}"
exit $exitcode
- name: "Test Python"
shell: bash -l {0}
run: |
cd python/tests
pytest -v Test*
windows:
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows Python 3.12
python-version: "3.12"
os: windows-latest
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v3
name: "Prepare base dependencies"
with:
python-version: ${{ matrix.python-version }}
activate-environment: build
environment-file: devtools/conda-envs/build-${{ matrix.os }}.yml
auto-activate-base: false
miniforge-variant: Miniforge3
use-mamba: true
- name: "Conda info"
shell: cmd /C call {0}
run: |
conda info -a
conda list
- name: "Configure build with CMake"
shell: cmd /C call {0}
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
mkdir build
cd build
cmake .. -G "NMake Makefiles JOM" ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%/Library ^
-DCMAKE_BUILD_TYPE=Release ^
-DOPENMM_DIR=%CONDA_PREFIX%/Library ^
-DONNX_LIBRARY_PATH="C:\Users\runneradmin\miniconda3\envs\build\Library\lib\onnxruntime_conda.lib"
- name: "Build"
shell: cmd /C call {0}
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cd build
jom -j 4 install
jom -j 4 PythonInstall
- name: "Plugin information"
shell: cmd /C call {0}
run: |
python -c "import openmm as mm; print('---Loaded---', *mm.pluginLoadedLibNames, '---Failed---', *mm.Platform.getPluginLoadFailures(), sep='\n')"
# - name: "Test C++"
# shell: cmd /C call {0}
# run: |
# cd build
# ctest --output-on-failure
#
# - name: "Test Python"
# shell: cmd /C call {0}
# run: |
# cd python/tests
# pytest -v TestOnnxForce.py