HTTP Access Log Combined monitoring (#16247) #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
branches: | |
- 'master' | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- | |
php-version: 8.2 | |
name: Unit | |
skip-web-check: 1 | |
database: mariadb:10.5 | |
- | |
php-version: 8.1 | |
name: Unit | |
skip-web-check: 1 | |
database: mysql:8.0 | |
- | |
php-version: 8.1 | |
name: Web | |
skip-unit-check: 1 | |
database: mariadb:10.11 | |
services: | |
database: | |
image: ${{ matrix.database }} | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: librenms_phpunit_78hunjuybybh | |
MYSQL_USER: librenms | |
MYSQL_PASSWORD: librenms | |
ports: | |
- 3306 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- | |
name: Set $FILES | |
run: | | |
FILES=$(git diff --diff-filter=d --name-only origin/master | tr '\n' ' '|sed 's/,*$//g') | |
echo $FILES | |
echo 'FILES<<EOF' >> $GITHUB_ENV | |
echo $FILES >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- | |
name: Set $PATH | |
run: | | |
echo "/home/runner/.local/bin/" >> $GITHUB_PATH | |
- | |
name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
tools: composer,php-cs-fixer | |
coverage: none | |
- | |
name: Get composer cache directory | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- | |
name: Cache composer | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ secrets.CACHE_VERSION }}- | |
- | |
name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ secrets.CACHE_VERSION }}- | |
- | |
name: Install packages | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get install -y fping python3-pip python3-setuptools snmp sqlite3 | |
- | |
name: Pip install | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --upgrade --user pylint python-memcached mysqlclient | |
- | |
name: Composer validate | |
run: | | |
composer validate | |
- | |
name: Init env | |
run: | | |
cat > .env <<EOL | |
APP_KEY=base64:vHI+YHgkyCDad31iPEErGSNEOWO21wNzV+zyENKQv04= | |
APP_URL=http://127.0.0.1:8000 | |
APP_ENV=testing | |
DB_DRIVER=mysql | |
DB_HOST=127.0.0.1 | |
DB_PORT=${{ job.services.database.ports[3306] }} | |
DB_DATABASE=librenms_phpunit_78hunjuybybh | |
DB_USERNAME=librenms | |
DB_PASSWORD=librenms | |
DB_TEST_DRIVER=mysql | |
DB_TEST_HOST=127.0.0.1 | |
DB_TEST_PORT=${{ job.services.database.ports[3306] }} | |
DB_TEST_DATABASE=librenms_phpunit_78hunjuybybh | |
DB_TEST_USERNAME=librenms | |
DB_TEST_PASSWORD=librenms | |
EOL | |
- | |
name: Composer install | |
run: | | |
composer install --prefer-dist --no-interaction --no-progress | |
- | |
name: Snmpsim setup | |
run: | | |
php lnms dev:simulate --setup-venv | |
- | |
name: Start ChromeDriver | |
if: matrix.skip-web-check != '1' | |
run: | | |
$CHROMEWEBDRIVER/chromedriver --port=9515 & | |
- | |
name: Copy seeded config | |
run: cp "${GITHUB_WORKSPACE}/tests/testing_config.yaml" "${GITHUB_WORKSPACE}/database/seeders/config/" | |
- | |
name: Ensure MySQL is up | |
env: | |
PORT: ${{ job.services.database.ports[3306] }} | |
run: | | |
mysqladmin -h"127.0.0.1" -P"$PORT" --user=librenms --password=librenms ping --wait=5 | |
- | |
name: Set MySQL authentication plugin | |
if: matrix.database == 'mysql:8.0' | |
env: | |
PORT: ${{ job.services.database.ports[3306] }} | |
run: | | |
mysql -h"127.0.0.1" -P"$PORT" --user=root -e "ALTER USER 'librenms'@'%' IDENTIFIED WITH mysql_native_password BY 'librenms'" | |
- | |
name: Set MySQL collate | |
env: | |
PORT: ${{ job.services.database.ports[3306] }} | |
run: | | |
mysql -h"127.0.0.1" -P"$PORT" --user=librenms --password=librenms -e 'ALTER DATABASE librenms_phpunit_78hunjuybybh CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' | |
- | |
name: Setup SQLite | |
run: sqlite3 database/testing.sqlite "" | |
- | |
name: Artisan serve | |
if: matrix.skip-web-check != '1' | |
run: | | |
php artisan serve --env=dusk.testing >/tmp/artisan-serve.log 2>&1 & | |
sleep 5 | |
- | |
name: Start SNMP | |
if: matrix.skip-unit-check != '1' | |
run: | | |
.python_venvs/snmpsim/bin/snmpsim-command-responder-lite --data-dir=tests/snmpsim --agent-udpv4-endpoint=127.1.6.2:1162 --log-level=error --logging-method=file:/tmp/snmpsimd.log & | |
- | |
name: lnms dev:check ci | |
run: | | |
php lnms dev:check ci | |
env: | |
SKIP_UNIT_CHECK: ${{ matrix.skip-unit-check }} | |
SKIP_WEB_CHECK: ${{ matrix.skip-web-check }} | |
- | |
name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v2 | |
- | |
name: Dump serve logs | |
if: always() && matrix.skip-web-check != '1' | |
run: | | |
cat /tmp/artisan-serve.log || true | |
- | |
name: Dump snmp logs | |
if: failure() && matrix.skip-unit-check != '1' | |
run: | | |
cat /tmp/snmpsimd.log || true | |
- | |
name: Dump context | |
if: always() | |
uses: crazy-max/ghaction-dump-context@v1 |