-
Notifications
You must be signed in to change notification settings - Fork 4
61 lines (58 loc) · 1.77 KB
/
molecule.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
name: Molecule
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
provide_scenarios:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"
- name: Get changed files
id: changed-files-yaml
uses: tj-actions/changed-files@v39
with:
json: true
quotepath: false
files_yaml: |
playbooks:
- 'playbooks/*.yml'
roles:
- 'playbooks/roles/**/**'
- id: set-playbooks-matrix
run: echo "playbooks=matrix::${{ steps.changed-files-yaml.outputs.playbooks_all_changed_files }}" >> $GITHUB_OUTPUT
- name: Debug
run: echo ${{ steps.changed-files-yaml.outputs.playbooks_all_changed_files }}
- name: Debug
run: echo ${{ steps.set-playbooks-matrix.outputs.playbooks }}
outputs:
playbooks_matrix: ${{ steps.set-playbooks-matrix.outputs.playbooks }}
molecule_playbooks:
needs: provide_scenarios
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
playbooks: ${{ fromJSON(needs.provide_scenarios.outputs.playbooks_matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"
- name: Filename to scenario name
id: set-scenario
run: echo "scenario_name=`basename -s .yml ${{ matrix.playbooks }}`" >> $GITHUB_OUTPUT
- name: Molecule tests for playbooks
uses: gofrolist/molecule-action@v2
with:
molecule_command: test
molecule_args: --scenario-name playbook-${{ steps.set-scenario.outputs.scenario_name }}
env:
ANSIBLE_FORCE_COLOR: '1'