Skip to content

Commit

Permalink
feat(simplify): Add ci draft
Browse files Browse the repository at this point in the history
  • Loading branch information
ckrack committed Feb 21, 2024
1 parent 2d38f8d commit 146857c
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 23 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI
on:
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP, extensions and composer with shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, iconv, json
env:
update: true

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist -o

- name: Check Symfony requirements
run: vendor/bin/requirements-checker

- name: Check Style
run: vendor/bin/php-cs-fixer check --no-ansi --no-interaction

- name: Static analysis
run: vendor/bin/phpstan check --no-ansi --no-interaction --no-progress

- name: Test
run: php bin/phpunit --no-interaction
39 changes: 39 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Push to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASS }}
script_stop: true
script: |
cd ${{ secrets.PROJECT_PATH}}
git reset --hard
git clean -df
git pull
source .env
source .env.local
export APP_ENV=prod
composer dump-env prod
composer install --no-dev -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist -o
export APP_DEBUG=0
php bin/console cache:clear
export PWD=$(pwd)
envsubst < config/supervisor/hydro-tcp-server.ini > ~/etc/services.d/hydro-tcp-server.ini
supervisorctl reread
supervisorctl restart
php bin/console doctrine:migrations:migrate --no-interaction
46 changes: 24 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@
"license": "proprietary",
"type": "project",
"require": {
"php": ">=8.3",
"php": ">=8.3",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/dbal": "^3",
"doctrine/doctrine-bundle": "^2.11",
"doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^3.0",
"symfony/asset": "7.0.*",
"symfony/console": "~7.0.0",
"symfony/doctrine-messenger": "~7.0.0",
"symfony/dotenv": "~7.0.0",
"doctrine/dbal": "^3",
"doctrine/doctrine-bundle": "^2.11",
"doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^3.0",
"symfony/asset": "7.0.*",
"symfony/console": "~7.0.0",
"symfony/doctrine-messenger": "~7.0.0",
"symfony/dotenv": "~7.0.0",
"symfony/flex": "^2",
"symfony/framework-bundle": "~7.0.0",
"symfony/http-foundation": "~7.0.0",
"symfony/messenger": "~7.0.0",
"symfony/monolog-bundle": "^3.10",
"symfony/runtime": "~7.0.0",
"symfony/twig-bundle": "~7.0.0",
"symfony/uid": "~7.0.0",
"symfony/yaml": "~7.0.0",
"twig/extra-bundle": "^2.12 || ^3.0",
"twig/twig": "^2.12 || ^3.0"
"symfony/framework-bundle": "~7.0.0",
"symfony/http-foundation": "~7.0.0",
"symfony/messenger": "~7.0.0",
"symfony/monolog-bundle": "^3.10",
"symfony/requirements-checker": "^2.0",
"symfony/runtime": "~7.0.0",
"symfony/twig-bundle": "~7.0.0",
"symfony/uid": "~7.0.0",
"symfony/yaml": "~7.0.0",
"twig/extra-bundle": "^2.12 || ^3.0",
"twig/twig": "^2.12 || ^3.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.42",
Expand Down Expand Up @@ -92,8 +93,9 @@
"@auto-scripts"
],
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd",
"requirements-checker": "script"
}
}
}
68 changes: 67 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions config/supervisor/hydro-tcp-server.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[program:hydro-tcp-server]
command=php $PWD/bin/console tcp-server:start
startsecs=60
autostart=yes
autorestart=yes
9 changes: 9 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@
"tests/bootstrap.php"
]
},
"symfony/requirements-checker": {
"version": "2.0",
"recipe": {
"repo": "github.com/schranz-php-recipes/symfony-recipes-php",
"branch": "main",
"version": "2.0",
"ref": "02c6e4b9b117c39e8a23eab7f3840ef6e62293b9"
}
},
"symfony/routing": {
"version": "7.0",
"recipe": {
Expand Down

0 comments on commit 146857c

Please sign in to comment.