Skip to content

Commit

Permalink
Set up the GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
gomzyakov committed Aug 26, 2023
1 parent 6e97ed5 commit 2235a4b
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 17 deletions.
27 changes: 10 additions & 17 deletions .env.example → .env.ci
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_NAME=Laravel
APP_NAME=Secretic
APP_ENV=local
APP_KEY=
APP_KEY=base64:g3cPbmSz3AC3CoGXtbK81jFgYJnobc4iT27AwRs+FQc=
APP_DEBUG=true
APP_URL=http://localhost

Expand All @@ -9,10 +9,10 @@ LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_10_blog
DB_USERNAME=sail
DB_DATABASE=secretic
DB_USERNAME=root
DB_PASSWORD=password

BROADCAST_DRIVER=log
Expand All @@ -24,12 +24,12 @@ SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
Expand All @@ -46,16 +46,9 @@ AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

SCOUT_DRIVER=meilisearch
MEILISEARCH_HOST=http://meilisearch:7700
SENTRY_TRACES_SAMPLE_RATE=1.0
36 changes: 36 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
versioning-strategy: increase
schedule:
interval: "weekly"
labels:
- "dependencies"

# Enable version updates for Docker
- package-ecosystem: "docker"
# Look for a `Dockerfile` in the `root` directory
directory: "/"
# Check for updates once a week
schedule:
interval: "weekly"

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
26 changes: 26 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: php-cs-fixer

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Install Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Run checks of code style
run: composer cs-check
26 changes: 26 additions & 0 deletions .github/workflows/deptrac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: deptrac

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
deptrac:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Install Composer dependencies
run: composer update --no-interaction --prefer-dist

- name: Run tests via PHPStan
run: composer deptrac
26 changes: 26 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PHPStan

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
analyze:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Install Composer dependencies
run: composer update --no-interaction --prefer-dist

- name: Run tests via PHPStan
run: composer phpstan
26 changes: 26 additions & 0 deletions .github/workflows/rector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Rector

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
analyze:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Install dependencies via Composer
run: composer install --no-interaction --prefer-dist

- name: Run checks via Rector
run: composer phpstan
75 changes: 75 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: phpunit

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
phpunit:
runs-on: ubuntu-latest

services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: secretic
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Install PHP extensions
run: sudo apt-get install -y php-phpdbg

- name: Check phpdbg version
run: phpdbg -V

- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.ci', '.env');"

- name: Install Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Generate key
run: php artisan key:generate

- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache

- name: Clear Configuration
run: php artisan config:clear

- name: Run the migrations
run: php artisan migrate

- name: Run tests via PHPUnit
env:
XDEBUG_MODE: coverage
run: |
vendor/bin/phpunit --coverage-clover=coverage.xml
cat ./coverage.xml
- name: Show coverage.xml
run: cat ./coverage.xml

- name: Upload coverage.xml to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
flags: unittests
name: codecov-umbrella
verbose: true
env_vars: PHP

0 comments on commit 2235a4b

Please sign in to comment.