Skip to content

Add matomo tracking for data analysis (#60) #29

Add matomo tracking for data analysis (#60)

Add matomo tracking for data analysis (#60) #29

name: Tests and Deployment
on:
push:
branches:
- master
pull_request:
permissions:
contents: read
packages: read
env:
PHP_VERSION: 8.1
jobs:
php-security-check:
name: PHP Security Checker
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v2
id: cache-db
with:
path: ~/.symfony/cache
key: db
- uses: symfonycorp/security-checker-action@v4
twig-lint:
name: Validate Twig-Templates
runs-on: ubuntu-20.04
steps:
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:v2
ini-values: variables_order=EGPCS, date.timezone=Europe/Berlin
extensions: intl
- uses: actions/checkout@v3
- uses: actions/cache@v2
with:
path: vendor
key: composer-${{ runner.os }}-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json', 'composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-${{ env.PHP_VERSION }}-
composer-${{ runner.os }}-
- run: |
composer install --no-interaction --no-progress --ansi --no-scripts
composer show
- run: bin/console lint:twig templates/
yaml-lint:
name: Validate YAML-Files
runs-on: ubuntu-20.04
steps:
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:v2
ini-values: variables_order=EGPCS, date.timezone=Europe/Berlin
extensions: intl
- uses: actions/checkout@v3
- uses: actions/cache@v2
with:
path: vendor
key: composer-${{ runner.os }}-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json', 'composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-${{ env.PHP_VERSION }}-
composer-${{ runner.os }}-
- run: |
composer install --no-interaction --no-progress --ansi --no-scripts
composer show
- run: bin/console lint:yaml config/
symfony-container-lint:
name: Validate Service-Definitions
runs-on: ubuntu-20.04
steps:
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:v2
ini-values: variables_order=EGPCS, date.timezone=Europe/Berlin
extensions: intl
- uses: actions/checkout@v3
- uses: actions/cache@v2
with:
path: vendor
key: composer-${{ runner.os }}-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json', 'composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-${{ env.PHP_VERSION }}-
composer-${{ runner.os }}-
- run: |
composer install --no-interaction --no-progress --ansi --no-scripts
composer show
- run: bin/console lint:container
doctrine-entities-lint:
name: Validate Doctrine-Schema mapping
runs-on: ubuntu-20.04
steps:
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:v2
ini-values: variables_order=EGPCS, date.timezone=Europe/Berlin
extensions: intl
- uses: actions/checkout@v3
- uses: actions/cache@v2
with:
path: vendor
key: composer-${{ runner.os }}-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json', 'composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-${{ env.PHP_VERSION }}-
composer-${{ runner.os }}-
- run: |
composer install --no-interaction --no-progress --ansi --no-scripts
composer show
- run: bin/console doctrine:schema:validate --skip-sync -vvv --no-interaction
phpunit:
name: PHPUnit
runs-on: ubuntu-20.04
steps:
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:v2
ini-values: variables_order=EGPCS, date.timezone=Europe/Berlin
extensions: intl
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: vendor
key: composer-${{ runner.os }}-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json', 'composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-${{ env.PHP_VERSION }}-
composer-${{ runner.os }}-
- run: |
composer install --no-interaction --no-progress --ansi --no-scripts
composer show
- run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE application_test;' -uroot -proot
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- run: npm ci
- run: npm run build
- run: php bin/console doctrine:schema:update --force --env=test
- run: php bin/console doctrine:fixtures:load --no-interaction --env=test
- run: bin/phpunit
deploy:
name: Deploy to the deployment repository
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: [php-security-check, twig-lint, yaml-lint, symfony-container-lint, doctrine-entities-lint, phpunit]
steps:
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY }}
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:v2
ini-values: variables_order=EGPCS, date.timezone=Europe/Berlin
extensions: intl
- uses: actions/checkout@v3
with:
# https://stackoverflow.com/a/62293647/5947371
fetch-depth: 0
- uses: actions/cache@v2
with:
path: vendor
key: composer-${{ runner.os }}-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json', 'composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-${{ env.PHP_VERSION }}-
composer-${{ runner.os }}-
- run: |
composer install --no-interaction --no-progress --ansi --no-scripts
composer show
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- run: npm ci
- run: npm run build
- run: |
git config --global user.name "Deployment Bot"
git config --global user.email "[email protected]"
git add ./public/assets/ ./public/sw.js* ./public/workbox* node_modules/jpegoptim-bin/ node_modules/optipng-bin/ --force
git commit -m "Add builded files"
git remote add deployment [email protected]:FabianSchmick/fotografie.fabian-schmick.de.git
git push deployment master --force