Merge pull request #77 from atztogo/pre-commit-ci-update-config #308
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
name: Continuous Integration | |
on: | |
push: | |
branches-ignore: | |
- rc | |
- master | |
pull_request: | |
branches: [develop] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Cache python dependencies | |
id: cache-pip | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pip | |
key: pip-pre-commit-${{ hashFiles('**/setup.json') }} | |
restore-keys: pip-pre-commit- | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install python dependencies | |
run: | | |
pip install pre-commit | |
pip install -e .[tests] | |
- name: Run pre-commit | |
run: | | |
pre-commit install | |
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) | |
tests: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10', '3.11'] | |
services: | |
postgres: | |
image: postgres:12 | |
env: | |
POSTGRES_DB: test_${{ matrix.backend }} | |
POSTGRES_PASSWORD: "" | |
POSTGRES_HOST_AUTH_METHOD: trust | |
ports: | |
- 5432:5432 | |
rabbitmq: | |
image: rabbitmq:latest | |
ports: | |
- 5672:5672 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
channels: conda-forge | |
channel-priority: strict | |
python-version: ${{ matrix.python-version }} | |
- name: Cache python dependencies | |
id: cache-pip | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pip | |
key: | |
pip-${{ matrix.python-version }}-tests-${{ | |
hashFiles('**/setup.json') }} | |
restore-keys: pip-${{ matrix.python-version }}-tests | |
- name: Install dependencies | |
run: | | |
conda activate test | |
conda install --yes -c conda-forge python=${{ matrix.python-version }} | |
conda install --yes -c conda-forge matplotlib-base pyyaml openblas c-compiler h5py scipy spglib alm cmake pytest-regressions pytest codecov pytest-cov pandas | |
- name: Install phonopy and phono3py | |
run: | | |
conda activate test | |
mkdir install_phonopy && cd install_phonopy # to avoid phonopy directory as recognized as module path by pytest | |
git clone https://github.com/phonopy/phonopy.git | |
cd phonopy | |
pip install -e . -vvv | |
cd .. | |
git clone https://github.com/phonopy/phono3py.git | |
cd phono3py | |
pip install -e . -vvv | |
cd .. | |
cd .. | |
- name: Install python dependencies | |
run: | | |
conda activate test | |
pip install -e . -vvv | |
pip install pgtest | |
- name: Run pytest | |
run: | | |
conda activate test | |
pytest -sv tests |