-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (77 loc) · 2.44 KB
/
test.yaml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# terraform managed
---
# Inspired on robertdebock (https://github.com/robertdebock) and ericsysmin (https://github.com/ericsysmin) molecule workflow.
name: Ansible Molecule
on:
workflow_dispatch:
pull_request:
schedule:
- cron: '7 4 4 * *'
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: |
test_requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt
- name: lint
run: ansible-lint
env:
# These tell ansible-lint to use github compatible annotation format:
GITHUB_ACTIONS: "true"
GITHUB_WORKFLOW: "{{ github.workflow.name }}"
molecule:
needs:
- lint
runs-on: ubuntu-latest
strategy:
matrix:
system:
- {os: ubuntu, version: jammy-jellyfish}
env:
# allows molecule colors to be passed to GitHub Actions
PY_COLORS: 1
# allows ansible colors to be passed to GitHub Actions
ANSIBLE_FORCE_COLOR: 1
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: |
test_requirements.txt
- name: Install Docker
run: |
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
- name: Install Python requirements
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt
if [[ -f 'role_requirements.txt' ]]; then pip install -r role_requirements.txt; fi
- name: Run role tests
run: |
molecule --version
ansible --version
molecule test
env:
IMAGE_NAME: ${{ matrix.system.os }}-${{ matrix.system.version }}
IMAGE_ID: molecule-${{ matrix.system.os }}-${{ matrix.system.version }}
REGISTRY: quay.io/${{ github.repository_owner }}