From a338aa724d3d5fe19032aee30deed06e0af0e617 Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Mon, 23 Dec 2019 07:53:01 +0100 Subject: [PATCH] Prepare for GitHub Actions --- generate.yml | 7 +++ templates/ansible.yml.j2 | 112 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 templates/ansible.yml.j2 diff --git a/generate.yml b/generate.yml index ff8cdff..a6ea131 100755 --- a/generate.yml +++ b/generate.yml @@ -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 }}" diff --git a/templates/ansible.yml.j2 b/templates/ansible.yml.j2 new file mode 100644 index 0000000..9513a54 --- /dev/null +++ b/templates/ansible.yml.j2 @@ -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 %}