summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/zabbix/.github/workflows/proxy.yml
blob: 5618a06332d75c1041ca6ac91f30735c42d8b801 (plain)
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
---
name: "community.zabbix.zabbix_proxy"
on:
  push:
    paths:
      - "roles/zabbix_proxy/**"
      - "molecule/zabbix_proxy/**"
      - "molecule/requirements.txt"
      - ".github/workflows/proxy.yml"
  pull_request:
    paths:
      - "roles/zabbix_proxy/**"
      - "molecule/zabbix_proxy/**"
      - "molecule/requirements.txt"
      - ".github/workflows/proxy.yml"
jobs:
  molecule:
    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        container:
          - rockylinux9
          - rockylinux8
          - centos7
          - ubuntu2404
          - ubuntu2204
          - ubuntu2004
          - ubuntu1804
          - debian12
          - debian11
          - debian10
        collection_role:
          - zabbix_proxy
        database:
          - mysql
          - pgsql
          - sqlite3
        version:
          - v64
          - v62
          - v60
        exclude:
          - container:
              name: debian12
              base_image: debian:12
              os_family: debian
            version: v62
          - container: ubuntu2404
            version: v62
    steps:
      - name: Check out code
        uses: actions/checkout@v4

      - name: Set up Python 3.9
        uses: actions/setup-python@v5
        with:
          python-version: 3.9

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r molecule/requirements.txt

      - name: Build the collection
        run: |
          # Pin versions to speed up CI
          sed -i 's/ansible\.windows:\s*"\*"/ansible.windows: "2.3.0"/' galaxy.yml
          sed -i 's/ansible\.netcommon:\s*"\*"/ansible.netcommon: "6.1.1"/' galaxy.yml
          sed -i 's/ansible\.posix:\s*"\*"/ansible.posix: "1.5.4"/' galaxy.yml
          sed -i 's/community\.general:\s*"\*"/community.general: "8.6.0"/' galaxy.yml
          sed -i 's/community\.mysql:\s*"\*"/community.mysql: "3.9.0"/' galaxy.yml
          sed -i 's/community\.postgresql:\s*"\*"/community.postgresql: "3.4.0"/' galaxy.yml

          collection_file=$( basename $(ansible-galaxy collection build -f | awk -F" " '{print $NF}'))
          echo "COLLECTION_FILE=$collection_file" >> $GITHUB_ENV

      - name: Install the collection
        run: ansible-galaxy collection install -vvvv $COLLECTION_FILE

      - name: Run role tests
        run: >-
          MY_MOLECULE_CONTAINER=${{ matrix.container.name }}
          MY_MOLECULE_IMAGE=${{ matrix.container.base_image }}
          MY_MOLECULE_OS_FAMILY=${{ matrix.container.os_family }}
          MY_MOLECULE_VERSION=${{ matrix.version }}
          MY_MOLECULE_DATABASE=${{ matrix.database }}
          molecule test -s ${{ matrix.collection_role }}