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

Generate enums in Github Actions #1095

Merged
merged 14 commits into from
Sep 19, 2024
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
55 changes: 50 additions & 5 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,57 @@ name: testing

on:
push:
branches:
- main

branches: [main]
pull_request:
branches:
- main
branches: [main]

jobs:
check-enums:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip

- name: Install dependencies
run: |
pip install --upgrade pip pip-tools black ruamel.yaml
pip install --user --no-deps -e ./emmet-core

- name: Generate enums and check output
id: enums
shell: bash -l {0}
run: |
set -e
python emmet-core/dev_scripts/generate_enums.py
black emmet-core/emmet/core/*/calc_types/enums.py
echo "count=$(git diff --exit-code --quiet HEAD emmet-core/emmet/core/*/calc_types/enums.py || echo "1")" >> $GITHUB_OUTPUT
echo "files=$(git ls-files --exclude-standard --others emmet-core/emmet/core/*/calc_types/enums.py | wc -l | xargs)" >> $GITHUB_OUTPUT

- name: Commit & push enums changes
shell: bash -l {0}
run: |
set -e
if [[ "${{ steps.enums.outputs.count }}" != "0" || "${{ steps.enums.outputs.files }}" != "0" ]]; then
git config user.name github-actions
git config user.email [email protected]
git add emmet-core/emmet/core/*/calc_types/enums.py
git commit -m "[automated commit] update calc type enums"
git push
else
echo "No changes detected in enum files."
fi

test:
name: ${{ matrix.package }} (${{ matrix.os }}/py${{ matrix.python-version }})
needs: check-enums
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -21,6 +62,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

- name: Set up Miniconda
Expand All @@ -40,6 +82,9 @@ jobs:
python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools
python${{ matrix.python-version }} -m pip install --user `grep numpy ${{ matrix.package }}/requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt`
python${{ matrix.python-version }} -m pip install --user -r ${{ matrix.package }}/requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt
env:
CC: gcc-10
CXX: g++-10

- name: Install editable emmet-core if needed
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion emmet-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM materialsproject/devops:python-3.1013.18 AS base
FROM materialsproject/devops:python-3.1015.0 AS base
RUN apt-get update && apt-get install -y --no-install-recommends libopenblas-dev libjpeg62 && apt-get clean

FROM base AS builder
Expand Down
4 changes: 2 additions & 2 deletions emmet-api/requirements/ubuntu-latest_py3.10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pydantic-settings==2.5.2
# maggma
pydash==8.0.3
# via maggma
pymatgen==2024.9.17
pymatgen==2024.9.17.1
# via
# emmet-core
# mp-pyrho
Expand All @@ -193,7 +193,7 @@ pymatgen-analysis-alloys==0.0.6
# via emmet-api (setup.py)
pymatgen-analysis-defects==2024.7.19
# via emmet-api (setup.py)
pymongo==4.8.0
pymongo==4.9
# via maggma
pynacl==1.5.0
# via paramiko
Expand Down
6 changes: 3 additions & 3 deletions emmet-api/requirements/ubuntu-latest_py3.10_extras.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ pyflakes==3.2.0
# via flake8
pygments==2.18.0
# via mkdocs-material
pymatgen==2024.9.17
pymatgen==2024.9.17.1
# via
# emmet-core
# mp-pyrho
Expand All @@ -323,7 +323,7 @@ pymdown-extensions==10.9
# via
# mkdocs-material
# mkdocstrings
pymongo==4.8.0
pymongo==4.9
# via maggma
pynacl==1.5.0
# via paramiko
Expand Down Expand Up @@ -453,7 +453,7 @@ urllib3==2.2.3
# types-requests
uvicorn==0.30.6
# via maggma
virtualenv==20.26.4
virtualenv==20.26.5
# via pre-commit
watchdog==5.0.2
# via mkdocs
Expand Down
4 changes: 2 additions & 2 deletions emmet-api/requirements/ubuntu-latest_py3.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pydantic-settings==2.5.2
# maggma
pydash==8.0.3
# via maggma
pymatgen==2024.9.17
pymatgen==2024.9.17.1
# via
# emmet-core
# mp-pyrho
Expand All @@ -191,7 +191,7 @@ pymatgen-analysis-alloys==0.0.6
# via emmet-api (setup.py)
pymatgen-analysis-defects==2024.7.19
# via emmet-api (setup.py)
pymongo==4.8.0
pymongo==4.9
# via maggma
pynacl==1.5.0
# via paramiko
Expand Down
6 changes: 3 additions & 3 deletions emmet-api/requirements/ubuntu-latest_py3.11_extras.txt
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ pyflakes==3.2.0
# via flake8
pygments==2.18.0
# via mkdocs-material
pymatgen==2024.9.17
pymatgen==2024.9.17.1
# via
# emmet-core
# mp-pyrho
Expand All @@ -319,7 +319,7 @@ pymdown-extensions==10.9
# via
# mkdocs-material
# mkdocstrings
pymongo==4.8.0
pymongo==4.9
# via maggma
pynacl==1.5.0
# via paramiko
Expand Down Expand Up @@ -441,7 +441,7 @@ urllib3==2.2.3
# types-requests
uvicorn==0.30.6
# via maggma
virtualenv==20.26.4
virtualenv==20.26.5
# via pre-commit
watchdog==5.0.2
# via mkdocs
Expand Down
Binary file modified emmet-builders/emmet/builders/vasp/mp_potcar_stats.json.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion emmet-builders/requirements/ubuntu-latest_py3.10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ pymatgen-analysis-alloys==0.0.6
# via emmet-core
pymatgen-analysis-diffusion==2023.8.15
# via emmet-core
pymongo==4.8.0
pymongo==4.9
# via
# maggma
# matminer
Expand Down
4 changes: 2 additions & 2 deletions emmet-builders/requirements/ubuntu-latest_py3.10_extras.txt
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ pymdown-extensions==10.9
# via
# mkdocs-material
# mkdocstrings
pymongo==4.8.0
pymongo==4.9
# via
# maggma
# matminer
Expand Down Expand Up @@ -646,7 +646,7 @@ urllib3==2.2.3
# requests
# torchdata
# types-requests
virtualenv==20.26.4
virtualenv==20.26.5
# via pre-commit
watchdog==5.0.2
# via mkdocs
Expand Down
2 changes: 1 addition & 1 deletion emmet-builders/requirements/ubuntu-latest_py3.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ pymatgen-analysis-alloys==0.0.6
# via emmet-core
pymatgen-analysis-diffusion==2023.8.15
# via emmet-core
pymongo==4.8.0
pymongo==4.9
# via
# maggma
# matminer
Expand Down
4 changes: 2 additions & 2 deletions emmet-builders/requirements/ubuntu-latest_py3.11_extras.txt
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ pymdown-extensions==10.9
# via
# mkdocs-material
# mkdocstrings
pymongo==4.8.0
pymongo==4.9
# via
# maggma
# matminer
Expand Down Expand Up @@ -636,7 +636,7 @@ urllib3==2.2.3
# requests
# torchdata
# types-requests
virtualenv==20.26.4
virtualenv==20.26.5
# via pre-commit
watchdog==5.0.2
# via mkdocs
Expand Down
Loading