-
Notifications
You must be signed in to change notification settings - Fork 29
110 lines (95 loc) · 5.09 KB
/
mamonsu-tests-dev.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
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
name: Mamonsu DEV
on:
push:
branches:
- dev
paths-ignore:
- 'README.md'
- 'documentation/**'
- 'examples/**'
- 'packaging/conf/**'
pull_request:
branches:
- dev
paths-ignore:
- 'README.md'
- 'documentation/**'
- 'examples/**'
- 'packaging/conf/**'
jobs:
mamonsu-tests:
runs-on: ubuntu-20.04
env:
DOCKER_COMPOSE_VERSION: '1.29.2'
MAMONSU_PATH: '/home/runner/work/mamonsu/mamonsu/'
strategy:
matrix:
docker_os: ['centos:7', 'centos:8']
zabbix_version: ['6.2.9']
pg_version: ['12', '13', '14', '15']
include:
- docker_os: 'centos:8'
pg_version: '16'
zabbix_version: '6.2.9'
- docker_os: 'centos:8'
pg_version: '16'
zabbix_version: '6.4.13'
exclude:
- docker_os: 'centos:8'
pg_version: '12'
- docker_os: 'centos:8'
pg_version: '13'
- docker_os: 'centos:8'
pg_version: '14'
- docker_os: 'centos:8'
pg_version: '15'
steps:
- name: Checkout mamonsu repo
uses: actions/checkout@v1
- name: Install docker-compose
run: sudo apt-get update
- run: sudo rm -f /usr/local/bin/docker-compose
- run: curl -L https://github.com/docker/compose/releases/download/${{ env.DOCKER_COMPOSE_VERSION }}/docker-compose-`uname -s`-`uname -m` > docker-compose
- run: chmod +x docker-compose
- run: sudo mv docker-compose /usr/local/bin
- name: Set up docker environment variables
run: echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -s devicemapper"' | sudo tee /etc/default/docker > /dev/null
- run: sudo service docker restart
- run: sleep 5
- name: Install docker OS image
run: docker pull ${{ matrix.docker_os }}
- name: Run docker CentOS image
if: "contains(matrix.docker_os, 'centos')"
run: docker run -t -d --name $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) --privileged=true ${{ matrix.docker_os }} /usr/sbin/init
- name: Run docker Ubuntu image
if: contains(matrix.docker_os, 'ubuntu')
run: docker run -t -d --name $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) --privileged=true ${{ matrix.docker_os }}
- name: Install Zabbix ${{ matrix.zabbix_version }} on VM
run: bash ./github-actions-tests/zbx_install.sh --zbx-version="${{ matrix.zabbix_version }}"
- name: Retrieve Zabbix address
run: |
echo "zabbix_address=$(hostname -I | awk '{print $1}')" >> $GITHUB_OUTPUT
id: zabbix_address
- name: Edit Zabbix address in agent.conf
run: sed -i "s/\(address *= *\).*/\1 ${{ steps.zabbix_address.outputs.zabbix_address }}/" ${{ env.MAMONSU_PATH }}/github-actions-tests/sources/agent_3.5.7.conf
- name: Copy test scripts to container
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) mkdir -p -m 755 /mamonsu/
- run: docker cp . $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ):/mamonsu
- name: Install prerequisites
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/tests.sh --os="${{ matrix.docker_os }}" --pg-version="${{ matrix.pg_version }}"
- name: Build and install mamonsu
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/mamonsu_build.sh --os="${{ matrix.docker_os }}" --pg-version="${{ matrix.pg_version }}"
- name: Test MAMONSU BOOTSTRAP
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/tools/bootstrap.sh
- name: Test MAMONSU AGENT
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/tools/agent.sh
- name: Test MAMONSU REPORT
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/tools/report.sh
- name: Test MAMONSU EXPORT
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/tools/export.sh --pg-version="${{ matrix.pg_version }}"
- name: Test MAMONSU ZABBIX CLI
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/tools/zabbix_cli.sh --zbx-address="${{ steps.zabbix_address.outputs.zabbix_address }}" --zbx-version="${{ matrix.zabbix_version }}"
- name: Test mamonsu metrics on master
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/metrics.sh --pg-version="${{ matrix.pg_version }}" --os="${{ matrix.docker_os }}"
- name: Test Mamonsu removal
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/mamonsu_removal.sh --os="${{ matrix.docker_os }}"