| 1 |
--- |
| 2 |
name: "community.zabbix.zabbix_server" |
| 3 |
on: |
| 4 |
push: |
| 5 |
paths: |
| 6 |
- "roles/zabbix_server/**" |
| 7 |
- "molecule/zabbix_server/**" |
| 8 |
- "molecule/requirements.txt" |
| 9 |
- ".github/workflows/server.yml" |
| 10 |
- "roles/zabbix_repo/**" |
| 11 |
pull_request: |
| 12 |
paths: |
| 13 |
- "roles/zabbix_server/**" |
| 14 |
- "molecule/zabbix_server/**" |
| 15 |
- "molecule/requirements.txt" |
| 16 |
- ".github/workflows/server.yml" |
| 17 |
- "roles/zabbix_repo/**" |
| 18 |
jobs: |
| 19 |
molecule: |
| 20 |
runs-on: ubuntu-22.04 |
| 21 |
strategy: |
| 22 |
fail-fast: false |
| 23 |
matrix: |
| 24 |
container: |
| 25 |
- image: rockylinux10 |
| 26 |
- image: rockylinux9 |
| 27 |
- image: rockylinux8 |
| 28 |
ansible_core: ansible-core<2.17 |
| 29 |
- image: ubuntu2404 |
| 30 |
- image: ubuntu2204 |
| 31 |
- image: debian12 |
| 32 |
- image: debian11 |
| 33 |
- image: opensuseleap15 |
| 34 |
ansible_core: ansible-core<2.17 |
| 35 |
collection_role: |
| 36 |
- zabbix_server |
| 37 |
database: |
| 38 |
- mysql |
| 39 |
- pgsql |
| 40 |
version: |
| 41 |
- v74 |
| 42 |
- v72 |
| 43 |
- v70 |
| 44 |
- v60 |
| 45 |
exclude: |
| 46 |
- container: |
| 47 |
image: rockylinux10 |
| 48 |
version: v72 |
| 49 |
- container: |
| 50 |
image: rockylinux10 |
| 51 |
version: v70 |
| 52 |
- container: |
| 53 |
image: rockylinux10 |
| 54 |
version: v60 |
| 55 |
- container: |
| 56 |
image: debian11 |
| 57 |
version: v74 |
| 58 |
- container: |
| 59 |
image: debian11 |
| 60 |
version: v72 |
| 61 |
- container: |
| 62 |
image: debian11 |
| 63 |
version: v70 |
| 64 |
steps: |
| 65 |
- name: Check out code |
| 66 |
uses: actions/checkout@v6 |
| 67 |
|
| 68 |
- name: Set up Python 3.11 |
| 69 |
uses: actions/setup-python@v6 |
| 70 |
with: |
| 71 |
python-version: 3.11 |
| 72 |
|
| 73 |
- name: Install latest pip |
| 74 |
run: python -m pip install --upgrade pip |
| 75 |
|
| 76 |
- name: Install specific version ansible-core |
| 77 |
if: matrix.container.ansible_core != null |
| 78 |
run: pip install "${{ matrix.container.ansible_core }}" |
| 79 |
|
| 80 |
- name: Install dependencies |
| 81 |
run: pip install -r molecule/requirements.txt |
| 82 |
|
| 83 |
- name: Build the collection |
| 84 |
run: | |
| 85 |
# Pin versions to speed up CI |
| 86 |
sed -i 's/ansible\.windows:\s*"\*"/ansible.windows: "2.8.0"/' galaxy.yml |
| 87 |
sed -i 's/ansible\.netcommon:\s*"\*"/ansible.netcommon: "7.2.0"/' galaxy.yml |
| 88 |
sed -i 's/ansible\.posix:\s*"\*"/ansible.posix: "2.0.0"/' galaxy.yml |
| 89 |
sed -i 's/community\.general:\s*"\*"/community.general: "10.5.0"/' galaxy.yml |
| 90 |
sed -i 's/community\.mysql:\s*"\*"/community.mysql: "3.13.0"/' galaxy.yml |
| 91 |
sed -i 's/community\.postgresql:\s*"\*"/community.postgresql: "3.12.0"/' galaxy.yml |
| 92 |
|
| 93 |
collection_file=$( basename $(ansible-galaxy collection build -f | awk -F" " '{print $NF}')) |
| 94 |
echo "COLLECTION_FILE=$collection_file" >> $GITHUB_ENV |
| 95 |
|
| 96 |
- name: Install the collection |
| 97 |
run: ansible-galaxy collection install -vvvv $COLLECTION_FILE |
| 98 |
|
| 99 |
- name: Run role tests |
| 100 |
run: >- |
| 101 |
MY_MOLECULE_CONTAINER=${{ matrix.container.image }} |
| 102 |
MY_MOLECULE_IMAGE=${{ matrix.container.image }} |
| 103 |
MY_MOLECULE_VERSION=${{ matrix.version }} |
| 104 |
MY_MOLECULE_DATABASE=${{ matrix.database }} |
| 105 |
MY_MOLECULE_DOCKER_COMMAND=${{ matrix.command }} |
| 106 |
molecule test -s ${{ matrix.collection_role }} |