Skip to content

Fix Admin-UI management bugs #6318

Fix Admin-UI management bugs

Fix Admin-UI management bugs #6318

Workflow file for this run

name: CI
on:
push:
branches:
- develop
- "[0-9].x"
pull_request:
env:
PHP_VERSION: 8.3
CYPRESS_PROJECT_ID: w8t3fx
jobs:
backend:
name: Backend
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432
mariadb:
image: mariadb:11
ports:
- 3306
env:
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Verify MariaDB connection
env:
PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
sleep 1
done
- name: Verify Postgres connection
env:
PORT: ${{ job.services.postgres.ports[5432] }}
run: |
while ! pg_isready -h"127.0.0.1" -p"$PORT" > /dev/null 2> /dev/null; do
sleep 1
done
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install pv mariadb-client
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ env.PHP_VERSION }}
extensions: bcmath, ctype, fileinfo, json, mbstring, dom, ldap, pdo, tokenizer, xml, mysql, sqlite
coverage: pcov
- name: Copy .env
run: php -r "copy('.env.ci', '.env');"
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install php dependencies
run: |
composer self-update
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Migrate Database
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mariadb.ports[3306] }}
DB_DATABASE: test
DB_USERNAME: root
DB_PASSWORD: password
run: php artisan migrate --no-interaction -vvv --force
- name: Execute code style check via Laravel Pint
run: vendor/bin/pint --test -v
- name: Execute tests (Unit and Feature tests) via PHPUnit
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mariadb.ports[3306] }}
DB_DATABASE: test
DB_USERNAME: root
DB_PASSWORD: password
LOG_CHANNEL: stack
run: php artisan test --parallel --testsuite=Unit,Feature --coverage-clover=coverage.xml
- name: Execute tests (Unit, Feature and Integration tests) via PHPUnit
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }}
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mariadb.ports[3306] }}
DB_DATABASE: test
DB_USERNAME: root
DB_PASSWORD: password
LOG_CHANNEL: stack
BBB_TEST_SERVER_HOST: ${{ secrets.BBB_TEST_SERVER_HOST }}
BBB_TEST_SERVER_SECRET: ${{ secrets.BBB_TEST_SERVER_SECRET }}
run: php artisan test --parallel --testsuite=Unit,Feature --coverage-clover=coverage.xml
- name: Execute tests (Unit and Feature tests) via PHPUnit using Postgres
env:
DB_CONNECTION: pgsql
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.postgres.ports[5432] }}
DB_DATABASE: test
DB_USERNAME: user
DB_PASSWORD: password
LOG_CHANNEL: stack
run: php artisan test --parallel --testsuite=Unit,Feature
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
- name: Upload laravel logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: laravel.log
path: storage/logs/laravel.log
frontend-code-style-check:
name: Frontend Code Style Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy .env
run: php -r "copy('.env.example', '.env');"
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v4
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Check code formatting
run: npm run prettier
- name: Linting
run: npm run lint
docker-build:
name: Docker Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export
uses: docker/build-push-action@v6
with:
file: docker/app/Dockerfile
context: .
load: true
tags: pilos:latest
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=docker,dest=/tmp/pilos-image.tar
build-args: |
VITE_COVERAGE=true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pilos-image
path: /tmp/pilos-image.tar
frontend-tests:
name: Frontend Tests
runs-on: ubuntu-latest
needs: docker-build
strategy:
# don't fail the entire matrix on failure
fail-fast: false
matrix:
# run copies of the current job in parallel
containers: [1, 2, 3, 4, 5]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: pilos-image
path: /tmp
- name: Load image
run: |
docker load --input /tmp/pilos-image.tar
- name: Copy .env
run: docker run --rm pilos:latest cat ./.env.ci > .env
- name: Generate key
run: |
docker run --rm \
--mount type=bind,source=${{ github.workspace }}/.env,target=/var/www/html/.env \
--entrypoint /bin/bash \
pilos:latest \
-c "chown www-data:www-data .env && pilos-cli key:generate"
- name: Adjust .env
run: |
sed -i 's/CONTAINER_IMAGE=.*/CONTAINER_IMAGE=pilos:latest/g' .env
sed -i 's|APP_URL=.*|APP_URL=http://localhost:9080|g' .env
sed -i 's|BBB_TEST_SERVER_HOST=.*|BBB_TEST_SERVER_HOST=${{ secrets.BBB_TEST_SERVER_HOST }}|g' .env
sed -i 's|BBB_TEST_SERVER_SECRET=.*|BBB_TEST_SERVER_SECRET=${{ secrets.BBB_TEST_SERVER_SECRET }}|g' .env
- name: Start app
run: docker compose -f compose.test.yml -f compose.test.ci.yml up -d
- name: Cypress run frontend tests
uses: cypress-io/github-action@v6
with:
wait-on: "http://localhost:9080" # Waits for above
group: "Frontend tests"
parallel: true
record: true
tag: ${{ github.event_name }}
env:
CYPRESS_PROJECT_ID: ${{ env.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}
APP_URL: "http://localhost:9080"
TZ: "America/New_York"
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-screenshots
path: tests/Frontend/screenshots
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
directory: coverage
system-tests:
name: System Tests
runs-on: ubuntu-latest
needs: docker-build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: pilos-image
path: /tmp
- name: Load image
run: |
docker load --input /tmp/pilos-image.tar
docker image ls -a
- name: Copy .env
run: docker run --rm pilos:latest cat ./.env.ci > .env
- name: Generate key
run: |
docker run --rm \
--mount type=bind,source=${{ github.workspace }}/.env,target=/var/www/html/.env \
--entrypoint /bin/bash \
pilos:latest \
-c "chown www-data:www-data .env && pilos-cli key:generate"
- name: Adjust .env
run: |
sed -i 's/CONTAINER_IMAGE=.*/CONTAINER_IMAGE=pilos:latest/g' .env
sed -i 's|APP_URL=.*|APP_URL=http://localhost:9080|g' .env
sed -i 's|BBB_TEST_SERVER_HOST=.*|BBB_TEST_SERVER_HOST=${{ secrets.BBB_TEST_SERVER_HOST }}|g' .env
sed -i 's|BBB_TEST_SERVER_SECRET=.*|BBB_TEST_SERVER_SECRET=${{ secrets.BBB_TEST_SERVER_SECRET }}|g' .env
- name: Start app
run: docker compose -f compose.test.yml -f compose.test.ci.yml up -d
- name: Cypress run system tests
uses: cypress-io/github-action@v6
with:
wait-on: "http://localhost:9080" # Waits for above
group: "System tests"
record: true
tag: ${{ github.event_name }}
project: ./tests/System
env:
CYPRESS_PROJECT_ID: ${{ env.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}
APP_URL: "http://localhost:9080"
TZ: "America/New_York"
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-screenshots
path: tests/System/screenshots