mirror of
https://github.com/GeekOops/geekoops-nginx.git
synced 2024-05-19 21:22:21 +00:00
Add GitHub Actions
Add CI via GitHub actions
This commit is contained in:
parent
a7bc2ae71b
commit
ec721e93f1
37
.github/workflows/CI.yml
vendored
Normal file
37
.github/workflows/CI.yml
vendored
Normal 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'
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -1,2 +0,0 @@
|
|||
localhost
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- lempo
|
Loading…
Reference in a new issue