Updated doctrine recipe #174
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
name: CI | |
on: | |
push: | |
branches: [ main, dev ] | |
pull_request: | |
branches: [ '*' ] | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
version: [8.2,8.3] | |
name: Tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.version }} | |
tools: composer | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Build the stack | |
run: docker-compose up -d | |
- name: Tests | |
run: composer test | |
- name: Run PhpUnit | |
run: ./vendor/bin/phpunit | |
deploy_dev: | |
name: Deploy in dev | |
needs: tests | |
if: github.ref == 'refs/heads/dev' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
tools: composer | |
- name: Install dependencies | |
run: APP_ENV=prod APP_DEBUG=1 composer install --no-dev --optimize-autoloader --prefer-dist --no-progress --no-suggest | |
- name: Rsync deploy | |
uses: Burnett01/rsync-deployments@5.2.1 | |
with: | |
switches: -avzr --delete --exclude '.git' --exclude 'var' --exclude '.env.local' --exclude '.env.*.local' --exclude '.github' --exclude '.phpunit.cache' --exclude '.php-cs-fixer.cache' | |
path: / | |
remote_path: ${{ secrets.DEPLOY_PATH_DEV }} | |
remote_host: ${{ secrets.DEPLOY_HOST }} | |
remote_port: ${{ secrets.DEPLOY_PORT }} | |
remote_user: ${{ secrets.DEPLOY_USER }} | |
remote_key: ${{ secrets.DEPLOY_KEY }} | |
- name: Execute post-deploy actions | |
uses: appleboy/ssh-action@v0.1.8 | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
port: ${{ secrets.DEPLOY_PORT }} | |
username: ${{ secrets.DEPLOY_USER }} | |
key: ${{ secrets.DEPLOY_KEY }} | |
script: | | |
cd ${{ secrets.DEPLOY_PATH_DEV }} | |
./scripts/post-deploy | |
deploy_prod: | |
name: Deploy in production | |
needs: tests | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
tools: composer | |
- name: Install dependencies | |
run: APP_ENV=prod APP_DEBUG=0 composer install --no-dev --optimize-autoloader --prefer-dist --no-progress --no-suggest | |
- name: Rsync deploy | |
uses: Burnett01/rsync-deployments@5.2.1 | |
with: | |
switches: -avzr --delete --exclude '.git' --exclude 'var' --exclude '.env.local' --exclude '.env.*.local' --exclude '.github' --exclude '.phpunit.cache' --exclude '.php-cs-fixer.cache' | |
path: / | |
remote_path: ${{ secrets.DEPLOY_PATH_PROD }} | |
remote_host: ${{ secrets.DEPLOY_HOST }} | |
remote_port: ${{ secrets.DEPLOY_PORT }} | |
remote_user: ${{ secrets.DEPLOY_USER }} | |
remote_key: ${{ secrets.DEPLOY_KEY }} | |
- name: Execute post-deploy actions | |
uses: appleboy/ssh-action@v0.1.8 | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
port: ${{ secrets.DEPLOY_PORT }} | |
username: ${{ secrets.DEPLOY_USER }} | |
key: ${{ secrets.DEPLOY_KEY }} | |
script: | | |
cd ${{ secrets.DEPLOY_PATH_PROD }} | |
./scripts/post-deploy |