Skip to content

Commit

Permalink
Added CI/CD.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Maurice committed May 11, 2021
1 parent dc3644e commit b6fd659
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 6 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/molecule-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Molecule Test
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
path: justereseau.docker_compose
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
cd justereseau.docker_compose
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
- name: Test with molecule
run: |
cd justereseau.docker_compose
molecule --version
ansible --version
molecule test
- name: Galaxy
uses: robertdebock/galaxy-action@1.0.3
with:
galaxy_api_key: ${{ secrets.galaxy_api_key }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,3 @@ dmypy.json
.pyre/

# End of https://www.gitignore.io/api/linux,macos,python,ansible

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ansible Role: Docker Compose
# Ansible Role: Docker Compose [![Molecule Test](https://github.com/justereseau/ansible-docker-compose/actions/workflows/molecule-actions.yml/badge.svg)](https://github.com/justereseau/ansible-docker-compose/actions/workflows/molecule-actions.yml)

This role deploy docker-composes services on an host.

Expand Down
1 change: 1 addition & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
state: present
restarted: true
with_items: "{{ docker_compose_templates }}"
when: is_notest | default(false)
6 changes: 3 additions & 3 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ driver:
name: docker
lint: |
yamllint --config-file molecule/default/yaml-lint.yml .
ansible-lint
flake8 --exclude .cache/
ansible-lint --exclude molecule/default/yaml-lint.yml --exclude .cache/ --exclude .github/
flake8 --exclude .cache/,.venv/
platforms:
- name: debian10
image: "geerlingguy/docker-debian10-ansible:latest"
Expand All @@ -27,8 +27,8 @@ scenario:
name: default
test_sequence:
- lint
- destroy
- dependency
- destroy
- syntax
- create
- converge
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
when: ansible_os_family == 'Debian'

roles:
- role: justereseau.docker-compose
- role: justereseau.docker_compose
1 change: 1 addition & 0 deletions molecule/default/yaml-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ rules:

ignore: |
.cache/
.venv/
8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ansible
ansible-lint
molecule
molecule-docker
docker
pytest-testinfra
flake8
yamllint
6 changes: 6 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@
community.docker.docker_compose:
project_src: "{{ item.dest | dirname }}"
state: present
tags: notest
with_items: "{{ docker_compose_templates }}"

- name: Is it notest
set_fact:
is_notest: false
tags: notest

0 comments on commit b6fd659

Please sign in to comment.