Skip to content

Commit

Permalink
Add example of how using a composite action would work instead of a r…
Browse files Browse the repository at this point in the history
…eusable workflow
  • Loading branch information
p-j-smith committed Nov 28, 2023
1 parent a73481c commit 0ca6652
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/actions/molecule-test-collection/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Molecule Test Collection
description: Run `molecule test` on this Ansible Collection

inputs:
scenario:
description: Name of the scenario to run the tests on
required: false
default: default

runs:
using: composite
steps:
- name: Run `molecule test`
uses: UCL-MIRSG/.github/actions/[email protected]
with:
scenario: ${{ inputs.scenario }}
checkout_path: ansible_collections/mirsg/infrastructure
tests_path: ansible_collections/mirsg/infrastructure/tests
26 changes: 26 additions & 0 deletions .github/workflows/molecule-firewalld-with-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test firewalld
on:
pull_request:
paths:
- "roles/firewalld/**"
- ".github/actions/molecule-test-collection/action.yml"
- ".github/workflows/molecule-firewalld-with-action.yml"

jobs:
molecule:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
scenario:
- centos7
env:
MOLECULE_RUN_TAGS: firewalld
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1

steps:
- name: Run `molecule test`
uses: ./.github/actions/molecule-test-collection
with:
scenario: ${{ matrix.scenario }}

0 comments on commit 0ca6652

Please sign in to comment.