1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic_archiver.git synced 2024-08-16 10:09:49 +02:00

add: github workflows (#25)

* add: galaxy action

* fix var name

* run galaxy on very commit

* add: molecule action

* add: matrix

* remove travis

* add editor config

* beautify

* add linter

* ansible dir

* add: tests

* package ecosystem

* fix filename

* fix
This commit is contained in:
Matthias Leutenegger 2020-11-12 16:12:04 +01:00 committed by GitHub
parent dcc357c6fa
commit 5d1b9dc53c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 168 additions and 42 deletions

12
.editorconfig Normal file
View file

@ -0,0 +1,12 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

9
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,9 @@
---
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "daily"
assignees:
- 'mleutenegger'

20
.github/workflows/galaxy.yml vendored Normal file
View file

@ -0,0 +1,20 @@
---
name: 🌌 Galaxy import
on:
push: {}
release:
types:
- published
jobs:
import:
name: 🚀 Galaxy Action
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: galaxy
uses: robertdebock/galaxy-action@1.0.3
with:
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}

54
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,54 @@
---
name: 🎭 Tests
on:
push:
paths:
- defaults/**
- handlers/**
- meta/**
- molecule/**
- tasks/**
- templates/**
- vars/**
- .github/**
jobs:
lint:
name: 📝 Linting
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: Lint Code Base
uses: github/super-linter@v3
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_ANSIBLE: true
ANSIBLE_DIRECTORY: './'
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
molecule:
name: 🧪 Molecule test
runs-on: ubuntu-latest
strategy:
matrix:
distro:
- centos7
- centos6
- ubuntu1804
- debian9
- debian10
steps:
- name: checkout
uses: actions/checkout@v2
with:
path: "${{ github.repository }}"
- name: molecule
uses: robertdebock/molecule-action@2.6.3
env:
MOLECULE_DISTRO: ${{ matrix.distro }}
with:
image: ubuntu

View file

@ -1,34 +0,0 @@
---
language: python
services: docker
env:
global:
- ROLE_NAME: restic
matrix:
- MOLECULE_DISTRO: centos7
- MOLECULE_DISTRO: centos6
- MOLECULE_DISTRO: ubuntu1804
- MOLECULE_DISTRO: debian9
- MOLECULE_DISTRO: debian10
install:
- pip install molecule docker
- git clone https://github.com/arillso/tests molecule/default/lint
before_script:
- cd ../
- mv ansible.$ROLE_NAME arillso.$ROLE_NAME
- cd arillso.$ROLE_NAME
script:
- molecule test
notifications:
webhooks:
urls:
- https://galaxy.ansible.com/api/v1/notifications/
on_success: always
email:
on_success: never
on_failure: always

View file

@ -2,7 +2,10 @@
> **Beta:** This role is in beta status.
[![Build Status](https://img.shields.io/travis/arillso/ansible.restic.svg?branch=master&style=popout-square)](https://travis-ci.org/arillso/ansible.restic) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=popout-square)](https://sbaerlo.ch/licence) [![Ansible Galaxy](https://img.shields.io/badge/ansible--galaxy-restic-blue.svg?style=popout-square)](https://galaxy.ansible.com/arillso/restic) [![Ansible Role](https://img.shields.io/ansible/role/d/42773.svg?style=popout-square)](https://galaxy.ansible.com/arillso/restic)
![🎭 Tests](https://github.com/arillso/ansible.restic/workflows/%F0%9F%8E%AD%20Tests/badge.svg)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=popout-square)](https://sbaerlo.ch/licence)
[![Ansible Galaxy](https://img.shields.io/badge/ansible--galaxy-restic-blue.svg?style=popout-square)](https://galaxy.ansible.com/arillso/restic)
[![Ansible Role](https://img.shields.io/ansible/role/d/42773.svg?style=popout-square)](https://galaxy.ansible.com/arillso/restic)
## Description
[Restic](https://github.com/restic/restic) is a versatile Go based backup

View file

@ -3,9 +3,9 @@ dependency:
name: galaxy
driver:
name: docker
lint: |
set -e
yamllint .
# lint: |
# set -e
# yamllint .
platforms:
- name: instance
image: 'geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest'
@ -16,11 +16,11 @@ platforms:
pre_build_image: true
provisioner:
name: ansible
lint:
name: ansible-lint
# lint:
# name: ansible-lint
playbooks:
converge: ${MOLECULE_PLAYBOOK:-playbook.yml}
scenario:
name: default
verifier:
name: testinfra
name: ansible

View file

@ -2,7 +2,7 @@
- name: Converge
hosts: all
roles:
- role: arillso.restic
- role: ansible.restic
pre_tasks:
- name: install bzip2
package:

View file

@ -0,0 +1,9 @@
---
- name: "include tasks for testing backup files"
include_tasks: "test_backup_files.yml"
- name: "include tasks for testing access files"
include_tasks: "test_access_files.yml"
- name: "include tasks for testing restic link"
include_tasks: "test_restic_link.yml"

View file

@ -0,0 +1,18 @@
---
- name: Stat test access file
stat:
path: ~/restic/access-test.sh
register: test_file
- name: Check that the test access file exists
assert:
that:
- test_file.stat.exists
- name: Stat test_stdin access file
stat:
path: ~/restic/access-test_stdin.sh
register: test_stdin_file
- name: Check that the test_stdin access file exists
assert:
that:
- test_stdin_file.stat.exists

View file

@ -0,0 +1,18 @@
---
- name: Stat test backup file
stat:
path: ~/restic/backup-test.sh
register: test_file
- name: Check that the test backup file exists
assert:
that:
- test_file.stat.exists
- name: Stat test_stdin backup file
stat:
path: ~/restic/backup-test_stdin.sh
register: test_stdin_file
- name: Check that the test_stdin backup file exists
assert:
that:
- test_stdin_file.stat.exists

View file

@ -0,0 +1,9 @@
---
- name: Stat test restic link
stat:
path: ~/restic/restic
register: restic_link
- name: Check that the test restic link exists
assert:
that:
- restic_link.stat.exists

View file

@ -0,0 +1,8 @@
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
tasks:
- name: "Include test_alpha-services"
include_role:
name: "test_restic"