makefile and compose improvements #885
Workflow file for this run
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
# GitHub Action for Symfony | |
name: UDOIT | |
on: [push, pull_request] | |
jobs: | |
symfony: | |
name: UDOIT (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}) | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ubuntu-latest] | |
php-versions: ['8.2'] | |
node-version: [16.19.0] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Check PHP syntax errors | |
uses: overtrue/[email protected] | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, gd, pdo_mysql, pdo_pgsql | |
coverage: xdebug #optional | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: php-${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: php-${{ matrix.php-versions }}-composer- | |
- name: Create .env file | |
run: cp .env.example .env | |
- name: Install Composer dependencies | |
run: composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: PHPUnit Testing | |
run: SYMFONY_DEPRECATIONS_HELPER=disabled ./vendor/bin/phpunit | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | |
- uses: actions/cache@v2 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: php-${{ matrix.php-versions }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
php-${{ matrix.php-versions }}-yarn- | |
- name: Yarn install | |
run: yarn install | |
- name: Yarn build | |
run: yarn build | |
- name: Yarn test | |
run: yarn test | |
- name: Start and initialize Postgres | |
env: | |
DATABASE_URL: postgresql://udoit:[email protected]:5432/udoit?serverVersion=11&charset=utf8 | |
run: | | |
sudo systemctl start postgresql.service | |
sudo -u postgres psql -c "CREATE DATABASE udoit;" | |
sudo -u postgres psql -c "CREATE USER udoit WITH PASSWORD 'udoit';" | |
sudo -u postgres psql -c "ALTER USER udoit WITH SUPERUSER;" | |
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE "udoit" TO udoit;" | |
php bin/console doctrine:migrations:migrate | |
- name: Create and populate MySQL database | |
env: | |
DATABASE_URL: mysql://root:root@localhost/udoit | |
run: | | |
sudo systemctl start mysql.service | |
php bin/console doctrine:database:create | |
php bin/console doctrine:migrations:migrate |