mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 22:54:36 -04:00
Working on Github Actions (#3543)
* minor fixes * minor fixes * Fixes for self update * fixes for template previews * Add report_errors variable * Ping route * Create .env.vi * Update and rename .env.vi to .env.ci * Update .env.ci * Update .env.ci * Fixes for .env * Code cleanup * Create release.yml * Update release.yml * Update release.yml * Create phpunit.yml * Update phpunit.yml * Update release.yml * Update .env.ci * Update phpunit.yml * Update release.yml * Update release.yml * Update phpunit.yml * Update .env.ci * Update release.yml * Update .env.ci * Update .env.ci * Update phpunit.yml * Update release.yml * Update release.yml
This commit is contained in:
parent
1d11358215
commit
1a0c20aa9d
15
.env.ci
Normal file
15
.env.ci
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
APP_NAME="Invoice Ninja"
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://ninja.test
|
||||||
|
DB_CONNECTION=db-ninja-01
|
||||||
|
DB_DATABASE1=ninja
|
||||||
|
MULTI_DB_ENABLED=false
|
||||||
|
# database
|
||||||
|
DB_HOST1=localhost
|
||||||
|
DB_PORT1=3306
|
||||||
|
DB_USERNAME1=root
|
||||||
|
DB_PASSWORD1=ninja
|
||||||
|
NINJA_ENVIRONMENT=selfhost
|
||||||
|
COMPOSER_AUTH='{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
|
11
.env.example
11
.env.example
@ -1,7 +1,7 @@
|
|||||||
APP_NAME="Invoice Ninja"
|
APP_NAME="Invoice Ninja"
|
||||||
APP_ENV=local
|
APP_ENV=local
|
||||||
APP_KEY=
|
APP_KEY=
|
||||||
APP_DEBUG=true
|
APP_DEBUG=false
|
||||||
|
|
||||||
APP_URL=http://localhost
|
APP_URL=http://localhost
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ DEMO_MODE=false
|
|||||||
BROADCAST_DRIVER=log
|
BROADCAST_DRIVER=log
|
||||||
LOG_CHANNEL=stack
|
LOG_CHANNEL=stack
|
||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
QUEUE_CONNECTION=sync
|
QUEUE_CONNECTION=database
|
||||||
SESSION_DRIVER=file
|
SESSION_DRIVER=file
|
||||||
SESSION_LIFETIME=120
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
@ -49,4 +49,9 @@ API_SECRET=superdoopersecrethere
|
|||||||
ERROR_EMAIL=
|
ERROR_EMAIL=
|
||||||
|
|
||||||
NINJA_ENVIRONMENT=selfhost
|
NINJA_ENVIRONMENT=selfhost
|
||||||
HASH_SALT=
|
|
||||||
|
SELF_UPDATER_REPO_VENDOR = invoiceninja
|
||||||
|
SELF_UPDATER_REPO_NAME = invoiceninja
|
||||||
|
SELF_UPDATER_USE_BRANCH = v2
|
||||||
|
SELF_UPDATER_MAILTO_ADDRESS = user@example.com
|
||||||
|
SELF_UPDATER_MAILTO_NAME = "John Doe"
|
||||||
|
56
.github/workflows/phpunit.yml
vendored
Normal file
56
.github/workflows/phpunit.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- v2
|
||||||
|
|
||||||
|
name: phpunit
|
||||||
|
jobs:
|
||||||
|
phpunit:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:5.7
|
||||||
|
env:
|
||||||
|
MYSQL_ROOT_PASSWORD: ninja
|
||||||
|
MYSQL_DATABASE: ninja
|
||||||
|
ports:
|
||||||
|
- 33306:3306
|
||||||
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
with:
|
||||||
|
ref: v2
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Copy .env
|
||||||
|
run: |
|
||||||
|
cp .env.ci .env
|
||||||
|
|
||||||
|
- name: Install composer dependencies
|
||||||
|
run: |
|
||||||
|
composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
composer install
|
||||||
|
|
||||||
|
- name: Prepare Laravel Application
|
||||||
|
run: |
|
||||||
|
php artisan key:generate
|
||||||
|
php artisan optimize
|
||||||
|
|
||||||
|
- name: Prepare JS/CSS assets
|
||||||
|
run: |
|
||||||
|
npm i
|
||||||
|
npm run production
|
||||||
|
|
||||||
|
- name: Create DB and schemas
|
||||||
|
run: |
|
||||||
|
mkdir -p database
|
||||||
|
touch database/database.sqlite
|
||||||
|
|
||||||
|
- name: Migrate Database
|
||||||
|
run: |
|
||||||
|
php artisan migrate:fresh --seed --force && php artisan db:seed --class=RandomDataSeeder --force
|
||||||
|
|
||||||
|
- name: Run Testsuite
|
||||||
|
run: vendor/bin/phpunit --testdox
|
66
.github/workflows/release.yml
vendored
Normal file
66
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
|
||||||
|
#on:
|
||||||
|
# push:
|
||||||
|
# branches:
|
||||||
|
# - v2
|
||||||
|
|
||||||
|
name: Upload Release Asset
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Upload Release Asset
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
with:
|
||||||
|
ref: v2
|
||||||
|
|
||||||
|
- name: Install composer dependencies
|
||||||
|
run: |
|
||||||
|
composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
composer install
|
||||||
|
|
||||||
|
- name: Prepare Laravel Application
|
||||||
|
run: |
|
||||||
|
cp .env.example .env
|
||||||
|
php artisan key:generate
|
||||||
|
php artisan optimize
|
||||||
|
php artisan storage:link
|
||||||
|
|
||||||
|
- name: Prepare JS/CSS assets
|
||||||
|
run: |
|
||||||
|
npm i
|
||||||
|
npm run production
|
||||||
|
|
||||||
|
- name: Build project # This would actually build your project, using zip for an example artifact
|
||||||
|
run: |
|
||||||
|
zip -r ./invoiceninja.zip ./
|
||||||
|
|
||||||
|
- name: Get tag name
|
||||||
|
id: get_tag_name
|
||||||
|
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.get_tag_name.outputs.VERSION }}
|
||||||
|
release_name: Release ${{ steps.get_tag_name.outputs.VERSION }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
- name: Upload Release Asset
|
||||||
|
id: upload-release-asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
||||||
|
asset_path: ./invoiceninja.zip
|
||||||
|
asset_name: invoiceninja.zip
|
||||||
|
asset_content_type: application/zip
|
@ -13,6 +13,7 @@ namespace App\Console;
|
|||||||
|
|
||||||
use App\Jobs\Cron\RecurringInvoicesCron;
|
use App\Jobs\Cron\RecurringInvoicesCron;
|
||||||
use App\Jobs\Util\VersionCheck;
|
use App\Jobs\Util\VersionCheck;
|
||||||
|
use App\Utils\Ninja;
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
@ -35,15 +36,17 @@ class Kernel extends ConsoleKernel
|
|||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
{
|
{
|
||||||
// $schedule->command('inspire')
|
|
||||||
// ->hourly();
|
|
||||||
|
|
||||||
//$schedule->job(new RecurringInvoicesCron)->hourly();
|
//$schedule->job(new RecurringInvoicesCron)->hourly();
|
||||||
$schedule->job(new VersionCheck)->daily();
|
$schedule->job(new VersionCheck)->daily();
|
||||||
|
|
||||||
/* Build queue snapshots */
|
/* Build queue snapshots */
|
||||||
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
||||||
|
|
||||||
|
/* Run queue's in shared hosting with this*/
|
||||||
|
if(Ninja::isSelfHost())
|
||||||
|
$schedule->command('queue:work')->everyMinute()->withoutOverlapping();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://opensource.org/licenses/AAL
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class UserProfileController extends BaseController
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the specified resource.
|
|
||||||
*
|
|
||||||
* @param int $id
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function show($id)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*
|
|
||||||
* @param int $id
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function edit($id)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param int $id
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function update(Request $request, $id)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*
|
|
||||||
* @param int $id
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function destroy($id)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
@ -47,7 +47,7 @@ class QueryLogging
|
|||||||
$count = count($queries);
|
$count = count($queries);
|
||||||
$timeEnd = microtime(true);
|
$timeEnd = microtime(true);
|
||||||
$time = $timeEnd - $timeStart;
|
$time = $timeEnd - $timeStart;
|
||||||
// Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
||||||
|
|
||||||
// if($count > 50)
|
// if($count > 50)
|
||||||
// Log::info($queries);
|
// Log::info($queries);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user