Skip to content

Commit

Permalink
start drafting github actions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebystrom committed Apr 24, 2024
1 parent 8a2ea7a commit 655c0ae
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
export OMP_NUM_THREADS=2
export PYTHONPATH=$(pwd):$PYTHONPATH
ulimit -s 20000

version=$(python -c 'import sys; print("{0}.{1}".format(*sys.version_info[:2]))')
PYTHONHASHSEED=0 pytest ciderpress/ -s -c pytest.ini ciderpress
52 changes: 52 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Run PySCF Tests

on:
push:
branches:
- dev

pull_request:
branches:
- dev

jobs:
build:

runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.10']
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v3
- name: Setup conda environment
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.6-0' # any version from https://github.com/mamba-org/micromamba-releases
environment-file: nocomp_env.yml
environment-name: run_tests
init-shell: >-
bash
powershell
cache-environment: true
post-cleanup: 'all'
create-args: >-
python=3.10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies and build
run: |
sudo apt-get -qq install gcc libblas-dev cmake
- name: Build things
run: |
source .github/workflows/load_conda.sh
python setup.py build_ext --inplace
python scripts/download_functionals.py
- name: Test with unittest
run: |
# See https://github.com/pytest-dev/pytest/issues/1075
source .github/workflows/load_conda.sh
sh .github/workflows/run_tests.sh
# PYTHONHASHSEED=0 OMP_NUM_THREADS=2 python -m unittest discover ciderpress/dft/tests/
43 changes: 43 additions & 0 deletions scripts/download_functionals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python
# CiderPress: Machine-learning based density functional theory calculations
# Copyright (C) 2024 The President and Fellows of Harvard College
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>
#
# Author: Kyle Bystrom <kylebystrom@gmail.com>
#

import os
import subprocess

basedir = __file__
savedir = os.path.basename(os.path.join(basedir, "../functionals"))

os.makedirs(savedir, exist_ok=True)

links = {
"NL_GGA": "1UNxxvYpxc8RkywxIynbenkLEMGviIce1",
"NL_MGGA_DTR": "1-233LBivti-UDfbSuOMdPZuyC_Gibto0",
"NL_MGGA_PBE": "15x8s_Pf3_iYoAHl_sWChB2q1HFif1jFA",
"NL_MGGA": "1wwYFSJsZX_jhBSlsXVeggQutODXC2KP0",
"SL_GGA": "1qD_IpXQNYUbT8Y7nLt4e4pA1E1dNntu7",
"SL_MGGA": "18OFNglYpcPXHzXwFcRXeJn9VCLFtC7Zd",
}

os.chdir(savedir)
cmd = "wget --no-check-certificate 'https://docs.google.com/uc?export=download&id={}' -O {}"
for name, linkid in links.items():
fname = "CIDER23_{}.yaml".format(name)
mycmd = cmd.format(linkid, fname)
subprocess.call(mycmd, shell=True)

0 comments on commit 655c0ae

Please sign in to comment.