Skip to content

487 fork research login with m365 #365

487 fork research login with m365

487 fork research login with m365 #365

Workflow file for this run

name: run-tests
on:
push:
branches:
- master
- fork6
pull_request: ~
workflow_dispatch: ~
jobs:
phpunit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [8.1, 8.2]
testsuite: ["functional", "unit", "installer"]
name: PHPUnit - ${{ matrix.testsuite }} (PHP ${{ matrix.php }})
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: forkcms
MYSQL_ROOT_PASSWORD: "kingtriton"
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP with coverage
if: ${{ matrix.php == '8.1' }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, intl, gd, exif, iconv, imagick
coverage: PCOV
- name: Setup PHP without coverage
if: ${{ matrix.php != '8.1' }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, intl, gd, exif, iconv, imagick
coverage: none
- name: Prepare test env
run: |
mysql -h 127.0.0.1 -uroot -pkingtriton -e 'create database forkcms_test'
- name: Install dependencies
env:
APP_ENV: test
run: composer install -o
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 18 # current LTS
- run: npm install
- run: node_modules/.bin/webpack
- name: Execute tests with coverage
if: ${{ matrix.php == '8.1' }}
run: bin/simple-phpunit --testsuite=${{ matrix.testsuite}} --coverage-clover=${{ matrix.testsuite}}.clover
- name: Execute tests without coverage
if: ${{ matrix.php != '8.1' }}
run: bin/simple-phpunit --testsuite=${{ matrix.testsuite}}
- name: Display error logs on failure
if: ${{ failure() }}
run: |
[ -r var/log/installer/debug.log ] && cat var/log/installer/debug.log
[ -r var/log/test/debug.log ] && cat var/log/test/debug.log
[ -r var/log/test_instal/debug.log ] && cat var/log/test_instal/debug.log
[ -r var/log/prod/debug.log ] && cat var/log/prod/debug.log
[ -r var/log/dev/debug.log ] && cat var/log/dev/debug.log
- name: Upload Coverage report
uses: codecov/codecov-action@v1
if: ${{ matrix.php == '8.1' }}
with:
file: ${{ matrix.testsuite}}.clover
flags: ${{ matrix.testsuite}}
phpstan:
name: PHPStan - Static Code Analysis
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: forkcms
MYSQL_ROOT_PASSWORD: "kingtriton"
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, intl, gd, exif, iconv, imagick
coverage: none
- name: Prepare test env
run: |
mysql -h 127.0.0.1 -uroot -pkingtriton -e 'create database forkcms_test'
- name: Install dependencies
run: composer install -o
env:
APP_ENV: dev
- name: Install Fork CMS
run: mv src/Modules/Installer/tests/fork-cms-installation-configuration.yaml fork-cms-installation-configuration.yaml && bin/console forkcms:installer:install && bin/console cache:clear
env:
APP_ENV: dev
APP_DEBUG: 1
- name: Run PHPStan
run: bin/phpstan analyze --error-format table src
php-code-sniffer:
name: PHP Code Sniffer
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-php-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, intl, gd, exif, iconv, imagick
coverage: none
- name: Install dependencies
run: composer install -o
- name: Run PHP Codesniffer
run: bin/phpcs --standard=PSR12 --extensions=php --warning-severity=9 --exclude=Generic.Files.LineLength --report=full --ignore=*/tests/*,*/*.tpl.php "src"
frontend:
name: npm test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 18 # current LTS
- run: npm install
- run: npm test
docker-test:
continue-on-error: true
name: Docker
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-php-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, intl, gd, exif, iconv, imagick
coverage: none
# We need to have a vendor folder locally, as the whole root folder gets mounted as volume via docker-compose.
# Alternatively, you can define a named volume for the vendor folder path in docker-compose.
- name: Install dependencies
run: composer install -o
- name: Build Docker image
run: |
docker pull ghcr.io/forkcms/forkcms:latest || true
docker-compose build
- name: Start docker-compose stack
run: |
docker-compose up -d
docker run --rm --network=forkcms_default jwilder/dockerize -wait tcp://db6:3306 -timeout 300s
docker-compose ps "db6" | grep -q "Up"
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 18 # current LTS
- run: npm install
- run: node_modules/.bin/webpack
- name: Test
run: |
curl -s -L -o /dev/null -w "%{http_code}" http://localhost:80 | grep -q '200'
curl -s -L http://localhost:80 | grep -q 'Install Fork CMS'
- name: Display error logs on failure
if: ${{ failure() }}
run: docker ps && docker-compose logs
- name: Cleanup
if: always()
run: docker-compose down -v