Skip to content

Commit

Permalink
Jetstream Install and Initial Setup/Config
Browse files Browse the repository at this point in the history
Signed-off-by: Nuno Souto <[email protected]>
  • Loading branch information
nsouto committed Dec 26, 2021
1 parent 7a7bb95 commit 7ccb90d
Show file tree
Hide file tree
Showing 184 changed files with 38,526 additions and 4,620 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_DRIVER=database
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1
Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Deploy

on:
push:
branches:
- main
- develop
workflow_dispatch:

jobs:
linters-tlint:
name: Linters
uses: lostlink/envmanager/.github/workflows/tlint.yml@main
linters-phpcs:
name: Linters
uses: lostlink/envmanager/.github/workflows/phpcs.yml@main
linters-phpstan:
name: Linters
uses: lostlink/envmanager/.github/workflows/phpstan.yml@main
secrets:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
test:
name: Test
uses: lostlink/envmanager/.github/workflows/test.yml@main
deploy:
name: Deploy to Vapor
runs-on: ubuntu-latest
needs: [linters-tlint,linters-phpcs,linters-phpstan,test]
concurrency: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}

steps:
- name: Check out code
uses: actions/checkout@v2
with:
lfs: true

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION != null && secrets.AWS_REGION || 'us-east-1' }}

- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: 6

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: npm

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-composer-${{ hashFiles('composer.json') }}

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0.13
extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, gmp
coverage: none

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

# - name: Update .env
# run: |
# echo '${{ secrets[format('ENVAULT_{0}', env.APP_ENV)] }}' > .envault.json
# npx envault --filename=.env.${{ env.APP_ENV }} --force
# ./vendor/bin/vapor env:push ${{ env.APP_ENV }} -q
# env:
# VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}

- name: Deploy code
run: ./vendor/bin/vapor deploy ${{ env.APP_ENV }} --commit="${{ github.sha }}"
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}

- name: Upload artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: Logs
path: ./storage/logs

- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: ${{ env.APP_ENV }}
39 changes: 39 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Linters - PHPCS

on:
push:
branches:
- feature/*
- hotfix/*
workflow_call:

jobs:
phpcs:
name: PHPCS
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0.8
extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts --ignore-platform-reqs

- name: PHPCS lint
run: vendor/bin/duster phpcs
49 changes: 49 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Linters - PHPStan

on:
push:
branches:
- feature/*
- hotfix/*
workflow_call:
secrets:
VAPOR_API_TOKEN:
required: true

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0.8
extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts --ignore-platform-reqs

- name: Update .env
run: |
./vendor/bin/vapor env:pull ${{ env.APP_ENV }} -q
cp .env.${{ env.APP_ENV }} .env
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}

- name: PHPStan Analyze
run: vendor/bin/phpstan analyze
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Test

on:
push:
branches:
- feature/*
- hotfix/*
workflow_call:

jobs:
test:
name: Test
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: npm

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-composer-${{ hashFiles('composer.json') }}

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0.8
extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Validate Composer
run: composer validate

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

- name: Copy testing environment config file
run: php -r "file_exists('.env') || copy('.env.testing', '.env');"

- name: Copy example environment config file
run: php -r "file_exists('.env') || copy('.env.example', '.env');"

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

- name: Prepare Frontend Assets
run: npm ci && npm run prod

- name: Run Tests
run: ./vendor/bin/pest
env:
APP_ENV: testing

- name: Upload artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: Logs
path: ./storage/logs
39 changes: 39 additions & 0 deletions .github/workflows/tlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Linters - TLint

on:
push:
branches:
- feature/*
- hotfix/*
workflow_call:

jobs:
tlint:
name: TLint
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0.8
extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts --ignore-platform-reqs

- name: Tlint Lint
run: vendor/bin/duster tlint
28 changes: 17 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.*
.idea
.vapor/
.DS_Store
.blueprint
.phpstorm.meta.php
.php-cs-fixer.cache
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
storage/*
cghooks.lock
geoip.tar.gz
npm-debug.log
yarn-error.log
/.idea
/.vscode
_ide_helper.php
/vendor
/public/*
/_scratch/
/draft.yaml
/node_modules
/storage/*.key
1 change: 0 additions & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
php:
preset: laravel
version: 8
disabled:
- no_unused_imports
finder:
Expand Down
14 changes: 14 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "stylelint-config-standard",
"rules": {
"indentation": 4,
"at-rule-no-unknown": [ true, {
"ignoreAtRules": [
"tailwind"
]
}],
"no-eol-whitespace": [ true, {
"ignore": ["empty-lines"]
}]
}
}
Loading

0 comments on commit 7ccb90d

Please sign in to comment.