-
-
Notifications
You must be signed in to change notification settings - Fork 404
226 lines (190 loc) · 8.38 KB
/
syntax.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# +-------------------------------------------------------------------------+
# | Copyright (C) 2004-2024 The Cacti Group |
# | |
# | This program is free software; you can redistribute it and/or |
# | modify it under the terms of the GNU General Public License |
# | as published by the Free Software Foundation; either version 2 |
# | of the License, or (at your option) any later version. |
# | |
# | This program is distributed in the hope that it will be useful, |
# | but WITHOUT ANY WARRANTY; without even the implied warranty of |
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# | GNU General Public License for more details. |
# +-------------------------------------------------------------------------+
# | Cacti: The Complete RRDtool-based Graphing Solution |
# +-------------------------------------------------------------------------+
# | This code is designed, written, and maintained by the Cacti Group. See |
# | about.php and/or the AUTHORS file for specific developer information. |
# +-------------------------------------------------------------------------+
# | http://www.cacti.net/ |
# +-------------------------------------------------------------------------+
name: Cacti Commit Audit
on:
push:
branches: [ 1.2.x, develop ]
pull_request:
branches: [ 1.2.x, develop ]
permissions:
contents: read
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] #ubuntu-20.04.04 currently
php: ['8.0', '8.1', '8.2']
experimental: [false]
services:
mysql:
image: mysql:latest
env:
MYSQL_DATABASE: cacti
MYSQL_HOST: 127.0.0.1
MYSQL_USER: cactiuser
MYSQL_PASSWORD: cactiuser
MYSQL_ROOT_PASSWORD: cactiroot
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
name: PHP ${{ matrix.php }} Test on ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl, mysql, gd, ldap, gmp, xml, curl, json, mbstring #optional
ini-values: "post_max_size=256M, max_execution_time=60, date.timezone=America/New_York" #optional
- name: Check PHP version
run: php -v
- name: Checkout Thold Plugin
uses: GuillaumeFalourd/clone-github-repo-action@v2
with:
owner: 'Cacti'
repository: 'plugin_thold'
- name: Checkout Monitor Plugin
uses: GuillaumeFalourd/clone-github-repo-action@v2
with:
owner: 'Cacti'
repository: 'plugin_monitor'
- name: Checkout MacTrack Plugin
uses: GuillaumeFalourd/clone-github-repo-action@v2
with:
owner: 'Cacti'
repository: 'plugin_mactrack'
- name: Checkout FlowView Plugin
uses: GuillaumeFalourd/clone-github-repo-action@v2
with:
owner: 'Cacti'
repository: 'plugin_flowview'
- name: Checkout Audit Plugin
uses: GuillaumeFalourd/clone-github-repo-action@v2
with:
owner: 'Cacti'
repository: 'plugin_audit'
- name: Checkout Syslog Plugin
uses: GuillaumeFalourd/clone-github-repo-action@v2
with:
owner: 'Cacti'
repository: 'plugin_syslog'
- name: Move Plugins to Plugin Directory
run: |
mv plugin_thold ${{ github.workspace }}/plugins/thold
mv plugin_monitor ${{ github.workspace }}/plugins/monitor
mv plugin_mactrack ${{ github.workspace }}/plugins/mactrack
mv plugin_audit ${{ github.workspace }}/plugins/audit
mv plugin_flowview ${{ github.workspace }}/plugins/flowview
mv plugin_syslog ${{ github.workspace }}/plugins/syslog
# With syslog we have to enable batch installs using the lines below
cd ${{ github.workspace }}/plugins/syslog
cp -p config.php.dist config.php
sed -i 's/\/\/\$syslog_install_options/\$syslog_install_options/g' config.php
- name: Check PHP syntax
run: if find ${{ github.workspace }} -name '*.php' -exec php -l {} 2>&1 \; | grep -iv 'no syntax errors detected'; then exit 1; fi
- name: Install php-fpm
env:
version: ${{ matrix.php }}
run: |
sudo service php$version-fpm start
sudo service php$version-fpm status
- name: Test php-fpm
env:
version: ${{ matrix.php }}
run: |
# Copy php-fpm to a directory in PATH
sudo cp /usr/sbin/php-fpm$version /usr/bin/php-fpm
php-fpm -v
- name: Install Apache and tools
run: sudo apt-get install apache2 snmp rrdtool fping
- name: Enable Proxy FCGI
run: sudo a2enmod proxy_fcgi setenvif actions alias
- name: Configure Apache Site
run: |
cat ${{ github.workspace }}/tests/tools/cacti.conf | sed -r 's#GITHUB_WORKSPACE#${{ github.workspace }}#g' > /tmp/cacti.conf
sudo cp /tmp/cacti.conf /etc/apache2/sites-available/000-default.conf
- name: Open permissions for testing purposes
run: sudo chmod -R 777 ${{ github.workspace}}
- name: Restart Apache2
run: sudo systemctl restart apache2
- name: Create and Initialize Database
env:
MYSQL_AUTH_USR: '--defaults-file=~/.my.cnf'
run: |
echo -e "[client]\nuser = root\npassword = cactiroot\nhost = 127.0.0.1\n" >> ~/.my.cnf
cat ~/.my.cnf
mysql $MYSQL_AUTH_USR -e 'CREATE DATABASE IF NOT EXISTS cacti;'
mysql $MYSQL_AUTH_USR -e "CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'cactiuser';"
mysql $MYSQL_AUTH_USR -e "GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';"
mysql $MYSQL_AUTH_USR -e "FLUSH PRIVILEGES;"
mysql $MYSQL_AUTH_USR cacti < ${{ github.workspace }}/cacti.sql
mysql $MYSQL_AUTH_USR -e "INSERT INTO settings (name, value) VALUES ('path_php_binary', '/bin/php')" cacti
- name: Prime Cacti config.php File
run: |
cat ${{ github.workspace }}/include/config.php.dist | sed -r "s/localhost/127.0.0.1/g" > ${{ github.workspace }}/include/config.php
sudo chmod 777 ${{ github.workspace }}/include/config.php
cat ${{ github.workspace}}/include/config.php
- name: Check install code for validity
run: |
cd ${{ github.workspace }}
sudo php -q tests/tools/check_install_code.php
- name: Check that all CLI scripts have a valid --version flag
run: |
cd ${{ github.workspace }}
sudo bash tests/tools/check_cli_version.sh
- name: Install Cacti through the CLI
run: |
cd ${{ github.workspace }}
sudo php cli/install_cacti.php --accept-eula --install --force
- name: Install and Enable Plugins
run: |
cd ${{ github.workspace }}
sudo php cli/plugin_manage.php --plugin=thold --plugin=monitor --plugin=mactrack --plugin=audit --plugin=flowview --plugin=syslog --install --enable --allperms
- name: Check all pages using recursive wget
run: |
cd ${{ github.workspace }}
echo -e "[client]\nuser = root\npassword = cactiroot\nhost = 127.0.0.1\n" > ${{ github.workspace }}/.my.cnf
sudo tests/tools/check_all_pages.sh
- name: View contents of logs
run: sudo cat ${{ github.workspace }}/log/cacti.log
# - name: Validate composer.json and composer.lock
# run: composer validate --strict
# - name: Cache Composer packages
# id: composer-cache
# uses: actions/cache@v3
# with:
# path: vendor
# key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
# restore-keys: |
# ${{ runner.os }}-php-
#
# - name: Install dependencies
# run: composer install --prefer-dist --no-progress
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md
# - name: Run test suite
# run: composer run-script test