Move from Travis CI to GH actions

Add molecule steps to check installation from MariaDB Foundation
repositories.
This commit is contained in:
Faustin Lammler 2021-05-25 12:48:11 +02:00
parent deefe6f4dd
commit 68a94b3ca1
No known key found for this signature in database
GPG Key ID: 390A2F27832A5C79
13 changed files with 120 additions and 54 deletions

7
.ansible-lint Normal file
View File

@ -0,0 +1,7 @@
skip_list:
- 'empty-string-compare'
- 'braces'
- 'yaml'
exclude_paths:
- molecule/

49
.github/workflows/molecule.yml vendored Normal file
View File

@ -0,0 +1,49 @@
---
name: molecule
on:
push:
pull_request:
schedule:
- cron: "0 5 * * 2"
jobs:
molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: ubuntu-18.04
playbook: converge.yml
- distro: ubuntu-18.04
playbook: converge-mdbf.yml
- distro: ubuntu-20.04
playbook: converge.yml
- distro: ubuntu-20.04
playbook: converge-mdbf.yml
- distro: ubuntu-20.10
playbook: converge.yml
- distro: ubuntu-20.10
playbook: converge-mdbf.yml
- distro: debian-10
playbook: converge.yml
- distro: debian-10
playbook: converge-mdbf.yml
- distro: debian-sid
playbook: converge.yml
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install requirements
run: pip3 install -r requirements.txt
- name: Run molecule
run: molecule test
env:
PY_COLORS: "1"
ANSIBLE_FORCE_COLOR: "1"
DRIVER_NAME: "docker"
MOLECULE_DISTRO: ${{ matrix.distro }}
MOLECULE_PLAYBOOK: ${{ matrix.playbook }}

14
.github/workflows/pre-commit.yml vendored Normal file
View File

@ -0,0 +1,14 @@
---
name: pre-commit
on:
pull_request:
push:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.3

17
.github/workflows/trigger-galaxy.yml vendored Normal file
View File

@ -0,0 +1,17 @@
---
name: trigger galaxy import
on:
push:
branches:
- master
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Galaxy
uses: robertdebock/galaxy-action@1.1.0
with:
galaxy_api_key: ${{ secrets.galaxy_api_key }}

View File

@ -1,11 +1,13 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
rev: v4.0.1
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-yaml
name: Check yaml files
- id: debug-statements
@ -14,21 +16,25 @@ repos:
name: Check trailing whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://gitlab.com/pycqa/flake8.git
rev: 3.8.4
rev: 3.9.2
hooks:
- id: flake8
name: Check python (flake8)
args: ["--ignore=E501,E226"]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.25.0
rev: v1.26.1
hooks:
- id: yamllint
name: Check yaml files (yamllint)
- repo: https://github.com/ansible/ansible-lint.git
rev: v4.3.7
rev: v5.0.11
hooks:
- id: ansible-lint
name: Check yaml files (ansible-lint)
name: Check ansible files (ansible-lint)
# https://github.com/ansible/ansible-lint/issues/1066
always_run: false
# args: ["-x", "602"]
exclude_types: [markdown, shell]
types: [yaml]
- repo: local
hooks:
@ -39,7 +45,7 @@ repos:
types: [markdown]
- id: docker-shell-shfmt
name: Run shfmt with docker
entry: mvdan/shfmt:v3.2.0 -d -i 2 -ci
entry: mvdan/shfmt:v3.3.0 -d -i 2 -ci
language: docker_image
types: [shell]
- id: docker-shell-lint

View File

@ -1,44 +0,0 @@
---
language: python
services: docker
env:
global:
- ROLE_NAME: mariadb
- DRIVER_NAME: docker
matrix:
- MOLECULE_DISTRO: debian-10
- MOLECULE_DISTRO: debian-sid
- MOLECULE_DISTRO: ubuntu-18.04
- MOLECULE_DISTRO: ubuntu-20.04
- MOLECULE_DISTRO: ubuntu-20.10
before_install:
- |
if ! git diff --name-only HEAD^ | grep -vE '(.md)|(.pdf)'
then
echo "Only doc files were updated, not running the CI."
exit
fi
cache:
directories:
- $HOME/.cache/pre-commit
jobs:
include:
- name: lint with pre-commit
install: skip
before_install: skip
script:
- pip install pre-commit
- pre-commit run -c .travis-pre-commit-config.yaml -a
script:
- export ANSIBLE_STRATEGY=mitogen_linear
- export ANSIBLE_STRATEGY_PLUGINS=${VIRTUAL_ENV}/lib/python${TRAVIS_PYTHON_VERSION}/site-packages/ansible_mitogen/plugins/strategy
- molecule --version
- molecule test
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -1,6 +1,7 @@
# Ansible role: MariaDB
[![travis build status](https://img.shields.io/travis/fauust/ansible-role-mariadb?logo=travis)](https://travis-ci.com/fauust/ansible-role-mariadb)
[![GitHub Actions](https://github.com/fauust/ansible-role-mariadb/workflows/pre-commit/badge.svg?branch=master)](https://github.com/fauust/ansible-role-mariadb/actions?query=workflow%3A%22pre-commit%22)
[![GitHub Actions](https://github.com/fauust/ansible-role-mariadb/workflows/build/badge.svg?branch=master)](https://github.com/fauust/ansible-role-mariadb/actions?query=workflow%3A%22molecule%22)
Install and configure MariaDB Server on Debian/Ubuntu.
@ -38,7 +39,7 @@ Available variables are listed below, along with default values (see
```yaml
mariadb_use_official_repo: false
mariadb_use_official_repo_url: http://ftp.igh.cnrs.fr/pub/mariadb/repo
mariadb_use_official_repo_version: 10.4
mariadb_use_official_repo_version: 10.5
```
You may deploy the MariaDB Server version that comes with your distribution

View File

@ -2,7 +2,7 @@
# Configure the following to use official MariaDB repository
# see: https://downloads.mariadb.org/mariadb/repositories
mariadb_use_official_repo: false
mariadb_use_official_repo_url: http://ftp.igh.cnrs.fr/pub/mariadb/repo
mariadb_use_official_repo_url: https://ftp.igh.cnrs.fr/pub/mariadb/repo
mariadb_use_official_repo_version: 10.5
mariadb_enabled_on_startup: true

View File

@ -0,0 +1,13 @@
---
- name: Converge
hosts: all
gather_facts: true
vars:
ansible_python_interpreter: /usr/bin/python3
mariadb_use_official_repo: true
mariadb_use_official_repo_url: https://ftp.igh.cnrs.fr/pub/mariadb/repo
mariadb_use_official_repo_version: 10.5
vars_files: vars/testvars.yml
roles:
- role: ansible-role-mariadb

View File

@ -4,7 +4,7 @@
gather_facts: true
vars:
ansible_python_interpreter: /usr/bin/python3
vars_files: testvars.yml
vars_files: vars/testvars.yml
roles:
- role: ansible-role-mariadb

View File

@ -16,5 +16,7 @@ provisioner:
ANSIBLE_GATHERING: explicit
ANSIBLE_FORCE_COLOR: true
ANSIBLE_PYTHON_INTERPRETER: /usr/bin/python3
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
verifier:
name: testinfra

View File

@ -1,5 +1,6 @@
import os
# pylint: disable=import-error
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(