-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (54 loc) · 1.78 KB
/
molecule-test.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
62
63
64
65
# https://thedatabaseme.de/2022/01/17/automated-testing-your-ansible-role-with-molecule-and-github-actions/
name: Molecule pipeline test
on:
push:
branches-ignore:
- "master"
tags-ignore:
- "*"
pull_request:
pull_request_review:
jobs:
molecule:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Better to use one scenario per OS for faster performance and easier debugging
scenario:
- ubuntu-2004
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: "${{ github.repository }}"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies.
run: |
python3 -m pip install --upgrade pip
python3 -m pip install yamllint ansible-lint ansible "molecule[lint,docker]"
- name: Install Galaxy dependencies.
run: ansible-galaxy collection install community.docker
- name: check molecule version
run: molecule --version
- name: Run molecule converge
run: "molecule converge --scenario-name ${{ matrix.scenario }}"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
working-directory: "${{ github.repository }}"
- name: Run molecule syntax
run: "molecule syntax --scenario-name ${{ matrix.scenario }}"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
working-directory: "${{ github.repository }}"
- name: Run molecule idempotence
run: "molecule idempotence --scenario-name ${{ matrix.scenario }}"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
working-directory: "${{ github.repository }}"