Skip to content

Add placeholder to server view as a hint to not include /api/ #4781

Add placeholder to server view as a hint to not include /api/

Add placeholder to server view as a hint to not include /api/ #4781

Workflow file for this run

name: CI
on:
push:
branches:
- master
- develop
- '[0-9].x'
pull_request:
env:
PHP_VERSION: 8.3
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
strategy:
fail-fast: false
matrix:
php-versions: ['8.3']
steps:
- name: Checkout
uses: actions/checkout@v3
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 pipe viewer tool
run: |
sudo apt-get update
sudo apt-get install pv
- 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 "::set-output name=dir::$(composer config cache-files-dir)"
- name: Get composer cache keys
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
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
- name: Execute code style check via Laravel Pint
run: vendor/bin/pint --test
- 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@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload laravel logs
uses: actions/upload-artifact@v2
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@v2
- name: Copy .env
run: php -r "copy('.env.example', '.env');"
- name: Get NPM Cache Directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Get NPM Cache Keys
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
node-
- name: Install dependencies
run: npm ci
- name: Execute frontend code style check via eslint
run: npm run lint
frontend-tests:
name: Frontend Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export
uses: docker/build-push-action@v5
with:
file: docker/app/Dockerfile
context: .
load: true
tags: pilos:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- 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_ENV=.*/APP_ENV=production/g' .env
sed -i 's/APP_DEBUG=.*/APP_DEBUG=false/g' .env
cat .env
- name: Start app
run: docker compose -f docker-compose.yml -f docker-compose-ci.yml up -d
- name: Cypress run
uses: cypress-io/github-action@v6
with:
wait-on: 'http://localhost' # Waits for above
record: true
tag: ${{ github.event_name }}
env:
CYPRESS_PROJECT_ID: ${{ secrets.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 }}