Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use conda-forge kim-api for GH testing #20

Merged
merged 12 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
ignore:
- dependency-name: "numpy"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
ignore:
- dependency-name: "numpy"
19 changes: 19 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
changelog:
exclude:
authors: [dependabot, github-actions]
categories:
- title: New Features 🎉
labels:
- feature
- title: Bug Fixes 🐛
labels:
- fix
- title: Enhancements 🛠
labels:
- enhancement
- title: Documentation 📖
labels:
- documentation
- title: Other Changes
labels:
- "*"
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine

- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME_OPENKIM }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD_OPENKIM }}
run: |
python setup.py sdist
twine upload dist/*
45 changes: 0 additions & 45 deletions .github/workflows/pythonpublish.yml

This file was deleted.

215 changes: 34 additions & 181 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,188 +3,41 @@ name: test
on: [push]

jobs:
linux:
runs-on: ubuntu-latest
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10"]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Install gcc
run: |
sudo apt-get update
sudo apt-get install -yq gcc
sudo apt-get install -yq gfortran
- name: Install kim-api
run: |
export KIMPY_DIR=${PWD}
export KIM_API_VERSION="2.3.0"
cd $KIMPY_DIR && cd ..
wget http://s3.openkim.org/kim-api/kim-api-$KIM_API_VERSION.txz
tar Jxvf kim-api-$KIM_API_VERSION.txz
cd kim-api-$KIM_API_VERSION
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j2
sudo make install
sudo ldconfig
cd $KIMPY_DIR
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ase
python -m pip install pytest
- name: Install
run: |
python -m pip install .
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
cd scripts
python generate_all.py
cd ..
cd tests
pytest
mac:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
compiler: [clang, gcc]
steps:
- uses: actions/checkout@v2
- name: Install gcc
run: brew install gcc@10
- if: matrix.compiler == 'clang'
name: Set clang env
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "FC=gfortran" >> $GITHUB_ENV
- if: matrix.compiler == 'gcc'
name: Set gcc env
run: |
echo "CC=gcc-10" >> $GITHUB_ENV
echo "CXX=g++-10" >> $GITHUB_ENV
echo "FC=gfortran-10" >> $GITHUB_ENV
- name: Install kim-api
run: |
export KIMPY_DIR=${PWD}
export KIM_API_VERSION="2.3.0"
cd $KIMPY_DIR && cd ..
mkdir -p KIM_API && cd KIM_API
export KIM_API_DIR=$PWD
echo "KIM_API_DIR=$PWD" >> $GITHUB_ENV
cd ..
wget http://s3.openkim.org/kim-api/kim-api-$KIM_API_VERSION.txz
tar Jxvf kim-api-$KIM_API_VERSION.txz
cd kim-api-$KIM_API_VERSION
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$KIM_API_DIR" -DCMAKE_Fortran_COMPILER=gfortran-10
make -j2
make install
source "$KIM_API_DIR/bin/kim-api-activate"
cd $KIMPY_DIR
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install ase
python3 -m pip install pytest
- name: Install
run: |
source "$KIM_API_DIR/bin/kim-api-activate"
python3 -m pip install .
- name: Lint with flake8
run: |
python3 -m pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
cd scripts
python generate_all.py
cd ..
cd tests
pytest
windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
compiler: [gcc]
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
install: git tar vim base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- if: matrix.compiler == 'clang'
name: Set clang env
run: |
pacman --noconfirm -S mingw-w64-x86_64-clang
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "FC=gfortran" >> $GITHUB_ENV
- if: matrix.compiler == 'gcc'
name: Set gcc env
run: |
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
echo "FC=gfortran" >> $GITHUB_ENV
- name: Install KIM-API
run: |
export KIMPY_DIR=${PWD}
export KIM_API_VERSION="2.3.0"
cd $KIMPY_DIR && cd ..
wget http://s3.openkim.org/kim-api/kim-api-$KIM_API_VERSION.txz
tar Jxvf kim-api-$KIM_API_VERSION.txz
cd kim-api-$KIM_API_VERSION
mkdir build && cd build
cmake.exe -G"MSYS Makefiles" .. -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_COMPILER=gfortran
make -j2
make install
cd ${MINGW_PREFIX} && cd lib && cd pkgconfig
export PKG_CONFIG_PATH=${PWD}
export PKG_CONFIG_PATH=$(python -c 'import os; print(os.environ.get("PKG_CONFIG_PATH"))')
$(sed -s "s|\${pcfiledir}|${PKG_CONFIG_PATH}|g" -i ./libkim-api.pc)
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" >> $GITHUB_ENV
cd $KIMPY_DIR
- name: Install dependencies
run: pacman --noconfirm -S mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-pytest mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-scipy mingw-w64-x86_64-python-matplotlib
- name: Install ASE
run: pip3 install ase
- name: Install kimpy
run: |
export PATH=${MINGW_PREFIX}/bin:$PATH
export LD_LIBRARY_PATH=${MINGW_PREFIX}/lib:$LD_LIBRARY_PATH
pip3 install .
- name: Test with pytest
run: |
cd scripts
python generate_all.py
cd ..
cd tests
pytest
- uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/[email protected]
with:
# the create command looks like this:
# `micromamba create -n test-env python=<the corresponding version>`
environment-name: test-env
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
kim-api=2.3.0

- name: Install KIM model
shell: bash -el {0}
run: |
kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_006

- name: Install
shell: bash -el {0}
run: |
python -m pip install --upgrade pip
python -m pip install .[test]

- name: Test with pytest
shell: bash -el {0}
run: |
cd tests
pytest

Loading