-
Notifications
You must be signed in to change notification settings - Fork 16
63 lines (59 loc) · 2.28 KB
/
integration_sender.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
name: sender
run-name: Zabbix sender integration test
on:
push:
branches: [main]
paths:
- '**sender.py'
pull_request:
branches: [main]
paths:
- '**sender.py'
workflow_dispatch:
env:
ZABBIX_VERSION: '6.0'
ZABBIX_BRANCH: master
CONFIG_PATH: .github/configs/
SYNC_FILE: integration_sender_test.py
ASYNC_FILE: integration_aiosender_test.py
jobs:
integration:
name: Integration test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install packages
run: |
sudo wget https://repo.zabbix.com/zabbix/${{ env.ZABBIX_VERSION }}/ubuntu/pool/main/z/zabbix-release/zabbix-release_${{ env.ZABBIX_VERSION }}-4+ubuntu22.04_all.deb
sudo dpkg -i zabbix-release_${{ env.ZABBIX_VERSION }}-4+ubuntu22.04_all.deb
sudo apt update && sudo apt install -y zabbix-proxy-sqlite3
- name: Prepare environment
run: |
sudo mkdir -p /var/log/zabbix/
sudo chown -R zabbix. /var/log/zabbix/
sudo sed -i 's#DBName=zabbix_proxy#DBName=/tmp/proxy.db#' /etc/zabbix/zabbix_proxy.conf
- name: Start Zabbix proxy
run: |
sudo zabbix_proxy -c /etc/zabbix/zabbix_proxy.conf
- name: Install python3
run: |
sudo apt-get install -y python3 python3-pip python-is-python3
pip install -r ./requirements.txt
- name: Integration synchronous test
continue-on-error: true
run: |
python ./.github/scripts/$SYNC_FILE 2>/tmp/integration_sync.log >/dev/null
- name: Integration asynchronous test
continue-on-error: true
run: |
python ./.github/scripts/$ASYNC_FILE 2>/tmp/integration_async.log >/dev/null
- name: Send report
env:
TBOT_TOKEN: ${{ secrets.TBOT_TOKEN }}
TBOT_CHAT: ${{ vars.TBOT_CHAT }}
SUBJECT: Zabbix sender integration test FAIL
run: |
err=0
tail -n1 /tmp/integration_sync.log | grep "OK" 1>/dev/null || tail /tmp/integration_sync.log | python ./.github/scripts/telegram_msg.py 2>/dev/null | err=1
tail -n1 /tmp/integration_async.log | grep "OK" 1>/dev/null || tail /tmp/integration_async.log | python ./.github/scripts/telegram_msg.py 2>/dev/null | err=1
if [ "$err" = 1 ]; then exit 1; fi