Skip to content

Commit

Permalink
🔧 Standardise CI (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Oct 21, 2020
1 parent 8019233 commit 9d86466
Show file tree
Hide file tree
Showing 18 changed files with 279 additions and 150 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.siesta"

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/action@v2.0.0

molecule:

strategy:
matrix:
distro: [ubuntu1604, ubuntu1804]
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/galaxy-action@1.0.3
with:
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
meta/.galaxy_install_info
*.swp
.DS_Store
.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
36 changes: 0 additions & 36 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
53 changes: 49 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[![Build Status](https://travis-ci.org/marvel-nccr/ansible-role-siesta.svg?branch=master)](https://travis-ci.org/marvel-nccr/ansible-role-siesta)
[![CI](https://github.com/marvel-nccr/ansible-role-siesta/workflows/CI/badge.svg)](https://github.com/marvel-nccr/ansible-role-siesta/actions)
[![Ansible Role](https://img.shields.io/ansible/role/25521.svg)](https://galaxy.ansible.com/marvel-nccr/siesta)
[![Release](https://img.shields.io/github/tag/marvel-nccr/ansible-role-siesta.svg)](https://github.com/marvel-nccr/ansible-role-siesta/releases)

# Ansible Role: marvel-nccr.siesta

An Ansible role that installs [Siesta](https://launchpad.net/siesta) on Ubuntu.
Expand All @@ -14,11 +17,53 @@ See `defaults/main.yml`
## Example Playbook

```yaml
- hosts: servers
roles:
- role: marvel-nccr.siesta
- hosts: servers
roles:
- role: marvel-nccr.siesta
```
## Development and testing
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.siesta` (the folder must be named the same as the Ansible Galaxy name)

```bash
git clone https://github.com/marvel-nccr/ansible-role-siesta marvel-nccr.siesta
cd marvel-nccr.siesta
```

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
107 changes: 53 additions & 54 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
siesta_version: "v4.1-rc2"
siesta_minor_version: "v4.1"
siesta_src: siesta-{{ siesta_version }}
Expand All @@ -22,9 +21,9 @@ siesta_scalapack_libs: "-lscalapack-openmpi {{ siesta_blacs_libs }}"
siesta_lapack_libs: "-llapack -lblas"

siesta_executables:
- name: siesta
folder: "{{ siesta_prefix }}"
plugin: siesta.siesta
- name: siesta
folder: "{{ siesta_prefix }}"
plugin: siesta.siesta
#
# After a recent upgrade, this program is not compatible with the STM plugin :-(
# The version shipped with siesta-4.0.X is still appropriate
Expand All @@ -34,38 +33,38 @@ siesta_executables:

# Utilities in Util/
siesta_utils:
- name: denchar
dir: Util/Denchar/Src
description: >-
Charge density and wave-function plotting
- name: g2c_ng
dir: Util/Grid
description: >-
Converter from native grid to Cube format
- name: macroave
dir: Util/Macroave/Src
description: >-
Macroscopic averages processor
- name: mprop
dir: Util/COOP
description: >-
COOP/COHP processor
- name: fat
dir: Util/COOP
description: >-
Fat-bands processor
- name: gnubands
dir: Util/Bands
description: >-
Band-structure plotting
- name: eigfat2plot
dir: Util/Bands
description: >-
Fat-bands plotting
- name: tbtrans
dir: Util/TS/TBtrans
description: >-
Transport post-processor
- name: denchar
dir: Util/Denchar/Src
description: >-
Charge density and wave-function plotting
- name: g2c_ng
dir: Util/Grid
description: >-
Converter from native grid to Cube format
- name: macroave
dir: Util/Macroave/Src
description: >-
Macroscopic averages processor
- name: mprop
dir: Util/COOP
description: >-
COOP/COHP processor
- name: fat
dir: Util/COOP
description: >-
Fat-bands processor
- name: gnubands
dir: Util/Bands
description: >-
Band-structure plotting
- name: eigfat2plot
dir: Util/Bands
description: >-
Fat-bands plotting
- name: tbtrans
dir: Util/TS/TBtrans
description: >-
Transport post-processor
siesta_pps:
# - name: nc-sr-pbe-stringent-0.4
Expand All @@ -86,14 +85,14 @@ siesta_pps:
# Norm-conserving scalar-relativistic pseudopotentials v0.4 for the PBE
# functional (NC SR ONCVPSP v0.4) from pseudo-dojo.org.
# Accuracy "standard", format PSML.
- name: nc-sr-pbe-standard-0.4
file: nc-sr-04_pbe_standard-psf.tgz
url: https://icmab.es/leem/SIESTA_MATERIAL/tmp_PseudoDojo
home_page: http://www.pseudo-dojo.org/
description: >-
Norm-conserving scalar-relativistic pseudopotentials v0.4 for the PBE
functional (NC SR ONCVPSP v0.4) from pseudo-dojo.org.
Accuracy "standard", format PSF.
- name: nc-sr-pbe-standard-0.4
file: nc-sr-04_pbe_standard-psf.tgz
url: https://icmab.es/leem/SIESTA_MATERIAL/tmp_PseudoDojo
home_page: http://www.pseudo-dojo.org/
description: >-
Norm-conserving scalar-relativistic pseudopotentials v0.4 for the PBE
functional (NC SR ONCVPSP v0.4) from pseudo-dojo.org.
Accuracy "standard", format PSF.
# - name: nc-fr-pbe-stringent-0.4
# folder: nc-fr-pbe-stringent-0.4
# file: nc-fr-04_pbe_stringent_psml.tgz
Expand All @@ -112,15 +111,15 @@ siesta_pps:
# Norm-conserving fully-relativistic pseudopotentials v0.4 for the PBE
# functional (NC FR ONCVPSP v0.4) FRom pseudo-dojo.org.
# Accuracy "standard", format PSML.
- name: nc-fr-pbe-standard-0.4
file: nc-fr-04_pbe_standard-psf.tgz
url: https://icmab.es/leem/SIESTA_MATERIAL/tmp_PseudoDojo
home_page: http://www.pseudo-dojo.org/
description: >-
Norm-conserving fully-relativistic pseudopotentials v0.4 for the PBE
functional (NC FR ONCVPSP v0.4) FRom pseudo-dojo.org.
Accuracy "standard", format PSF.
- name: nc-fr-pbe-standard-0.4
file: nc-fr-04_pbe_standard-psf.tgz
url: https://icmab.es/leem/SIESTA_MATERIAL/tmp_PseudoDojo
home_page: http://www.pseudo-dojo.org/
description: >-
Norm-conserving fully-relativistic pseudopotentials v0.4 for the PBE
functional (NC FR ONCVPSP v0.4) FRom pseudo-dojo.org.
Accuracy "standard", format PSF.
siesta_tests:
- h2o
- mno_ldau
- h2o
- mno_ldau
15 changes: 7 additions & 8 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,11 +6,11 @@ galaxy_info:
license: MIT
min_ansible_version: 2.7
platforms:
- name: Ubuntu
versions:
- xenial
- bionic
- name: Ubuntu
versions:
- xenial
- bionic
galaxy_tags:
- ubuntu
- application
- science
- ubuntu
- application
- science
Loading

0 comments on commit 9d86466

Please sign in to comment.