mirror of https://github.com/mikaku/Monitorix.git
GitHub Actions
This commit is contained in:
parent
7c86c5d77f
commit
10331bface
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
inputs:
|
||||
packages:
|
||||
description: List of package(s) to install
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Update package information
|
||||
run: apt-get --yes update
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Install package(s)
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: apt-get --yes install ${{ inputs.packages }}
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Run `make install-systemd-all`
|
||||
run: make install-systemd-all
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
inputs:
|
||||
packages:
|
||||
description: List of package(s) to install
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install package(s)
|
||||
run: |
|
||||
pacman --sync --refresh --sysupgrade --noconfirm ${{ inputs.packages }}
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Add /usr/bin/vendor_perl to PATH
|
||||
run: echo "PATH=$PATH:/usr/bin/vendor_perl" >> $GITHUB_ENV
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
inputs:
|
||||
base_url:
|
||||
description: Base URL
|
||||
required: false
|
||||
default: http://0.0.0.0:8080/monitorix
|
||||
cgi_url:
|
||||
description: CGI URL
|
||||
required: false
|
||||
default: http://0.0.0.0:8080/monitorix-cgi/monitorix.cgi
|
||||
image_format:
|
||||
description: Image Format
|
||||
required: false
|
||||
default: PNG
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Update `image_format`
|
||||
run: |
|
||||
sed --in-place \
|
||||
"s/image_format = PNG/image_format = ${{ inputs.image_format }}/g" \
|
||||
/etc/monitorix/monitorix.conf
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Update `httpd_builtin.group`
|
||||
run: |
|
||||
sed --in-place \
|
||||
"s/group = nobody/group = $(groups nobody | cut -d: -f2)/g" \
|
||||
/etc/monitorix/monitorix.conf
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Start `Monitorix`
|
||||
run: |
|
||||
monitorix -c /etc/monitorix/monitorix.conf -p monitorix.pid
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Wait for `Monitorix`
|
||||
run: |
|
||||
while ! curl --fail "${{ inputs.cgi_url }}" &> /dev/null
|
||||
do
|
||||
sleep 5
|
||||
done
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Curl `index.html`
|
||||
run: |
|
||||
curl --silent "${{ inputs.base_url }}/index.html"
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Curl `monitorix.cgi`
|
||||
run: |
|
||||
curl --silent "${{ inputs.cgi_url }}?mode=localhost&graph=all&when=1day"
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Curl `imgs/system1z.1day.*`
|
||||
run: |
|
||||
format="${{ inputs.image_format }}"
|
||||
suffix="${format,,}"
|
||||
curl --silent "${{ inputs.base_url }}/imgs/system1z.1day.${suffix}"
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Kill `Monitorix`
|
||||
run: |
|
||||
kill $(cat monitorix.pid)
|
||||
rm --force monitorix.pid
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
inputs:
|
||||
dependencies:
|
||||
description: List of package(s) to pre-install
|
||||
required: false
|
||||
groups:
|
||||
description: List of group(s) to install
|
||||
required: false
|
||||
packages:
|
||||
description: List of package(s) to install
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Cache `DNF` / `YUM`
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
/var/cache/dnf
|
||||
/var/lib/dnf
|
||||
/var/cache/yum
|
||||
key: ${{ matrix.image }}-yum-dnf
|
||||
|
||||
- name: Install dependency package(s)
|
||||
run: |
|
||||
if [ -n "${{ inputs.dependencies }}" ]; then
|
||||
yum --assumeyes install ${{ inputs.dependencies }}
|
||||
fi
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Install group(s)
|
||||
run: |
|
||||
if [ -n '${{ inputs.groups }}' ]; then
|
||||
yum --assumeyes groups install ${{ inputs.groups }}
|
||||
fi
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
||||
|
||||
- name: Install package(s)
|
||||
run: yum --assumeyes --skip-broken install ${{ inputs.packages }}
|
||||
shell: bash --noprofile --norc -euxo pipefail {0}
|
|
@ -0,0 +1,155 @@
|
|||
---
|
||||
name: Syntax Check, Install & Test
|
||||
|
||||
on:
|
||||
- pull_request
|
||||
- push
|
||||
|
||||
jobs:
|
||||
syntax-check-install-test:
|
||||
name: ${{ matrix.image }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
image:
|
||||
- archlinux:latest
|
||||
- centos:7
|
||||
- almalinux:8
|
||||
- rockylinux:8
|
||||
- debian:10
|
||||
- debian:11
|
||||
- fedora:34
|
||||
- fedora:35
|
||||
- ubuntu:20.04
|
||||
- ubuntu:21.10
|
||||
fail-fast: false
|
||||
container:
|
||||
image: ${{ matrix.image }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Dependencies (Arch Linux)
|
||||
uses: ./.github/actions/pacman/install
|
||||
with:
|
||||
packages: ${{ env.archlinux-dependencies }}
|
||||
if: |
|
||||
startsWith(matrix.image, 'archlinux:')
|
||||
|
||||
- name: Install Dependencies (AlmaLinux/CentOS/Rocky Linux)
|
||||
uses: ./.github/actions/yum/install
|
||||
with:
|
||||
dependencies: epel-release
|
||||
groups: ${{ env.almalinux-centos-rockylinux-group-dependencies }}
|
||||
packages: ${{ env.almalinux-centos-rockylinux-dependencies }}
|
||||
if: |
|
||||
startsWith(matrix.image, 'almalinux:') ||
|
||||
startsWith(matrix.image, 'centos:') ||
|
||||
startsWith(matrix.image, 'rockylinux:')
|
||||
|
||||
- name: Install Dependencies (Debian/Ubuntu)
|
||||
uses: ./.github/actions/apt-get/install
|
||||
with:
|
||||
packages: ${{ env.debian-ubuntu-dependencies }}
|
||||
if: |
|
||||
startsWith(matrix.image, 'debian:') ||
|
||||
startsWith(matrix.image, 'ubuntu:')
|
||||
|
||||
- name: Install Dependencies (Fedora)
|
||||
uses: ./.github/actions/yum/install
|
||||
with:
|
||||
groups: ${{ env.fedora-group-dependencies }}
|
||||
packages: ${{ env.fedora-dependencies }}
|
||||
if: |
|
||||
startsWith(matrix.image, 'fedora:')
|
||||
|
||||
- name: Install Perl Modules
|
||||
run: |
|
||||
cpanm --notest install ${{ env.perl-modules }}
|
||||
|
||||
- name: Check syntax
|
||||
env:
|
||||
PERL5LIB: lib
|
||||
run: |
|
||||
for FILE in monitorix monitorix.cgi lib/*.pm
|
||||
do
|
||||
perl -Mstrict -Mdiagnostics -cw $FILE
|
||||
done
|
||||
|
||||
- name: Install `Monitorix`
|
||||
uses: ./.github/actions/install
|
||||
|
||||
- name: Test `Monitorix` with `image_format = PNG`
|
||||
uses: ./.github/actions/test
|
||||
with:
|
||||
image_format: PNG
|
||||
timeout-minutes: 5
|
||||
|
||||
- name: Test `Monitorix` with `image_format = SVG`
|
||||
uses: ./.github/actions/test
|
||||
with:
|
||||
image_format: SVG
|
||||
timeout-minutes: 5
|
||||
|
||||
- name: Tar `Monitorix` artifacts
|
||||
run: |
|
||||
echo "image_name=$(echo ${{ matrix.image }} | sed 's/:/-/g')" >> \
|
||||
$GITHUB_ENV
|
||||
tar --create --gzip --verbose --file /tmp/artifacts.tar.gz \
|
||||
/var/lib/monitorix/www \
|
||||
/var/log/monitorix*
|
||||
|
||||
- name: Upload `Monitorix` artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ env.image_name }}
|
||||
path: /tmp/artifacts.tar.gz
|
||||
retention-days: 5
|
||||
|
||||
env:
|
||||
archlinux-dependencies: >-
|
||||
base-devel
|
||||
cpanminus
|
||||
rrdtool
|
||||
almalinux-centos-rockylinux-group-dependencies: >-
|
||||
"Development Tools"
|
||||
almalinux-centos-rockylinux-dependencies: >-
|
||||
expat-devel
|
||||
openssl
|
||||
openssl-devel
|
||||
perl-App-cpanminus
|
||||
rrdtool
|
||||
rrdtool-perl
|
||||
debian-ubuntu-dependencies: >-
|
||||
build-essential
|
||||
cpanminus
|
||||
curl
|
||||
libexpat1-dev
|
||||
librrds-perl
|
||||
libssl-dev
|
||||
openssl
|
||||
rrdtool
|
||||
zlib1g-dev
|
||||
fedora-group-dependencies: >-
|
||||
"C Development Tools and Libraries"
|
||||
"Development Libraries"
|
||||
"Development Tools"
|
||||
fedora-dependencies: >-
|
||||
expat-devel
|
||||
openssl
|
||||
openssl-devel
|
||||
perl-App-cpanminus
|
||||
rrdtool
|
||||
rrdtool-perl
|
||||
perl-modules: >-
|
||||
Config::General
|
||||
DBI
|
||||
Env
|
||||
FindBin
|
||||
HTTP::Server::Simple
|
||||
IO::Socket::SSL
|
||||
LWP::UserAgent
|
||||
MIME::Lite
|
||||
Net::IP
|
||||
XML::LibXML
|
||||
XML::Simple
|
Loading…
Reference in New Issue