Skip to content

Commit

Permalink
🧪 Move to GitHub CI (#45)
Browse files Browse the repository at this point in the history
This commit:

1. Moves testing and deployment from TravisCI to Github Actions; this is now the principle test infrastructure used by AiiDA
2. Updates the pre-commit configuration and adds a YAML formatter (causing some change to indentations) 
3. Drops testing of Ubuntu 16.04 and adds testing for 20.04; 16.04 is scheduled for end-of-life in April 2021, but the reason to remove early is that the included python version is 3.5 which is now deprecated by aiida-core (and already failing for aiida-yambo install). Note 18.04 has python 3.6 and 20.04 has 3.8.
  - psutil does not currently have a wheel install for 20.04, this necessitates the install of `gcc` and `python3-dev` for this distribution
4. Update README with new CI badge and development instructions 
5. Adds a tox.ini configuration, for development environment automation
  • Loading branch information
chrisjsewell authored Oct 13, 2020
1 parent 0902146 commit c709088
Show file tree
Hide file tree
Showing 48 changed files with 489 additions and 412 deletions.
5 changes: 5 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
warn_list: # or 'skip_list' to silence them completely
- '106' # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern
- '208' # File permissions unset or incorrect
- '305' # Use shell only when shell functionality is required
- '503' # Tasks that run when changed should likely be handlers
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI

on:
push:
branches: [master]
tags:
- 'v*'
pull_request:

env:
galaxy-name: "marvel-nccr.aiida"

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
- uses: pre-commit/[email protected]

molecule:

strategy:
matrix:
distro: [ubuntu1804, ubuntu2004, centos8, fedora31]
fail-fast: false

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2
with:
path: ${{ env.galaxy-name }}

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

- name: Upgrade pip
run: |
pip install --upgrade pip
pip --version
- name: Install requirements
run: |
pip install wheel
pip install -r requirements.txt
working-directory: ${{ env.galaxy-name }}

- name: Run molecule
run: molecule test
working-directory: ${{ env.galaxy-name }}
env:
MOLECULE_DISTRO: ${{ matrix.distro }}

release:
name: Publish to ansible-galaxy
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [pre-commit, molecule]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: robertdebock/[email protected]
with:
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.swp
.galaxy_install_info
.vscode/
.tox/
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# For use with pre-commit.
# See usage instructions at https://pre-commit.com
repos:

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v1.5.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, "2", --preserve-quotes]

- repo: https://github.com/adrienverge/yamllint
rev: v1.25.0
hooks:
- id: yamllint

- repo: https://github.com/ansible/ansible-lint
rev: v4.3.5
hooks:
- id: ansible-lint
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .yamllint

This file was deleted.

9 changes: 9 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends: default
rules:
document-start: disable
line-length:
max: 200
level: warning
indentation:
spaces: 2
indent-sequences: false
38 changes: 33 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[![Build Status](https://travis-ci.org/marvel-nccr/ansible-role-aiida.svg?branch=master)](https://travis-ci.org/marvel-nccr/ansible-role-aiida)
[![CI](https://github.com/marvel-nccr/ansible-role-aiida/workflows/CI/badge.svg)](https://github.com/marvel-nccr/ansible-role-aiida/actions)
[![Ansible Role](https://img.shields.io/ansible/role/25553.svg)](https://galaxy.ansible.com/marvel-nccr/aiida)
[![Release](https://img.shields.io/github/tag/marvel-nccr/ansible-role-aiida.svg)](https://github.com/marvel-nccr/ansible-role-aiida/releases)


# Ansible Role: marvel-nccr.aiida

An ansible role that installs and configures [AiiDA](http://www.aiida.net/) on Ubuntu, RHEL, CentOS and Fedora.
Expand All @@ -25,17 +24,46 @@ See `defaults/main.yml`
## Development and testing
This role uses [Molecule](https://molecule.readthedocs.io/en/latest/#) and [Docker](https://www.docker.com/) for tests.
This role uses [Molecule](https://molecule.readthedocs.io/en/latest/#) and [Docker](https://www.docker.com/) for tests.
After installing [Docker](https://www.docker.com/):
```
Clone the repository into a package named `marvel-nccr.aiida` (the folder must be named the same as the Ansible Galaxy name)

```bash
git clone https://github.com/marvel-nccr/ansible-role-aiida marvel-nccr.aiida
# Note: folder name marvel-nccr.aiida is required for running tests
cd marvel-nccr.aiida
```

Then run:

```bash
pip install -r requirements.txt # Installs molecule
molecule test # runs tests
```

or use tox (see `tox.ini`):

```bash
pip install tox
tox
```

## Code style

Code style is formatted and linted with [pre-commit](https://pre-commit.com/).

```bash
pip install pre-commit
pre-commit run -all
```

## Deployment

Deployment to Ansible Galaxy is automated *via* GitHub Actions.
Simply tag a release `vX.Y.Z` to initiate the CI and release workflow.
Note, the release will only complete if the CI tests pass.

## License

MIT
Expand Down
65 changes: 31 additions & 34 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
aiida_version: "1.3.0"
aiida_tag: v{{ aiida_version }}
aiida_extras:
- rest
- docs
- atomic_tools
- testing
- notebook
- rest
- docs
- atomic_tools
- testing
- notebook
aiida_data_folder: "${HOME}/.local/share/aiida"
aiida_templates_folder: "${HOME}/.local/share/aiida"
aiida_source_folder: "${HOME}/src"
Expand Down Expand Up @@ -39,23 +38,21 @@ aiida_computer_transport: local
aiida_computer_run_folder: "${HOME}/.aiida_run"

# erlang
aiida_erlang_repository_url: "https://packagecloud.io/install/repositories/rabbitmq/erlang/config_file.repo?\
os={{ ansible_distribution | lower}}&dist={{ ansible_distribution_major_version }}&source=script"
aiida_erlang_repository_url: "https://packagecloud.io/install/repositories/rabbitmq/erlang/config_file.repo?os={{ ansible_distribution | lower}}&dist={{ ansible_distribution_major_version }}&source=script"
aiida_erlang_repository_path: "/etc/yum.repos.d/rabbitmq_erlang.repo"

# rabbitmq
aiida_rabbitmq_version: "3.8.0"
aiida_rabbitmq_basename: "rabbitmq-server"
aiida_rabbitmq_repository_url: "https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/config_file.repo?\
os={{ ansible_distribution | lower}}&dist={{ ansible_distribution_major_version | lower}}&source=script"
aiida_rabbitmq_repository_url: "https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/config_file.repo?os={{ ansible_distribution | lower}}&dist={{ ansible_distribution_major_version | lower}}&source=script"
aiida_rabbitmq_repository_path: "/etc/yum.repos.d/rabbitmq_rabbitmq-server.repo"

# also install and configure the components specified here
aiida_components:
- computers
- computers
# - plugins
- pseudopotentials
- examples
- pseudopotentials
- examples

# plugins
# Note: If possible, these versions should coincide with the ones in
Expand All @@ -77,27 +74,27 @@ aiida_plugins: "{{ aiida_plugin_versions.keys() }}"

# pseudos
aiida_pseudopotentials:
- name: SSSP_1.1_efficiency
file: SSSP_efficiency_pseudos.aiida
url: https://legacy-archive.materialscloud.org/file/2018.0001/v3
home_page: https://materialscloud.org/sssp/
description: >-
Standard Solid State Pseudopotentials (efficiency)
for the PBE functional
- name: SSSP_1.1_precision
file: SSSP_precision_pseudos.aiida
url: https://legacy-archive.materialscloud.org/file/2018.0001/v3
home_page: https://materialscloud.org/sssp/
description: >-
Standard Solid State Pseudopotentials (precision)
for the PBE functional
- name: sg15-oncv-1.1
file: sg15_oncv_upf_2015-10-07.tar.gz
url: http://www.quantum-simulation.org/potentials/sg15_oncv
folder: sg15-oncv-1.1
home_page: http://www.quantum-simulation.org/potentials/sg15_oncv/
description: >-
SG15 Optimized Norm-Conserving Vanderbilt (ONCV) pseudopotentials
- name: SSSP_1.1_efficiency
file: SSSP_efficiency_pseudos.aiida
url: https://legacy-archive.materialscloud.org/file/2018.0001/v3
home_page: https://materialscloud.org/sssp/
description: >-
Standard Solid State Pseudopotentials (efficiency)
for the PBE functional
- name: SSSP_1.1_precision
file: SSSP_precision_pseudos.aiida
url: https://legacy-archive.materialscloud.org/file/2018.0001/v3
home_page: https://materialscloud.org/sssp/
description: >-
Standard Solid State Pseudopotentials (precision)
for the PBE functional
- name: sg15-oncv-1.1
file: sg15_oncv_upf_2015-10-07.tar.gz
url: http://www.quantum-simulation.org/potentials/sg15_oncv
folder: sg15-oncv-1.1
home_page: http://www.quantum-simulation.org/potentials/sg15_oncv/
description: >-
SG15 Optimized Norm-Conserving Vanderbilt (ONCV) pseudopotentials
# REST API
# start AiiDA REST API system service on boot?
Expand Down
1 change: 0 additions & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
---
- name: reentry scan
shell: "{{ aiida_venv }}/bin/reentry scan"
35 changes: 17 additions & 18 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
allow_duplicates: false

galaxy_info:
Expand All @@ -7,23 +6,23 @@ galaxy_info:
license: MIT
min_ansible_version: 2.5
platforms:
- name: Ubuntu
versions:
- xenial
- bionic
- name: Fedora
versions:
- 31
- name: EL
versions:
- 8
- name: Ubuntu
versions:
- xenial
- bionic
- name: Fedora
versions:
- 31
- name: EL
versions:
- 8
galaxy_tags:
- fedora
- centos
- ubuntu
- application
- science
- fedora
- centos
- ubuntu
- application
- science

dependencies:
- role: marvel-nccr.current_user
version: v0.1.0
- role: marvel-nccr.current_user
version: v0.1.0
Loading

0 comments on commit c709088

Please sign in to comment.