-
Notifications
You must be signed in to change notification settings - Fork 70
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
QCSchema coordination, testing, and export #237
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a742dc7
qcsk: export models to JSON Schema with mkdir -p qcschema
loriab 16e2b7b
qcsk: generate example json from tests and test against exported sche…
loriab d3fb4e5
qcsk: mypy fixes incl. dynamic provenance. bump pydantic to v1.5
loriab 75758a1
qcsk: testing configuration and GHA coordination with QCSchema repo
loriab 1573804
qcsk: material changes to models
loriab 1bf66dc
qcsk: description string and formatting changes to models
loriab 10742c8
qcsk: a0 as Bohr abbreviation. test basis sets as str or float
loriab 81a2a0c
patch-ups after review
loriab 4d7df19
rebase and put off QCSchema.yml GHZ
loriab b970ecb
CI on py39 and changelog
loriab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: QCSchema | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
conda-env: [base] | ||
python-version: [3.7] | ||
env: | ||
PYVER: ${{ matrix.python-version }} | ||
CONDA_ENV: ${{ matrix.conda-env }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
path: qcel | ||
|
||
- name: Checkout schema repo | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: MolSSI/QCSchema | ||
path: qcsk | ||
ref: qcsk_export_2 | ||
#ref: master | ||
persist-credentials: true | ||
fetch-depth: 0 | ||
token: ${{ secrets.qcschema_from_qcelemental }} | ||
|
||
- name: Python Setup | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Create Environment | ||
shell: bash | ||
working-directory: ./qcel | ||
run: | | ||
eval "$(conda shell.bash hook)" && conda activate | ||
python devtools/scripts/create_conda_env.py -n=test -p=$PYVER devtools/conda-envs/$CONDA_ENV.yaml | ||
|
||
- name: Install | ||
shell: bash | ||
working-directory: ./qcel | ||
run: | | ||
eval "$(conda shell.bash hook)" && conda activate test | ||
python -m pip install . --no-deps | ||
|
||
- name: Environment Information | ||
shell: bash | ||
run: | | ||
eval "$(conda shell.bash hook)" && conda activate test | ||
conda list --show-channel-urls | ||
|
||
- name: QCSchema from QCElemental | ||
shell: bash | ||
working-directory: ./qcel | ||
run: | | ||
eval "$(conda shell.bash hook)" && conda activate test | ||
make qcschema | ||
ls -l qcschema | ||
cp -p qcschema/* ../qcsk/qcschema/data/vdev/ | ||
mv ../qcsk/qcschema/data/vdev/QCSchema.schema ../qcsk/qcschema/dev/ | ||
|
||
- name: Compare Schemas (generated vs. community) | ||
shell: bash | ||
working-directory: ./qcsk | ||
run: | | ||
git diff --color-words | ||
pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") | ||
branch=qcel-${pull_number} | ||
git checkout -b ${branch} | ||
git remote -v | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Action" | ||
git add -A | ||
git commit -m "auto-generated from QCElemental" | ||
echo "::set-env name=prbranch::${branch}" | ||
|
||
- name: Propose changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
directory: ./qcsk | ||
repository: MolSSI/QCSchema | ||
branch: ${{ env.prbranch }} | ||
github_token: ${{ secrets.qcschema_from_qcelemental }} | ||
force: true |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption( | ||
"--validate", action="store_true", help="validate JSON from previous test run against exported schema" | ||
) | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def set_up_overall(request): | ||
# in all pytest runs except --validate (which uses the files), clear away the JSON examples and generate fresh | ||
if not request.config.getoption("--validate", default=False): | ||
_data_path = Path(__file__).parent.resolve() / "tests" / "qcschema_instances" | ||
for fl in _data_path.rglob("*.json"): | ||
fl.unlink() | ||
|
||
|
||
def pytest_runtest_setup(item): | ||
# there's a bug where can only set options if specify path in call, so needs to be ``pytest qcelemental/ --validate`` | ||
|
||
# skip the validate-generated-instances-against-exported-schema tests on most ``pytest`` runs. | ||
# run only the validate-generated-instances-against-exported-schema tests on ``pytest --validate`` runs. | ||
if not item.config.getoption("--validate", default=False) and item.name.startswith("test_qcschema"): | ||
pytest.skip("can't run with --validate option") | ||
elif item.config.getoption("--validate", default=False) and not item.name.startswith("test_qcschema"): | ||
pytest.skip("need --validate option to run") | ||
|
||
|
||
# Uncomment below to probe for tests needing `@using_web` | ||
|
||
# import socket | ||
# | ||
# class block_network(socket.socket): | ||
# def __init__(self, *args, **kwargs): | ||
# raise Exception("Network call blocked") | ||
# | ||
# socket.socket = block_network |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimization
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimization was never added over at qcsk, so I was aiming for a 1:1 changeset. Agree that it'd be good to get OptimizationInput/Result formalized over there soon.