Skip to content

Commit

Permalink
add pre-commit and some other files from cookiecutter
Browse files Browse the repository at this point in the history
  • Loading branch information
federicazanca committed Feb 2, 2024
1 parent a0b5340 commit a391f7c
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/install_aiida_github.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
git clone https://github.com/aiidateam/aiida_core ../aiida_core
cd ../aiida_core
git checkout $AIIDA_DEVELOP_GIT_HASH
pip install -e .[docs,pre-commit,testing]
cd ${TRAVIS_BUILD_DIR}
85 changes: 85 additions & 0 deletions .github/workflows/ci_orig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: ci

on: [push, pull_request]

jobs:

tests:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
python-version: ['3.10']
aiida-version: ['stable']

services:
postgres:
image: postgres:10
env:
POSTGRES_DB: test_aiida
POSTGRES_PASSWORD: ''
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install python dependencies
run: |
pip install --upgrade pip
pip install -e .[testing]
- name: Run test suite
env:
# show timings of tests
PYTEST_ADDOPTS: "--durations=0"
run: pytest --cov aiida_mlip --cov-append .

docs:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install python dependencies
run: |
pip install --upgrade pip
pip install -e .[docs]
- name: Build docs
run: cd docs && make

pre-commit:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install python dependencies
run: |
pip install --upgrade pip
pip install -e .[pre-commit,docs,testing]
- name: Run pre-commit
run: |
pre-commit install
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
33 changes: 33 additions & 0 deletions .github/workflows/publish-on-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish on PyPI

on:
push:
tags:
# After vMajor.Minor.Patch _anything_ is allowed (without "/") !
- v[0-9]+.[0-9]+.[0-9]+*

jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'aiidateam/aiida-mlip' && startsWith(github.ref, 'refs/tags/v')

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: '3.10'

- name: Install flit
run: |
python -m pip install --upgrade pip
python -m pip install flit~=3.4
- name: Build and publish
run: |
flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.pypi_token }}
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.pyc
*.swo
*.swp
~*
*~
.project
*.egg*
.DS_Store
.coverage
.pytest_cache
.vscode
build/
dist/
pip-wheel-metadata/
.tox/
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Install pre-commit hooks via:
# pre-commit install
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-json

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black

- repo: local
hooks:
- id: pylint
language: system
types: [file, python]
name: pylint
description: "This hook runs the pylint static code analyzer"
exclude: &exclude_files >
(?x)^(
docs/.*|
)$
entry: pylint
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you use AiiDA for your research, please cite the following work:
for computational science*, Comp. Mat. Sci 111, 218-230 (2016);
https://doi.org/10.1016/j.commatsci.2015.09.013; http://www.aiida.net.

``aiida-mlip`` is released under the MIT license.
``aiida-mlip`` is released under the BSD 3-Clause license.



Expand Down

0 comments on commit a391f7c

Please sign in to comment.