Add GitHub Actions

Add CI via GitHub actions
This commit is contained in:
felix.niederwanger@suse.com 2021-03-24 09:57:12 +01:00
parent a7bc2ae71b
commit ec721e93f1
5 changed files with 43 additions and 19 deletions

37
.github/workflows/CI.yml vendored Normal file
View file

@ -0,0 +1,37 @@
---
name: Test deployment
on: push
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out codebase
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: pip3 install yamllint
- name: Lint repository
run: yamllint .
molecule:
name: Molecule
runs-on: ubuntu-latest
steps:
- name: Check out the codebase
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: pip3 install ansible molecule[docker] docker pytest testinfra
- name: Run Molecule
run: molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'

View file

@ -15,6 +15,7 @@
group: "{{nginxuser}}"
owner: "{{nginxgroup}}"
mode: 0754
register: deployed
- name: Deploy nginx configuration
copy:
content: |
@ -31,12 +32,15 @@
owner: root
group: root
mode: 0644
when: deploy_nginx_config == true
- name: Rung nginx check
when: deployed.changed and deploy_nginx_config == true
- name: Perform nginx check
shell: nginx -t
when: deployed.changed
# Restart of nginx is required for the new configuration
- name: Restart nginx
systemd:
name: nginx
state: restarted
when: deployed.changed

View file

@ -1,10 +0,0 @@
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Example assertion
assert:
that: true

View file

@ -1,2 +0,0 @@
localhost

View file

@ -1,5 +0,0 @@
---
- hosts: localhost
remote_user: root
roles:
- lempo