Prepare for GitHub Actions

This commit is contained in:
Robert de Bock 2019-12-23 07:53:01 +01:00
parent 8ef039337b
commit a338aa724d
2 changed files with 119 additions and 0 deletions

View File

@ -135,6 +135,11 @@
path: "{{ role_path }}/.github"
state: directory
- name: create .github/workflows directory
file:
path: "{{ role_path }}/.github/workflows"
state: directory
- name: copy file
copy:
src: "{{ playbook_dir }}/files/{{ item.source }}"
@ -168,5 +173,7 @@
dest: molecule/default/molecule.yml
- source: README.md
- source: CONTRIBUTING.md
- source: ansible.yml
dest: .github/workflows/ansible.yml
loop_control:
label: "{{ item.source }}"

112
templates/ansible.yml.j2 Normal file
View File

@ -0,0 +1,112 @@
---
{{ ansible_managed | comment }}
name: GitHub Action
on:
- push
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
image:
{% for platform in meta.galaxy_info.platforms %}
{% if platform.name == "Amazon" %}
- amazonlinux
{% elif platform.name == "EL" %}
- centos
{% else %}
- {{ platform.name | lower }}
{% endif %}
{% endfor %}
tag:
- 1
- 7
- edge
- latest
- rawhide
- unstable
exclude:
- image: alpine
tag: 1
- image: alpine
tag: 7
- image: alpine
tag: rawhide
- image: alpine
tag: unstable
- image: amazonlinux
tag: 7
- image: amazonlinux
tag: edge
- image: amazonlinux
tag: rawhide
- image: amazonlinux
tag: unstable
- image: debian
tag: 1
- image: debian
tag: 7
- image: debian
tag: edge
- image: debian
tag: rawhide
- image: centos
tag: 1
- image: centos
tag: edge
- image: centos
tag: rawhide
- image: centos
tag: unstable
- image: fedora
tag: 1
- image: fedora
tag: 7
- image: fedora
tag: edge
- image: fedora
tag: unstable
- image: opensuse
tag: 1
- image: opensuse
tag: 7
- image: opensuse
tag: edge
- image: opensuse
tag: rawhide
- image: opensuse
tag: unstable
- image: ubuntu
tag: 1
- image: ubuntu
tag: 7
- image: ubuntu
tag: edge
- image: ubuntu
tag: rawhide
- image: ubuntu
tag: unstable
steps:
- name: checkout
uses: actions/checkout@v2
with:
path: {% raw %}"${{ github.repository }}"{% endraw %}
- name: molecule
uses: robertdebock/molecule-action@1.1.1
with:
image: {% raw %}${{ matrix.image }}{% endraw %}
options: parallel
release:
needs:
- test
runs-on: ubuntu-latest
steps:
- name: galaxy
uses: robertdebock/galaxy-action@1.0.0
with:
galaxy_api_key: {% raw %}${{ secrets.galaxy_api_key }}{% endraw %}