Skip to content

Commit

Permalink
🧪 CI: Update GH action workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Apr 5, 2022
1 parent f9383f6 commit f119b60
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 7 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/tests.yml → .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: CI
name: CD

on:
push:
branches: [master, develop]
tags:
- 'v*'
pull_request:
- "v[0-9]+.[0-9]+.[0-9]+*"

jobs:

Expand All @@ -18,7 +16,29 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: pre-commit/[email protected]
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: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: |
pip install --upgrade pip
pip --version
- name: Install wheel
run: pip install wheel
- name: Install AiiDA-LAMMPS
run: |
pip install -e .[testing,pre-commit]
pip freeze
- name: Run pre-commit
run: pre-commit run --all-files || ( git diff; git status; exit 1; )

tests:

Expand Down Expand Up @@ -82,7 +102,7 @@ jobs:
- name: Installation
run: |
pip install -e .[testing]
pip install -e .[testing,pre-commit]
reentry scan
- name: Run pytest
Expand Down
119 changes: 119 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: CI

on:
push:
branches: [master, develop]
pull_request:

jobs:

pre-commit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
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: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: |
pip install --upgrade pip
pip --version
- name: Install wheel
run: pip install wheel
- name: Install AiiDA-LAMMPS
run: |
pip install -e .[testing,pre-commit]
pip freeze
- name: Run pre-commit
run: pre-commit run --all-files || ( git diff; git status; exit 1; )

tests:

timeout-minutes: 30

strategy:
fail-fast: false
matrix:
include:
- python-version: 3.7
lammps-version: "2019.06.05"
backend: django
- python-version: 3.7
lammps-version: "2019.06.05"
backend: sqlalchemy
- python-version: 3.8
lammps-version: "2020.12.24"
backend: django
- python-version: 3.9
lammps-version: "2020.12.24"
backend: django

runs-on: ubuntu-latest

services:
postgres:
image: postgres:10
env:
POSTGRES_DB: test_${{ matrix.backend }}
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: Setup conda
uses: s-weigand/setup-conda@v1
with:
# update-conda: true
python-version: ${{ matrix.python-version }}
conda-channels: conda-forge

- name: install lammps
run: conda install -y lammps==${{ matrix.lammps-version }}

- name: Upgrade pip
run: |
pip install --upgrade pip
pip --version
- name: Installation
run: |
pip install -e .[testing,pre-commit]
reentry scan
- name: Run pytest
run: |
pytest --lammps-exec lmp_serial --cov=aiida_lammps --cov-report=xml --cov-report=term-missing
- name: Upload to Codecov
if: matrix.python-version == 3.8
uses: codecov/codecov-action@v1
with:
name: pytests-lammps
flags: pytests
file: ./coverage.xml
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exclude: >
repos:

- repo: git://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-json
Expand Down

0 comments on commit f119b60

Please sign in to comment.