Skip to content

Commit

Permalink
feat: install jetstream and refactor everything (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Mar 31, 2021
1 parent 52900fa commit 894dbf7
Show file tree
Hide file tree
Showing 213 changed files with 15,950 additions and 27,651 deletions.
34 changes: 25 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,49 @@ APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
APP_DISABLE_SIGNUP=false

LOG_CHANNEL=stack
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
97 changes: 97 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
module.exports = {
"env": {
"browser": true,
"es6": true
},
"extends": [
"plugin:vue/recommended"
],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"vue",
],
"rules": {
"array-bracket-spacing": [
"error",
"never"
],
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"no-trailing-spaces": [
"error",
{
"ignoreComments": true,
"skipBlankLines": true
}
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"semi-spacing": [
"error",
{
"after": true,
"before": false
}
],
"semi-style": [
"error",
"last"
],

// strongly recommended
"vue/component-name-in-template-casing": [
"error",
"kebab-case"
],
"vue/component-tags-order": [
"warn",
{
"order": [ [ "style", "template" ], "script" ]
}
],
"vue/html-end-tags" : "error",
"vue/html-self-closing": [
"error",
{
"html": {
"normal": "never",
"void": "always"
}
}
],

"vue/no-v-model-argument": 1,
"vue/no-v-html" : 0,
"vue/max-attributes-per-line": [
// https://vuejs.org/v2/style-guide/#Multi-attribute-elements-strongly-recommended
"error",
{
"singleline": 5,
"multiline": {
"max": 5,
"allowFirstLine": true
}
}
],
"vue/singleline-html-element-content-newline": ["error", {
"ignoreWhenNoAttributes": true,
"ignoreWhenEmpty": true,
"ignores": ["pre", "textarea", "inertia-link", "a", "p", "li"]
}]
}
};
175 changes: 175 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
name: Build and test

on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened]
release:
types: [created]

env:
default-php-version: '8.0'
coverage-with: 'sqlite'


jobs:
#############
# Run tests
#############
tests:
runs-on: ubuntu-latest
name: Tests with PHP ${{ matrix.php-version }} + ${{ matrix.connection }}

strategy:
fail-fast: false
matrix:
php-version: ['8.0']
connection: [sqlite, mysql]
coverage: [true]

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, dom, fileinfo, ${{ matrix.connection }}
coverage: none
- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m

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

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer files
uses: actions/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ matrix.php-version }}
${{ runner.os }}-composer-
- name: Install composer dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

# Prepare
- name: Prepare environment
run: |
cp tests/.env.ci-${{ matrix.connection }} .env
mkdir -p public/js public/css
{\
echo "{"; \
for f in app.js app.css app2.js app2.css; do \
[[ $first == 1 ]] && echo -n "," || first=1; \
k=${f##*.}/$f; \
echo "\"/$k\": \"/$k\""; \
echo '' > public/$k; \
done; \
echo "}"; \
} | tee public/mix-manifest.json
- name: Create sqlite database
if: matrix.connection == 'sqlite'
run: touch database/database.sqlite
- name: Create mysql database
if: matrix.connection == 'mysql'
run: |
sudo systemctl start mysql.service
mysql --protocol=tcp -u root -proot -e "CREATE DATABASE IF NOT EXISTS version CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
- name: Generate key
run: php artisan key:generate

- name: Run migrations
run: php artisan migrate --no-interaction -vvv
# - name: Run seeds
# run: php artisan db:seed --no-interaction -vvv
- name: Cache route
run: php artisan route:cache

# Test
- name: Run tests suite with coverage
if: matrix.connection == env.coverage-with && matrix.php-version == env.default-php-version && matrix.coverage
run: phpdbg -dmemory_limit=4G -qrr vendor/bin/phpunit -c phpunit.xml --log-junit ./results/${{ matrix.connection }}/junit/results.xml --coverage-clover ./results/${{ matrix.connection }}/coverage/coverage.xml
env:
DB_CONNECTION: ${{ matrix.connection }}
- name: Run tests
if: matrix.connection != env.coverage-with || matrix.php-version != env.default-php-version || ! matrix.coverage
run: vendor/bin/phpunit -c phpunit.xml --log-junit ./results/${{ matrix.connection }}/junit/results.xml
env:
DB_CONNECTION: ${{ matrix.connection }}

- name: Fix results files
run: sed -i -e "s%$GITHUB_WORKSPACE/%%g" **/*.xml
working-directory: results/${{ matrix.connection }}

- name: Store results
if: matrix.php-version == env.default-php-version
uses: actions/upload-artifact@v2
with:
name: results
path: results


###########################
# Reporting to sonarcloud
###########################
reporting:
needs: tests
runs-on: ubuntu-latest
name: Sonarcloud
if: ${{ ! startsWith(github.ref, 'dependabot/') }}

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Download results
uses: actions/download-artifact@v2
with:
name: results
path: results

- name: Merge junit files
run: |
yarn global add junit-merge
$(yarn global bin)/junit-merge --recursive --dir results/${{ env.coverage-with }}/junit --out results/results.xml
- name: Set version parameter
id: version
run: |
version=$(git tag --points-at HEAD)
test -z "$version" && version="main"
echo "::set-output name=value::$version"
- name: Set coverage list
id: coverage
run: |
SONAR_COVERAGE=$(ls -m --format=comma results/${{ env.coverage-with }}/coverage/coverage*.xml | sed -e ':a;N;$!ba;s/\n//g; s/ //g;')
echo "::set-output name=list::$SONAR_COVERAGE"
- name: SonarCloud Scan
if: env.SONAR_TOKEN != ''
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: |
-Dsonar.projectVersion=${{ steps.version.outputs.value }}
-Dsonar.php.tests.reportPath=./results/results.xml
-Dsonar.php.coverage.reportPaths=${{ steps.coverage.outputs.list }}
Loading

0 comments on commit 894dbf7

Please sign in to comment.