Histologe CI #5950
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
# https://help.github.com/en/actions | |
name: Histologe CI | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
schedule: | |
- cron: '0 7 * * *' | |
env: | |
HISTOLOGE_URL: http://localhost:8080 | |
CLAMAV_SOCKET: '/tmp/clamd.socket' | |
CLAMAV_HOST: 127.0.0.1 | |
CLAMAV_PORT: 3310 | |
FEATURE_SCHS_SYNC_EVENT_ENABLE: 1 | |
FEATURE_PERMISSION_AFFECTATION: 1 | |
FEATURE_GRILLE_VISITE: 1 | |
FEATURE_ZONAGE: 1 | |
FEATURE_ENABLE_MENU_HORIZONTALE: 1 | |
jobs: | |
code-quality: | |
name: Histologe (PHP ${{ matrix.php-versions }}) | |
# https://hub.docker.com/_/ubuntu/ | |
runs-on: ubuntu-latest | |
services: | |
# https://docs.docker.com/samples/library/mysql/ | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: false | |
MYSQL_ROOT_PASSWORD: histologe | |
MYSQL_DATABASE: histologe_db | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
# https://hub.docker.com/_/elasticsearch/ | |
strategy: | |
fail-fast: true | |
matrix: | |
php-versions: ['8.3'] | |
steps: | |
- name: 'Start ClamAV daemon (clamd)' | |
uses: toblux/[email protected] | |
with: | |
unix_socket: $CLAMAV_SOCKET | |
tcp_port: $CLAMAV_PORT | |
stream_max_length: 1M | |
db_main: true | |
db_daily: true | |
- name: 'Ping clamd on TCP port $CLAMAV_PORT' | |
run: echo PING | nc $CLAMAV_HOST $CLAMAV_PORT | |
- name: 'Ping clamd using the Unix socket' | |
run: echo PING | nc -U $CLAMAV_SOCKET | |
# https://github.com/actions/checkout (official) | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# https://github.com/shivammathur/setup-php (community) | |
- name: Setup PHP, extensions and composer with shivammathur/setup-php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, iconv, json, mbstring, sockets | |
env: | |
update: true | |
- name: Cache wkthtmltopdf | |
uses: actions/cache@v2 | |
id: cache-wkhtmltopdf | |
with: | |
path: "~/wkhtmltox/" | |
key: ${{ runner.os }}-wkhtmltopdf-${{ hashFiles('**/*.deb') }} | |
- name: Download wkthtmltopdf & dependencies | |
if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true' | |
run: | | |
mkdir ~/wkhtmltox | |
wget -O ~/wkhtmltox/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb | |
wget -O ~/wkhtmltox/xfonts-encodings.deb http://archive.ubuntu.com/ubuntu/pool/main/x/xfonts-encodings/xfonts-encodings_1.0.4-2_all.deb | |
wget -O ~/wkhtmltox/xfonts-utils.deb http://archive.ubuntu.com/ubuntu/pool/main/x/xfonts-utils/xfonts-utils_7.7+6_amd64.deb | |
wget -O ~/wkhtmltox/xfonts-75dpi.deb http://archive.ubuntu.com/ubuntu/pool/universe/x/xfonts-75dpi/xfonts-75dpi_1.0.4+nmu1_all.deb | |
wget -O ~/wkhtmltox/xfonts-base.deb http://archive.ubuntu.com/ubuntu/pool/main/x/xfonts-base/xfonts-base_1.0.4+nmu1_all.deb | |
- name: Install wkhtmltopdf | |
run: | | |
sudo dpkg -i ~/wkhtmltox/xfonts-encodings.deb | |
sudo dpkg -i ~/wkhtmltox/xfonts-utils.deb | |
sudo dpkg -i ~/wkhtmltox/xfonts-75dpi.deb | |
sudo dpkg -i ~/wkhtmltox/xfonts-base.deb | |
sudo dpkg -i ~/wkhtmltox/wkhtmltox.deb | |
- name: Check PHP Version | |
run: php -v | |
- name: NPM install | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- run: npm install --omit=dev | |
- name: Install Symfony Encore | |
run: npm install @symfony/webpack-encore --save-dev | |
- name: NPM build | |
run: npm run build | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
# https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows | |
- name: Cache composer dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: | | |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader | |
composer install --working-dir=tools/php-cs-fixer --no-progress --no-suggest --prefer-dist --optimize-autoloader | |
# https://github.com/symfonycorp/security-checker-action | |
- name: Security check installed dependencies | |
uses: symfonycorp/security-checker-action@v3 | |
- name: Lint twig templates | |
run: php bin/console lint:twig templates/ | |
# https://github.com/phpstan/phpstan | |
- name: Analyse PHP Code (PHPStan) | |
run: vendor/bin/phpstan analyse | |
# https://github.com/FriendsOfPHP/PHP-CS-Fixer | |
- name: Check PHP coding standard (PHP-CS-Fixer) | |
run: composer cs-check | |
- name: Load Doctrine fixtures | |
run: | | |
composer require symfony/orm-pack | |
php bin/console --env=test doctrine:database:create --no-interaction | |
php bin/console --env=test doctrine:migrations:migrate --no-interaction | |
php bin/console --env=test doctrine:fixtures:load --no-interaction | |
env: | |
APP_SECRET: ${{ secrets.APP_SECRET }} | |
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/histologe_db | |
NOTIFICATIONS_EMAIL: [email protected] | |
CONTACT_EMAIL: [email protected] | |
HISTOLOGE_URL: http://localhost:8080 | |
SERVER_NAME: localhost:8080 | |
MAILER_DSN: ${{ secrets.MAILER_DSN_CI }} | |
MAIL_ENABLE: 1 | |
- name: Run tests | |
run: | | |
composer require dama/doctrine-test-bundle:8.2 | |
./vendor/bin/phpunit --stop-on-failure --testdox -d memory_limit=-1 | |
env: | |
APP_SECRET: ${{ secrets.APP_SECRET }} | |
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/histologe_db | |
ADMIN_EMAIL: [email protected] | |
NOTIFICATIONS_EMAIL: [email protected] | |
CONTACT_EMAIL: [email protected] | |
HISTOLOGE_URL: http://localhost:8080 | |
SERVER_NAME: localhost:8080 | |
MAILER_DSN: ${{ secrets.MAILER_DSN_CI }} | |
CRON_ENABLE: 1 | |
MAIL_ENABLE: 1 | |
MAINTENANCE_ENABLE: 0 | |
CLAMAV_STRATEGY: 'clamd_network' | |
CLAMAV_HOST: 127.0.0.1 |