Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
# Conflicts:
#	emmet-api/requirements.txt
#	emmet-core/requirements.txt
#	emmet-core/setup.py
  • Loading branch information
samblau committed May 25, 2023
2 parents 0271555 + 4c8bfcd commit 2629883
Show file tree
Hide file tree
Showing 574 changed files with 33,813 additions and 20,546 deletions.
8 changes: 0 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "emmet-core"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "emmet-api"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Linting

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Install dependencies
run: |
pip install pre-commit
- name: Run pre-commit
run: |
pre-commit run --all-files --show-diff-on-failure
14 changes: 1 addition & 13 deletions .github/workflows/post-process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ on:
- 'testing'

jobs:
merge-me:
name: Merge me!
runs-on: ubuntu-latest
steps:
- # It is often a desired behavior to merge only when a workflow execution
# succeeds. This can be changed as needed.
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Merge me!
uses: ridedott/merge-me-action@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

auto-gen-release:
runs-on: ubuntu-latest
env:
Expand All @@ -29,6 +17,6 @@ jobs:
- # It is often a desired behavior to merge only when a workflow execution
# succeeds. This can be changed as needed.
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: rymndhng/release-on-push-action@v0.25.0
uses: rymndhng/release-on-push-action@v0.20.0
with:
bump_version_scheme: norelease
32 changes: 14 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ jobs:
run: python setup.py sdist bdist_wheel
working-directory: ./${{ matrix.package }}/

- name: Commit files
run: |
git config --local user.email "feedback@materialsproject.org"
git config --local user.name "materialsproject"
git pull origin main
git add ${{ matrix.package }}/_version.py && git commit -m 'Updated version file'
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
Expand All @@ -51,6 +39,10 @@ jobs:
runs-on: ubuntu-latest
needs:
- deploy
strategy:
matrix:
os: ['ubuntu-latest'] # TODO openbabel for windows
python-version: ["3.8"] # TODO numpy import error for pymatgen install in 3.10

steps:
- uses: actions/checkout@v3
Expand All @@ -59,12 +51,16 @@ jobs:
with:
python-version: 3.8

- name: Install dependencies
- name: Install Python dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install emmet-core emmet-builders emmet-api
pip install -r requirements-docs.txt
python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools
python${{ matrix.python-version }} -m pip install --user `grep numpy emmet-core/requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt`
python${{ matrix.python-version }} -m piptools sync --user emmet-core/requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt
python${{ matrix.python-version }} -m pip install --user `grep numpy emmet-builders/requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt`
python${{ matrix.python-version }} -m piptools sync --user emmet-builders/requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt
python${{ matrix.python-version }} -m pip install --user `grep numpy emmet-api/requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt`
python${{ matrix.python-version }} -m piptools sync --user emmet-api/requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt
- name: Generate changelog
uses: charmixer/auto-changelog-action@v1
Expand All @@ -90,7 +86,7 @@ jobs:
run: mkdocs build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3.8.0
uses: peaceiris/actions-gh-pages@v3.9.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
170 changes: 99 additions & 71 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,102 +10,130 @@ on:
- main

jobs:
lint:
runs-on: ubuntu-latest
strategy:
max-parallel: 6
matrix:
package: ["emmet-core", "emmet-builders", "emmet-api"]

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-testing.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 --count --show-source --statistics ${{ matrix.package }}
# exit-zero treats all errors as warnings.
flake8 --count --exit-zero --max-complexity=20 --statistics ${{ matrix.package }}
test:
needs: lint
runs-on: ubuntu-latest
name: ${{ matrix.package }} (${{ matrix.os }}/py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 6
matrix:
os: ['ubuntu-latest']# # TODO openbabel for windows and mac
package: ["emmet-core", "emmet-builders", "emmet-api"]
python_version: [3.8, 3.9]

python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python_version }}
uses: conda-incubator/setup-miniconda@v2
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
python-version: ${{ matrix.python_version }}
update-conda: true
python-version: ${{ matrix.python-version }}
conda-channels: anaconda, conda-forge

- name: Install OpenBabel
shell: bash -l {0}
run: conda install -c conda-forge openbabel
run: |
conda install openbabel -y
# - uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# cache: 'pip'

# - name: Install OpenBabel on Ubuntu
# if: matrix.os == 'ubuntu-latest'
# env:
# cc_compiler: "gcc"
# cxx_compiler: "g++"
# cmake_flags: "-DPYTHON_BINDINGS=ON -DRUN_SWIG=ON"
# shell: bash -l {0}
# run: |
# sudo apt-get update && sudo apt-get -qq install ninja-build swig libeigen3-dev libboost-all-dev libopenbabel-dev
# git clone https://github.com/openbabel/openbabel.git ${{ runner.workspace }}/openbabel
# mkdir "${{ runner.workspace }}/openbabel/build"
# cd "${{ runner.workspace }}/openbabel/build"
# cmake -DCMAKE_C_COMPILER=$cc_compiler -DCMAKE_CXX_COMPILER=$cxx_compiler $cmake_flags ..
# sudo make
# sudo make install
# echo "PYTHONPATH=/usr/local/lib:/usr/local/include/openbabel3:$PYTHONPATH" >> $GITHUB_PATH
# sudo ln -s /usr/include/openbabel3 /usr/local/include/openbabel3
# echo "LD_LIBRARY_PATH=/usr/local/lib:/usr/include/openbabel3:$LD_LIBRARY_PATH" >> $GITHUB_PATH

# - name: Install OpenBabel on MacOS
# if: matrix.os == 'macos-latest'
# env:
# cc_compiler: "clang"
# cxx_compiler: "clang++"
# shell: bash -l {0}
# run: |
# brew install ninja swig eigen boost
# echo "/Users/runner/Library/Python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH
# git clone https://github.com/openbabel/openbabel.git ${{ runner.workspace }}/openbabel
# mkdir "${{ runner.workspace }}/openbabel/build"
# cd "${{ runner.workspace }}/openbabel/build"
# cmake -DCMAKE_C_COMPILER=$cc_compiler -DCMAKE_CXX_COMPILER=$cxx_compiler $cmake_flags ..
# sudo make
# sudo make install
# echo "PYTHONPATH=/usr/local/lib:/usr/local/include/openbabel3:$PYTHONPATH" >> $GITHUB_PATH
# sudo ln -s /usr/include/openbabel3 /usr/local/include/openbabel3
# echo "LD_LIBRARY_PATH=/usr/local/lib:/usr/include/openbabel3:$LD_LIBRARY_PATH" >> $GITHUB_PATH

- name: Install Python dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
pip install -r requirements-testing.txt
pip install -r requirements.txt
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 piptools sync --user ${{ matrix.package }}/requirements/${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt
- name: Install Packages
- name: Install editable emmet-core if needed
shell: bash -l {0}
run: |
pip install -e emmet-core
pip install -e emmet-builders
pip install -e emmet-api
if: matrix.package != 'emmet-core'
run: python${{ matrix.python-version }} -m pip install --user --no-deps ./emmet-core

- name: Install ${{ matrix.package }}
shell: bash -l {0}
run: python${{ matrix.python-version }} -m pip install --user --no-deps -e ./${{ matrix.package }}

- name: Lint with mypy
shell: bash -l {0}
run: mypy --namespace-package ${{ matrix.package }}/emmet
run: python${{ matrix.python-version }} -m mypy --namespace-package ${{ matrix.package }}/emmet

- name: Test with pytest
shell: bash -l {0}
run: |
pytest --cov=emmet --cov-report=xml tests/${{ matrix.package }}
run: python${{ matrix.python-version }} -m pytest --cov=emmet --cov-report=xml ${{ matrix.package }}/tests

- uses: codecov/codecov-action@v3.1.0
- uses: codecov/codecov-action@v3.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml

docs:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-docs.txt
pip install -r requirements.txt
pip install -e emmet-core/
pip install -e emmet-builders/
pip install -e emmet-api/
- name: Build
run: mkdocs build
# docs:
# needs: test
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ["3.8"]

# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# cache: 'pip'

# - name: Install OpenBabel
# run: |
# sudo apt-get update && sudo apt-get install openbabel libopenbabel-dev
# sudo ln -s /usr/include/openbabel3 /usr/local/include/openbabel3

# - name: Install dependencies
# run: |
# python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools
# python${{ matrix.python-version }} -m piptools sync --user emmet-*/requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt
# python${{ matrix.python-version }} -m pip install --user --no-deps -e ./emmet-core ./emmet-api ./emmet-builders

# - name: Build
# run: mkdocs build
Loading

0 comments on commit 2629883

Please sign in to comment.