Repository navigation
128 lines (111 loc) · 4.79 KB
/
Copy pathci.yml
File metadata and controls
128 lines (111 loc) · 4.79 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: CI
on:
push:
branches:
- main
- feature/**
pull_request:
# Least privilege: nothing here writes to the repository. Actions are pinned
# to commit SHAs (a tag can be moved; a SHA cannot) and kept current by
# Dependabot -- see .github/dependabot.yml.
permissions:
contents: read
# A new push supersedes an in-flight run of the same ref.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
# Two ansible-core targets (#47). `latest` is requirements-dev.txt as written.
# `floor` is the minimum declared in meta/runtime.yml, on the oldest Python
# the README supports -- both 2.16 failures that reached users (#45, #49)
# passed a CI that only ever ran the newest core. See docs/testing.md.
#
# Job names are what branch protection requires, so the latest-core jobs keep
# the exact names they have always had ("validate", "molecule (<scenario>)")
# and the floor jobs are added beside them under their own names.
jobs:
validate:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- name: validate
tooling: latest
python-version: "3.12"
- name: validate (ansible-core 2.16)
tooling: floor
python-version: "3.10"
env:
ANSIBLE_LOCAL_TEMP: .ansible/tmp
ANSIBLE_REMOTE_TEMP: .ansible/tmp
ANSIBLE_HOME: .ansible
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install validation tooling
env:
TOOLING: ${{ matrix.tooling }}
run: |
./.github/scripts/install-tooling.sh "$TOOLING"
./.github/scripts/install-collections.sh "$TOOLING"
- name: Symlink repository as the sameeralam3127.linux_vitals collection
run: |
mkdir -p .dev-collections/ansible_collections/sameeralam3127
ln -sfn "$GITHUB_WORKSPACE" .dev-collections/ansible_collections/sameeralam3127/linux_vitals
- name: Run playbook syntax check
run: ansible-playbook playbooks/healthcheck.yml --syntax-check
- name: Run ansible-lint
run: ansible-lint roles/ playbooks/ molecule/ demo/
- name: Run pytest template checks
run: pytest -q
molecule:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
needs: validate
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
# One scenario per supported distribution family on the latest core;
# see docs/testing.md. The floor runs one scenario: the 2.16 failures
# so far were core failures, not distribution failures, and Rocky
# stands in for the RHEL estates most likely to sit on an older core.
include:
- {name: "molecule (ubuntu)", scenario: ubuntu, tooling: latest, python-version: "3.12"}
- {name: "molecule (rocky)", scenario: rocky, tooling: latest, python-version: "3.12"}
- {name: "molecule (fedora)", scenario: fedora, tooling: latest, python-version: "3.12"}
- {name: "molecule (opensuse)", scenario: opensuse, tooling: latest, python-version: "3.12"}
- {name: "molecule (debian)", scenario: debian, tooling: latest, python-version: "3.12"}
- {name: "molecule (amazonlinux)", scenario: amazonlinux, tooling: latest, python-version: "3.12"}
- {name: "molecule (rocky, ansible-core 2.16)", scenario: rocky, tooling: floor, python-version: "3.10"}
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install validation tooling
env:
TOOLING: ${{ matrix.tooling }}
run: |
./.github/scripts/install-tooling.sh "$TOOLING"
./.github/scripts/install-collections.sh "$TOOLING"
- name: Symlink repository as the sameeralam3127.linux_vitals collection
# create.yml maintains this too, but the scenario's dependency step runs
# before create, and a fresh checkout has no symlink at all.
run: |
mkdir -p .dev-collections/ansible_collections/sameeralam3127
ln -sfn "$GITHUB_WORKSPACE" .dev-collections/ansible_collections/sameeralam3127/linux_vitals
- name: Run the ${{ matrix.scenario }} scenario
run: molecule test -s ${{ matrix.scenario }}